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

Add 'with torch.no_grad()' to BEiT integration test forward passes #14961

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Fix inconsistent use of tabs and spaces in indentation
  • Loading branch information
itsTurner committed Dec 28, 2021
commit 06be92dafd9f98bb36b1f396c7d883bf80529375
10 changes: 5 additions & 5 deletions tests/test_modeling_beit.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,8 +435,8 @@ def test_inference_masked_image_modeling_head(self):
bool_masked_pos = torch.ones((1, 196), dtype=torch.bool).to(torch_device)

# forward pass
with torch.no_grad():
outputs = model(pixel_values=pixel_values, bool_masked_pos=bool_masked_pos)
with torch.no_grad():
outputs = model(pixel_values=pixel_values, bool_masked_pos=bool_masked_pos)
logits = outputs.logits

# verify the logits
Expand All @@ -459,7 +459,7 @@ def test_inference_image_classification_head_imagenet_1k(self):

# forward pass
with torch.no_grad():
outputs = model(**inputs)
outputs = model(**inputs)
logits = outputs.logits

# verify the logits
Expand All @@ -485,7 +485,7 @@ def test_inference_image_classification_head_imagenet_22k(self):

# forward pass
with torch.no_grad():
outputs = model(**inputs)
outputs = model(**inputs)
logits = outputs.logits

# verify the logits
Expand All @@ -512,7 +512,7 @@ def test_inference_semantic_segmentation(self):

# forward pass
with torch.no_grad():
outputs = model(**inputs)
outputs = model(**inputs)
logits = outputs.logits

# verify the logits
Expand Down