Skip to content

Commit

Permalink
wrap forward passes with torch.no_grad() (huggingface#19414)
Browse files Browse the repository at this point in the history
  • Loading branch information
daspartho authored and amyeroberts committed Oct 18, 2022
1 parent b6c12ab commit d3c0436
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tests/models/imagegpt/test_modeling_imagegpt.py
Expand Up @@ -538,7 +538,8 @@ def test_inference_causal_lm_head(self):
inputs = feature_extractor(images=image, return_tensors="pt").to(torch_device)

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

# verify the logits
expected_shape = torch.Size((1, 1024, 512))
Expand Down

0 comments on commit d3c0436

Please sign in to comment.