Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

forward_features(self, x, keep_rate=None, tokens=None, get_idx=False) #12

Open
60wanjinbing opened this issue Oct 14, 2022 · 1 comment

Comments

@60wanjinbing
Copy link

with torch.cuda.amp.autocast():
outputs = model(samples, keep_rate)
loss = criterion(samples, outputs, targets)
这段代码是在train_one_epoch函数中调用的,你的model没有传token参数,按照你这个应该会报错的,请问你这个token是在哪里传过去的?

@youweiliang
Copy link
Owner

你说的tokens参数是用于外面的caller控制剩余token数目的。一般情况下,我们用的是keep_rate这个参数来控制token数目,是在下面这几行计算出来的。

evit/evit.py

Lines 209 to 211 in cc1993d

left_tokens = math.ceil(keep_rate * (N - 1))
if tokens is not None:
left_tokens = tokens

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants