Skip to content

Commit

Permalink
Delete the model after checking accuracy in-process
Browse files Browse the repository at this point in the history
Summary:
When the model is not deleted, there will be problem when running the model and model+cudagraph in the same process.

Note that blue_reels_vdd_v3 does not support CUDA Graph. This is to demonstrate that we can run a model within a process (without accuracy checking)

Reviewed By: davidberard98

Differential Revision: D49688178

fbshipit-source-id: 8594f7a88bba221d1339646f2a6aea7138621bc3
  • Loading branch information
xuzhao9 authored and facebook-github-bot committed Sep 27, 2023
1 parent 160bcfe commit aaa8baf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion torchbenchmark/util/env_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ def forward_pass(mod, inputs, contexts, _collect_outputs=True):
return mod(**inputs)
else:
return mod(*inputs)


def forward_and_backward_pass(mod, inputs, contexts, optimizer, collect_outputs=True):
cloned_inputs = clone_inputs(inputs)
Expand Down
4 changes: 3 additions & 1 deletion torchbenchmark/util/experiment/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,4 +149,6 @@ def get_model_accuracy(model_config: TorchBenchModelConfig, isolated: bool=True)
return accuracy
else:
model = load_model(accuracy_model_config)
return model.accuracy
accuracy = model.accuracy
del model
return accuracy

0 comments on commit aaa8baf

Please sign in to comment.