MCPcopy
hub / github.com/mlfoundations/open_flamingo / unwrap_model

Function unwrap_model

open_flamingo/eval/utils.py:78–85  ·  view source on GitHub ↗

Unwrap a model from a DataParallel or DistributedDataParallel wrapper.

(model)

Source from the content-addressed store, hash-verified

76
77
78def unwrap_model(model):
79 """
80 Unwrap a model from a DataParallel or DistributedDataParallel wrapper.
81 """
82 if isinstance(model, (nn.DataParallel, nn.parallel.DistributedDataParallel)):
83 return model.module
84 else:
85 return model
86
87
88def get_predicted_classnames(logprobs, k, class_id_to_name):

Callers 5

get_outputsMethod · 0.90
encode_vision_xMethod · 0.90
uncache_mediaMethod · 0.90
cache_mediaMethod · 0.90
get_outputsMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected