MCPcopy
hub / github.com/huggingface/pytorch-image-models / adapt_model_from_file

Function adapt_model_from_file

timm/models/_prune.py:165–176  ·  view source on GitHub ↗

Adapt a model to pruned structure from file specification. Args: parent_module: Original model to adapt. model_variant: Name of pruned model variant file. Returns: Adapted model with pruned layer dimensions.

(parent_module, model_variant)

Source from the content-addressed store, hash-verified

163
164
165def adapt_model_from_file(parent_module, model_variant):
166 """Adapt a model to pruned structure from file specification.
167
168 Args:
169 parent_module: Original model to adapt.
170 model_variant: Name of pruned model variant file.
171
172 Returns:
173 Adapted model with pruned layer dimensions.
174 """
175 adapt_data = pkgutil.get_data(__name__, os.path.join('_pruned', model_variant + '.txt'))
176 return adapt_model_from_string(parent_module, adapt_data.decode('utf-8').strip())

Callers 1

build_model_with_cfgFunction · 0.90

Calls 1

adapt_model_from_stringFunction · 0.85

Tested by

no test coverage detected