Comments (20)
Hi, in this code version, we directly put strucural information as adjacency matrix in the self-attention module for simplicity.
It is easy to put structural encoder (an extra linear to encode the power of attention matrix).
Because the structural encoder is actually like a hyper-parameter and you can choose to use this module which is dependable on the actual knowledge graph you choose.
We will complete this part in the future version and also release the code version for relation prediction.
from relphormer.
you can find the implementation in the BertSelfAttention module (321 line.) in huggingface_relformer.py,
from relphormer.
Hi, thank you for your patient reply. I also want to ask why I can't enter BertSelfAttention in huggingface_relformer.py when I start from the main function for single-step debugging?
from relphormer.
Did you first pre-train the model for initialization and then load the pre-trained model?
The hyper-parameters of two stage are different and the second stage will import the huggingface_relformer.py.
from relphormer.
When performing pre-training or entity prediction, some files need to be downloaded, but it is very slow, so I downloaded it from https://huggingface.co/bert-base-uncased, am I right? The following is the hyperparameter setting for my running entity prediction.
from relphormer.
Yes, that is right. I think I find the different point.
You should run the "main.py" in the "Relphormer" directory instead of the same file in the "pre-train" directory.
from relphormer.
Sorry, I didn't present clearly, I just put the pre-trained model bert-base-uncased in the "pretrain" directory, this is run the "main.py" in the "Relphormer" directory.
from relphormer.
ok, can you check the program by putting the debug point in [from models.huggingface_relformer import [BertForMaskedLM]]
It imports the "models.huggingface_relformer" file.
from relphormer.
Sorry, I can only find the class BertForMaskedLM, but I can't find the code [from models.huggingface_relformer import [BertForMaskedLM]]
from relphormer.
Can you directly import the huggingface_relformer.py file? Because we rewrite the BertForMaskedLM class in this file.
from relphormer.
Do you mean to create a new file and try to import the huggingface_relformer.py file?
from relphormer.
Yes, you can try do that in the second training stage and it will also make sense.
from relphormer.
Single-step debugging of the main function to trainer.fit(lit_model, datamodule=data) will start training, unable to enter huggingface_relformer.py
from relphormer.
You can find the line which imports the model class.
Line 51 in 7ea60b5
model_class = _import_class(f"models.{temp_args.model_class}")
from relphormer.
The hyperparameter setting of args.model_class is BertKGC. Will the model in huggingface_relformer.py be called during the execution of BertKGC?
from relphormer.
Lines 1 to 7 in 7ea60b5
The model_class BertKGC is inherited from BertForMaskedLM in huggingface_relformer.py
from relphormer.
Doesn't the attention_mask in the BertSelfAttention module (line 321) in huggingface_relformer.py actually build? I saw that attention_mask first came from the image below:
from relphormer.
Hi, we generate the attention mask for each center triple and you can find in the input of the module.
from relphormer.
Can you tell me exactly where in the input module?
from relphormer.
Lines 319 to 327 in 7ea60b5
from relphormer.
Related Issues (20)
- 关于KeyError: 'label'的问题 HOT 2
- about running time HOT 4
- What are the main differences between Relphormer and Kgtrransformer HOT 3
- Issue while saving model for Entity Embedding Initialization HOT 4
- BrokenPipe HOT 3
- 链路预测中 HittER 模型在wn18rr数据集上的指标与原文不一致 HOT 6
- conda environment file HOT 2
- triple2seq process HOT 2
- Question about examples. HOT 1
- About entity one-hop generate and fair comparision HOT 5
- 链接预测在FB15k-237数据集上跑出来的MRR比论文中低很多 HOT 8
- 似乎现有的pipeline不能跑通 HOT 3
- 第一步处理完的masked数据中出现了relation中没有的tmethod_of字段 HOT 5
- 请问是不是没有download.sh文件 HOT 4
- requirements.txt文件是空的? HOT 3
- some questions HOT 5
- 关于代码复现与实现中的问题 HOT 10
- 1
- Error: masked_head_neighbor.txt not found - How to reproduce recommendation task HOT 7
- Dependency issues between pytorch-lightning and pyyaml
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from relphormer.