ma-lab-berkeley / crate Goto Github PK
View Code? Open in Web Editor NEWCode for CRATE (Coding RAte reduction TransformEr).
License: MIT License
Code for CRATE (Coding RAte reduction TransformEr).
License: MIT License
Thanks for your inspiring work!! Several confusion about the code implementation.
In the setting, matrix nn.Linear()
implementation.
Besides, in the MSSA equation,
There is a to_out = nn.Linear
implementation. I think it destroys the theoretical property.
In ISTA module, there is a dictionary
Be appreciate for the reply! Thanks again!
Thank you for open-sourcing such a great work! I have some questions regarding the potential of taking one more step to make the entire CRATE white-box.
As mentioned in the paper, CRATE is trained in a supervised manner with cross-entropy loss to update the dictionary and subspaces parameter, which somehow makes the learning more task-dependent than ReduNet. Is it theoretically rigorous to say that, I can flatten the Z matrix, whose N columns z are learnt representation of tokens with underlying distribution being mixture of Gaussian, then input them to ReduNet and obtain compressed and discriminated representation of the image as a whole? Though I am not sure how the dictionary for tokens should be updated in this case.
在attention代码中,我发现有一个名为to_out的操作,我无法理解这个操作是用来实现什么功能的
具体代码为:
class Attention(nn.Module):
def init(self, dim, heads = 8, dim_head = 64, dropout = 0.):
super().init()
inner_dim = dim_head * heads
project_out = not (heads == 1 and dim_head == dim)
self.heads = heads
self.scale = dim_head ** -0.5
self.attend = nn.Softmax(dim = -1)
self.dropout = nn.Dropout(dropout)
self.qkv = nn.Linear(dim, inner_dim, bias=False)
self.to_out = nn.Sequential(
nn.Linear(inner_dim, dim),
nn.Dropout(dropout)
) if project_out else nn.Identity()
def forward(self, x):
w = rearrange(self.qkv(x), 'b n (h d) -> b h n d', h = self.heads)
dots = torch.matmul(w, w.transpose(-1, -2)) * self.scale
attn = self.attend(dots)
attn = self.dropout(attn)
out = torch.matmul(attn, w)
out = rearrange(out, 'b h n d -> b n (h d)')
return self.to_out(out)
在forward得到结果后,最后输出是使用了to_out()操作,但是我在对应的MSSA部分没有找到相应的理论依据,请问可以麻烦解释一下吗
同时,在MSSA模块之前的LayerNorm和ISTA之前的LayerNorm是在代码中的哪部分实现的呢,我没有找到相应的代码
when i run finetune.py ,i met a problem:
command is
python finetune.py --bs 256 --net CRATE_small
--opt adamW --lr 5e-5 --n_epochs 200 --randomaug 1 --data cifar10 --ckpt_dir checkpoint.pth.tar --data_dir cifar-10
Error is
File "D:\dachuang\CRATE\CRATE-main\finetune.py", line 99, in
net.load_state_dict(torch.load(args.ckpt_dir)['model'])
KeyError: 'model'
i wanna to know how to solve this question.
Thanks !
I really appreciate your work bro, will you release more pretrained weights in the future?
Hi, thank you for the work! Is there any example for language application?
Good job @ CPAL!
Thank you for your work. I have a question that may seem naive, namely where is your code mainly different from a classic Transformer.
@DruvPai Thank you for sharing codes!
I would really appreciate it if you could share the code to compute
Specifically, I want to reproduce the results in Fig. 3, Fig. 4. a, along with
Thank you for your help.
where can i get the pretrained CRATE weight?
What version of Python and torch are used?
Hey,
Is there a specific reason why CRATE uses a simple linear layer for creating the patch embeddings, instead of the conv2d which the ViT uses? I don't see this mentioned in the paper.
I'm really appreciate your work.I would like to draw a graph similar to Figure 13 and 14. Can you provide me with the code?
请问可以发布一下在ImageNet-1k上预训练后的模型吗
Does that mean what I need to do is training a specific unsupervised task like MAE? Does that equal contrastive learning?
Thanks for the great work!
I noticed there is model size difference ~300MB (crate-demo.pth) vs. ~100MB (re-trained model_best.pth.tar).
Because I retrained the model using the repo code here but the results are different compared with crate-demo.pth, much worse. Just wondering what I am missing here.
Thanks.
As I read the paper, the interpretation of MSSA and ISTA component for compression and sparsification of token representation are quite clear to me. However, I'm not so sure about the role and interpretation of the
Thanks for your inspiring work! I am especially interested in the structured denoising and structured diffusion section. However, I couldn not find the experiment results related to this part in the paper. Would you release in the future?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.