DeepKE is a knowledge extraction toolkit that supports low-resource and document-level scenarios

DeepKE is a knowledge extraction toolkit that supports low-resource and document-level scenarios

2022-09-14 0 1,569
Resource Number 38498 Last Updated 2025-02-24
¥ 0HKD Upgrade VIP
Download Now Matters needing attention
Can't download? Please contact customer service to submit a link error!
Value-added Service: Installation Guide Environment Configuration Secondary Development Template Modification Source Code Installation

The recommended DeepKE in this issue is an open-source knowledge graph extraction toolset maintained by the knowledge graph team of Zhejiang University.

Project Introduction

DeepKE is a knowledge extraction toolkit that supports low-resource and document-level scenarios. It provides three PyTorch-based features, including named entity recognition, relationship extraction, and attribute extraction. DeepKE implements a variety of information extraction tasks, including named entity recognition, relationship extraction, and attribute extraction. With a unified framework, DeepKE allows developers and researchers to customize datasets and models to extract information from unstructured text according to their requirements. Specifically, DeepKE not only provides various functional modules and model implementations for different functions and scenarios, but also organizes all components through a consistent framework to maintain sufficient modularity and scalability.

DeepKE is a knowledge extraction toolkit that supports low-resource and document-level scenarios插图

Supports weight and deviation

To enable automatic hyperparameter fine-tuning, DeepKE employs Weight & Biases, a machine learning toolkit for developers to build better models faster. With this toolkit, DeepKE can better automate the visualization of results and adjust parameters. The toolkit is supported by sample runtimes for all functions in the repository, and researchers are able to modify the metric and hyperparameter configurations as needed.

Model architecture

DeepKE is a knowledge extraction toolkit that supports low-resource and document-level scenarios插图1

Architecture diagram

  • DeepKE has designed a unified framework for three knowledge extraction functions (named entity recognition, relationship extraction, and attribute extraction).
  • Different functions can be implemented in different scenarios. For example, relationship extraction can be performed in standard full supervision, low resources and few samples, and document-level settings
  • Each application scenario consists of three parts: the Data part contains the Tokenizer, Preprocessor, and Loader, the Model part contains the Module, Encoder, and Forwarder, and the Core part contains Training, Evaluation, and Prediction

Get started quickly

DeepKE supports pip installation and use, taking the conventional fully supervised setting relationship extraction as an example, a regular relationship extraction model can be realized through the following 6 steps

1. Download the code

git clone https://github.com/zjunlp/DeepKE.git

2. Use anaconda to create a virtual environment and enter the virtual environment (provide the Dockerfile source code to create an image by yourself, located in the docker folder)

conda create -n deepke python=3.8

conda activate deepke

//Provide a dockerfile to create a docker image
cd docker
docker build -t deepke .
conda activate deepke

1)Installed based on pip and used directly

pip install deepke

2) Installation based on source code

python setup.py install

python setup.py develop

3.Go to the task folder and take regular relationship extraction as an example

cd DeepKE/example/re/standard

4.Download the dataset

wget 120.27.214.45/Data/re/standard/data.tar.gz

tar -xzvf data.tar.gz

5.For model training, the parameters used in the training can be modified in the conf folder

DeepKE uses wandb to support visual parameter tuning

python run.py

6.Model prediction. The parameters used for prediction can be modified in the conf folder

Modify conf/predict.yaml to save the path of the trained model.

python predict.py

example

Standard renewables

The standard modules are implemented by common deep learning models, including CNNs, RNNs, Capsules, GCNs, Transformers, and pretrained models.

Step 1

enter

DeepKE/example/re/standard folder.

Step 2

Get the data:

wget 120.27.214.45/Data/re/standard/data.tar.gz

tar -xzvf data .tar.gz

dataYou can customize the dataset and the parameter conf in folders and folders separately.

The dataset needs to be imported as a CSV file.

The data format of the file must meet the following requirements:

sentence

relationship

head

Head_offset

tail

tail_offset

The file format of the relationship needs to meet the following requirements:

Head shape

Tail type

relationship

index

Step 3

Train:

Python runs .py

Step 4

Forecast:

Python predicts .py

cd example/re/standard

wget 120.27.214.45/Data/re/standard/data.tar.gz

