test
This commit is contained in:
commit
cfb7b1c987
12
README.md
12
README.md
|
@ -84,7 +84,17 @@ DeepKE 提供了多种知识抽取模型。
|
||||||
|
|
||||||
2. NER
|
2. NER
|
||||||
|
|
||||||
数据为txt文件,样式范例为:
|
数据为txt文件
|
||||||
|
|
||||||
|
中文样式范例为:
|
||||||
|
|
||||||
|
| Sentence | Person | Location | Organization |
|
||||||
|
| :----------------------------------------------------------: | :------------------------: | :----------: | :----------------------------: |
|
||||||
|
| 本报北京9月4日讯记者杨涌报道:部分省区人民日报宣传发行工作座谈会9月3日在4日在京举行。 | 杨涌 | 北京,京 | 人民日报 |
|
||||||
|
| 《红楼梦》是中央电视台和中国电视剧制作中心根据中国古典文学名著《红楼梦》摄制于1987年的一部古装连续剧,由王扶林导演,周汝昌、王蒙、周岭等多位红学家参与制作。 | 王扶林,周汝昌,王蒙,周岭 | / | 中央电视台,中国电视剧制作中心 |
|
||||||
|
| 秦始皇兵马俑位于陕西省西安市,1961年被国务院公布为第一批全国重点文物保护单位,是世界八大奇迹之一。 | 秦始皇 | 陕西省西安市 | 国务院 |
|
||||||
|
|
||||||
|
英文样式范例为:
|
||||||
|
|
||||||
| Sentence | Person | Location | Organization | Miscellaneous |
|
| Sentence | Person | Location | Organization | Miscellaneous |
|
||||||
| :----------------------------------------------------------: | :----------------------------------: | :---------------: | :-------------------------: | :-------------------: |
|
| :----------------------------------------------------------: | :----------------------------------: | :---------------: | :-------------------------: | :-------------------: |
|
||||||
|
|
|
@ -4,12 +4,14 @@ import torch
|
||||||
import logging
|
import logging
|
||||||
import hydra
|
import hydra
|
||||||
from hydra import utils
|
from hydra import utils
|
||||||
from deepke.ae_st_tools import Serializer
|
from deepke.attribution_extraction.standard.tools import Serializer
|
||||||
from deepke.ae_st_tools import _serialize_sentence, _convert_tokens_into_index, _add_pos_seq, _handle_attribute_data
|
from deepke.attribution_extraction.standard.tools import _serialize_sentence, _convert_tokens_into_index, _add_pos_seq, _handle_attribute_data
|
||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "../")))
|
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "../")))
|
||||||
from deepke.ae_st_utils import load_pkl, load_csv
|
from deepke.attribution_extraction.standard.utils import load_pkl, load_csv
|
||||||
import deepke.ae_st_models as models
|
import deepke.attribution_extraction.standard.models as models
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
|
@ -11,9 +11,9 @@ from torch.utils.tensorboard import SummaryWriter
|
||||||
# self
|
# self
|
||||||
import sys
|
import sys
|
||||||
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "../")))
|
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "../")))
|
||||||
import deepke.ae_st_models as models
|
import deepke.attribution_extraction.standard.models as models
|
||||||
from deepke.ae_st_tools import preprocess , CustomDataset, collate_fn ,train, validate
|
from deepke.attribution_extraction.standard.tools import preprocess , CustomDataset, collate_fn ,train, validate
|
||||||
from deepke.ae_st_utils import manual_seed, load_pkl
|
from deepke.attribution_extraction.standard.utils import manual_seed, load_pkl
|
||||||
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
from setuptools import setup, find_packages
|
||||||
|
setup(
|
||||||
|
name='deepke', # 打包后的包文件名
|
||||||
|
version='0.2.24', #版本号
|
||||||
|
keywords=["pip", "RE","NER","AE"], # 关键字
|
||||||
|
description='DeepKE 是基于 Pytorch 的深度学习中文关系抽取处理套件。', # 说明
|
||||||
|
long_description="client", #详细说明
|
||||||
|
license="Apache-2.0 License", # 许可
|
||||||
|
url='https://github.com/zjunlp/deepke',
|
||||||
|
author='ZJUNLP',
|
||||||
|
author_email='xx2020@zju.edu.cn',
|
||||||
|
include_package_data=True,
|
||||||
|
platforms="any",
|
||||||
|
package_dir={"": "src"},
|
||||||
|
packages=find_packages("src"),
|
||||||
|
classifiers=[
|
||||||
|
"Programming Language :: Python :: 3",
|
||||||
|
"Operating System :: OS Independent",
|
||||||
|
]
|
||||||
|
)
|
|
@ -0,0 +1,2 @@
|
||||||
|
from .attribution_extraction import *
|
||||||
|
from .relation_extraction import *
|
|
@ -0,0 +1 @@
|
||||||
|
from .standard import *
|
|
@ -0,0 +1,4 @@
|
||||||
|
from .models import *
|
||||||
|
from .module import *
|
||||||
|
from .tools import *
|
||||||
|
from .utils import *
|
|
@ -1,6 +1,6 @@
|
||||||
import torch.nn as nn
|
import torch.nn as nn
|
||||||
from . import BasicModule
|
from . import BasicModule
|
||||||
from module import Embedding, RNN
|
from ..module import Embedding, RNN
|
||||||
|
|
||||||
|
|
||||||
class BiLSTM(BasicModule):
|
class BiLSTM(BasicModule):
|
|
@ -1,9 +1,9 @@
|
||||||
import torch
|
import torch
|
||||||
from . import BasicModule
|
from . import BasicModule
|
||||||
from module import Embedding, CNN
|
from ..module import Embedding, CNN
|
||||||
from module import Capsule as CapsuleLayer
|
from ..module import Capsule as CapsuleLayer
|
||||||
|
|
||||||
from utils import seq_len_to_mask, to_one_hot
|
from ..utils import seq_len_to_mask, to_one_hot
|
||||||
|
|
||||||
|
|
||||||
class Capsule(BasicModule):
|
class Capsule(BasicModule):
|
|
@ -1,10 +1,10 @@
|
||||||
import torch
|
import torch
|
||||||
import torch.nn as nn
|
import torch.nn as nn
|
||||||
from . import BasicModule
|
from . import BasicModule
|
||||||
from module import Embedding
|
from ..module import Embedding
|
||||||
from module import GCN as GCNBlock
|
from ..module import GCN as GCNBlock
|
||||||
|
|
||||||
from utils import seq_len_to_mask
|
from ..utils import seq_len_to_mask
|
||||||
|
|
||||||
|
|
||||||
class GCN(BasicModule):
|
class GCN(BasicModule):
|
|
@ -1,9 +1,9 @@
|
||||||
from torch import nn
|
from torch import nn
|
||||||
from . import BasicModule
|
from . import BasicModule
|
||||||
from module import RNN
|
from ..module import RNN
|
||||||
from transformers import BertModel
|
from transformers import BertModel
|
||||||
|
|
||||||
from utils import seq_len_to_mask
|
from ..utils import seq_len_to_mask
|
||||||
|
|
||||||
|
|
||||||
class LM(BasicModule):
|
class LM(BasicModule):
|
|
@ -2,9 +2,9 @@ import torch
|
||||||
import torch.nn as nn
|
import torch.nn as nn
|
||||||
import torch.nn.functional as F
|
import torch.nn.functional as F
|
||||||
from . import BasicModule
|
from . import BasicModule
|
||||||
from module import Embedding, CNN
|
from ..module import Embedding, CNN
|
||||||
|
|
||||||
from utils import seq_len_to_mask
|
from ..utils import seq_len_to_mask
|
||||||
|
|
||||||
|
|
||||||
class PCNN(BasicModule):
|
class PCNN(BasicModule):
|
|
@ -1,9 +1,9 @@
|
||||||
import torch.nn as nn
|
import torch.nn as nn
|
||||||
from . import BasicModule
|
from . import BasicModule
|
||||||
from module import Embedding
|
from ..module import Embedding
|
||||||
from module import Transformer as TransformerBlock
|
from ..module import Transformer as TransformerBlock
|
||||||
|
|
||||||
from utils import seq_len_to_mask
|
from ..utils import seq_len_to_mask
|
||||||
|
|
||||||
|
|
||||||
class Transformer(BasicModule):
|
class Transformer(BasicModule):
|
|
@ -3,7 +3,7 @@ from torch.utils.data import Dataset
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "../")))
|
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "../")))
|
||||||
from deepke.utils import load_pkl
|
from utils import load_pkl
|
||||||
|
|
||||||
def collate_fn(cfg):
|
def collate_fn(cfg):
|
||||||
|
|
|
@ -3,8 +3,8 @@ import logging
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
from typing import List, Dict
|
from typing import List, Dict
|
||||||
from transformers import BertTokenizer
|
from transformers import BertTokenizer
|
||||||
from serializer import Serializer
|
from .serializer import Serializer
|
||||||
from vocab import Vocab
|
from .vocab import Vocab
|
||||||
import sys
|
import sys
|
||||||
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "../")))
|
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "../")))
|
||||||
from utils import save_pkl, load_csv
|
from utils import save_pkl, load_csv
|
|
@ -1,7 +1,7 @@
|
||||||
import torch
|
import torch
|
||||||
import logging
|
import logging
|
||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
from metrics import PRMetric
|
from .metrics import PRMetric
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
from .standard import *
|
Before Width: | Height: | Size: 149 KiB After Width: | Height: | Size: 149 KiB |
Before Width: | Height: | Size: 149 KiB After Width: | Height: | Size: 149 KiB |
|
@ -0,0 +1,4 @@
|
||||||
|
from .models import *
|
||||||
|
from .module import *
|
||||||
|
from .tools import *
|
||||||
|
from .utils import *
|
|
@ -1,6 +1,6 @@
|
||||||
import torch.nn as nn
|
import torch.nn as nn
|
||||||
from . import BasicModule
|
from . import BasicModule
|
||||||
from module import Embedding, RNN
|
from ..module import Embedding, RNN
|
||||||
|
|
||||||
|
|
||||||
class BiLSTM(BasicModule):
|
class BiLSTM(BasicModule):
|
|
@ -1,9 +1,9 @@
|
||||||
import torch
|
import torch
|
||||||
from . import BasicModule
|
from . import BasicModule
|
||||||
from module import Embedding, CNN
|
from ..module import Embedding, CNN
|
||||||
from module import Capsule as CapsuleLayer
|
from ..module import Capsule as CapsuleLayer
|
||||||
|
|
||||||
from utils import seq_len_to_mask, to_one_hot
|
from ..utils import seq_len_to_mask, to_one_hot
|
||||||
|
|
||||||
|
|
||||||
class Capsule(BasicModule):
|
class Capsule(BasicModule):
|
|
@ -1,9 +1,9 @@
|
||||||
import torch
|
import torch
|
||||||
import torch.nn as nn
|
import torch.nn as nn
|
||||||
from . import BasicModule
|
from . import BasicModule
|
||||||
from module import Embedding
|
from ..module import Embedding
|
||||||
from module import GCN as GCNBlock
|
from ..module import GCN as GCNBlock
|
||||||
from utils import seq_len_to_mask
|
from ..utils import seq_len_to_mask
|
||||||
|
|
||||||
|
|
||||||
class GCN(BasicModule):
|
class GCN(BasicModule):
|
|
@ -1,8 +1,8 @@
|
||||||
from torch import nn
|
from torch import nn
|
||||||
from . import BasicModule
|
from . import BasicModule
|
||||||
from module import RNN
|
from ..module import RNN
|
||||||
from transformers import BertModel
|
from transformers import BertModel
|
||||||
from utils import seq_len_to_mask
|
from ..utils import seq_len_to_mask
|
||||||
|
|
||||||
|
|
||||||
class LM(BasicModule):
|
class LM(BasicModule):
|
|
@ -2,8 +2,8 @@ import torch
|
||||||
import torch.nn as nn
|
import torch.nn as nn
|
||||||
import torch.nn.functional as F
|
import torch.nn.functional as F
|
||||||
from . import BasicModule
|
from . import BasicModule
|
||||||
from module import Embedding, CNN
|
from ..module import Embedding, CNN
|
||||||
from utils import seq_len_to_mask
|
from ..utils import seq_len_to_mask
|
||||||
|
|
||||||
|
|
||||||
class PCNN(BasicModule):
|
class PCNN(BasicModule):
|
|
@ -1,8 +1,8 @@
|
||||||
import torch.nn as nn
|
import torch.nn as nn
|
||||||
from . import BasicModule
|
from . import BasicModule
|
||||||
from module import Embedding
|
from ..module import Embedding
|
||||||
from module import Transformer as TransformerBlock
|
from ..module import Transformer as TransformerBlock
|
||||||
from utils import seq_len_to_mask
|
from ..utils import seq_len_to_mask
|
||||||
|
|
||||||
|
|
||||||
class Transformer(BasicModule):
|
class Transformer(BasicModule):
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue