Compare commits

...

1 Commits
1.6.1 ... 0.6.1

Author SHA1 Message Date
Phil Wang
1a934da36a no grad for teacher in distillation 2020-12-24 11:06:49 -08:00
2 changed files with 4 additions and 2 deletions

View File

@@ -3,7 +3,7 @@ from setuptools import setup, find_packages
setup(
name = 'vit-pytorch',
packages = find_packages(exclude=['examples']),
version = '0.6.0',
version = '0.6.1',
license='MIT',
description = 'Vision Transformer (ViT) - Pytorch',
author = 'Phil Wang',

View File

@@ -72,7 +72,9 @@ class DistillWrapper(nn.Module):
b, *_, alpha = *img.shape, self.alpha
T = temperature if exists(temperature) else self.temperature
teacher_logits = self.teacher(img)
with torch.no_grad():
teacher_logits = self.teacher(img)
student_logits, distill_tokens = self.student(img, distill_token = self.distillation_token, **kwargs)
distill_logits = self.distill_mlp(distill_tokens)