Comments (2)
Thanks for your attention!
- prompt_guids is 4 * [bsz, 256, 2, 2]. Shouldn't the dimension of torch.cat(prompt_guids, dim=1) is [bsz, 1024, 2, 2], but it's [bsz, 3840, 2, 2] in fact.
Actually, prompt_guids is [[bsz, 256, 2, 2], [bsz, 512, 2, 2], [bsz, 1024, 2, 2], [bsz,2048, 2, 2]], so the dimension of concatenation is [bsz, 3840, 2, 2].
- What does this code do? Is it just calculating the k,v values of superimposing four resnet blocks onto that self-attention layer?
for i in range(4): key_val = key_val + torch.einsum('bg,blh->blh', prompt_gate[:, i].view(-1, 1), split_prompt_guids[I])
The goal of this code is to use the dynamic gates(prompt_gate) to aggregate hierarchical image features(split_prompt_guids) to obtain the visual prefix(key, values).
- Why choose 64?
We use bert-base-uncased
as the PLM, which has 768 hidden size and 12 attention heads, so the size of each attention head is768 / 12 = 64
.
- If I want to switch to roberta plm, where I need to modify?
You need to modify the source code modeling_roberta.py
like models/modeling_bert.py
. For example, set past_key_values_length=0
before embedding_output = self.embeddings(...)
. For other places that need to be modified, please refer to the content annotated with #add
in models/modeling_bert.py
.
from hvpnet.
Thank you very much for your answer,
Wish you a happy life!
from hvpnet.
Related Issues (18)
- How to test the RE models HOT 2
- 关系数据集中object image的获取方案? HOT 2
- RuntimeError: mat1 dim 1 must match mat2 dim 0 HOT 2
- What are the details of using the visual grouding tool? HOT 2
- No error HOT 2
- Question about Twitter-2015 HOT 2
- data preprocess HOT 1
- 关于MRE任务中F1计算的问题 HOT 2
- 关于 使用 visual grouding 工具提取局部视觉图像的代码实现,能提供一下吗 HOT 4
- question HOT 5
- 关于论文中对比实验的疑问? HOT 5
- Request for the object image data HOT 2
- Question about the "Segmentation fault (core dumped)" error
- Not putting parameters into optimizer but still trainable HOT 3
- Twitter15数据集修改部分实体类别 HOT 4
- RE数据集下载太慢 HOT 7
- Twitter15_ckpt, Twitter17_ckpt,re_ckpt需要访问权限 HOT 2
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 hvpnet.