Shortcuts

is_model_wrapper

class mmengine.model.is_model_wrapper(model, registry=Registry(name=model_wrapper, items={'DistributedDataParallel': <class 'torch.nn.parallel.distributed.DistributedDataParallel'>, 'DataParallel': <class 'torch.nn.parallel.data_parallel.DataParallel'>, 'MMDistributedDataParallel': <class 'mmengine.model.wrappers.distributed.MMDistributedDataParallel'>, 'MMSeparateDistributedDataParallel': <class 'mmengine.model.wrappers.seperate_distributed.MMSeparateDistributedDataParallel'>, 'MMFullyShardedDataParallel': <class 'mmengine.model.wrappers.fully_sharded_distributed.MMFullyShardedDataParallel'>}))[source]

Check if a module is a model wrapper.

The following 4 model in MMEngine (and their subclasses) are regarded as model wrappers: DataParallel, DistributedDataParallel, MMDataParallel, MMDistributedDataParallel. You may add you own model wrapper by registering it to mmengine.registry.MODEL_WRAPPERS.

Parameters
  • model (nn.Module) – The model to be checked.

  • registry (Registry) – The parent registry to search for model wrappers.

Returns

True if the input model is a model wrapper.

Return type

bool

Read the Docs v: v0.4.0
Versions
latest
stable
v0.5.0
v0.4.0
v0.3.0
v0.2.0
Downloads
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.