MCPcopy Create free account
hub / github.com/OpenGVLab/HumanBench / inference_context

Function inference_context

PATH/core/solvers/solver_multitask_dev.py:1441–1452  ·  view source on GitHub ↗

A context where the model is temporarily changed to eval mode, and restored to previous mode afterwards. Args: model: a torch Module

(model)

Source from the content-addressed store, hash-verified

1439
1440@contextmanager
1441def inference_context(model):
1442 """
1443 A context where the model is temporarily changed to eval mode,
1444 and restored to previous mode afterwards.
1445
1446 Args:
1447 model: a torch Module
1448 """
1449 training_mode = model.training
1450 model.eval()
1451 yield
1452 model.train(training_mode)
1453
1454
1455def print_csv_format(results, logger):

Callers 2

inference_on_datasetMethod · 0.85
inference_on_datasetMethod · 0.85

Calls 1

trainMethod · 0.80

Tested by

no test coverage detected