tar -xzvf data.tar.gz

python run.py

python predict.py

remark

  • When using Anaconda, it is recommended to add a domestic image for faster downloads.
  • When using pip, we recommend that you use domestic images, such as Alibaba Cloud images, for faster downloads.
  • After installation, the ModuleNotFoundError: No module named ‘past’ message is displayed, and the pip install future command is used to solve the problem.
  • When using a language pretrained model, it is slow to install and download the model online, so it is recommended to download it in advance and store it in the pretrained folder. For specific file storage requirements, see the README.md in the folder.
  • The old version of DeepKE is located in the deepke-v1.0 branch, and users can switch branches to use the old version, and all the capabilities of the old version have been migrated to the standard setting relationship extraction (example/re/standard).
资源下载此资源为免费资源立即下载
Telegram:@John_Software

Disclaimer: This article is published by a third party and represents the views of the author only and has nothing to do with this website. This site does not make any guarantee or commitment to the authenticity, completeness and timeliness of this article and all or part of its content, please readers for reference only, and please verify the relevant content. The publication or republication of articles by this website for the purpose of conveying more information does not mean that it endorses its views or confirms its description, nor does it mean that this website is responsible for its authenticity.

Ictcoder Free Source Code DeepKE is a knowledge extraction toolkit that supports low-resource and document-level scenarios https://ictcoder.com/deepke-is-a-knowledge-extraction-toolkit-that-supports-low-resource-and-document-level-scenarios/

Share free open-source source code

Q&A
  • 1. Automatic: After making an online payment, click the (Download) link to download the source code; 2. Manual: Contact the seller or the official to check if the template is consistent. Then, place an order and make payment online. The seller ships the goods, and both parties inspect and confirm that there are no issues. ICTcoder will then settle the payment for the seller. Note: Please ensure to place your order and make payment through ICTcoder. If you do not place your order and make payment through ICTcoder, and the seller sends fake source code or encounters any issues, ICTcoder will not assist in resolving them, nor can we guarantee your funds!
View details
  • 1. Default transaction cycle for source code: The seller manually ships the goods within 1-3 days. The amount paid by the user will be held in escrow by ICTcoder until 7 days after the transaction is completed and both parties confirm that there are no issues. ICTcoder will then settle with the seller. In case of any disputes, ICTcoder will have staff to assist in handling until the dispute is resolved or a refund is made! If the buyer places an order and makes payment not through ICTcoder, any issues and disputes have nothing to do with ICTcoder, and ICTcoder will not be responsible for any liabilities!
View details
  • 1. ICTcoder will permanently archive the transaction process between both parties and snapshots of the traded goods to ensure the authenticity, validity, and security of the transaction! 2. ICTcoder cannot guarantee services such as "permanent package updates" and "permanent technical support" after the merchant's commitment. Buyers are advised to identify these services on their own. If necessary, they can contact ICTcoder for assistance; 3. When both website demonstration and image demonstration exist in the source code, and the text descriptions of the website and images are inconsistent, the text description of the image shall prevail as the basis for dispute resolution (excluding special statements or agreements); 4. If there is no statement such as "no legal basis for refund" or similar content, any indication on the product that "once sold, no refunds will be supported" or other similar declarations shall be deemed invalid; 5. Before the buyer places an order and makes payment, the transaction details agreed upon by both parties via WhatsApp or email can also serve as the basis for dispute resolution (in case of any inconsistency between the agreement and the description of the conflict, the agreement shall prevail); 6. Since chat records and email records can serve as the basis for dispute resolution, both parties should only communicate with each other through the contact information left on the system when contacting each other, in order to prevent the other party from denying their own commitments. 7. Although the probability of disputes is low, it is essential to retain important information such as chat records, text messages, and email records, in case a dispute arises, so that ICTcoder can intervene quickly.
View details
  • 1. As a third-party intermediary platform, ICTcoder solely protects transaction security and the rights and interests of both buyers and sellers based on the transaction contract (product description, agreed content before the transaction); 2. For online trading projects not on the ICTcoder platform, any consequences are unrelated to this platform; regardless of the reason why the seller requests an offline transaction, please contact the administrator to report.
View details

Related Source code

ICTcoder Customer Service

24-hour online professional services