basecls.models.build#

basecls.models.build.build_model(cfg)[源代码]#

The factory function to build model.

备注

if cfg.model does not have the attr head, this function will build model with the default head. Otherwise if cfg.model.head is None, this function will build model without any head.

备注

if cfg.model.head does not have the attr w_out and cfg.num_classes exists, w_out will be overridden by cfg.num_classes.

参数

cfg (ConfigDict) – config for building model.

返回类型

Module

返回

A model.

basecls.models.build.load_model(model, weight_path, strict=True)[源代码]#

Load model weights.

参数
  • model (Module) – model for loading weights.

  • weight_path (str) – weight path, both local path and OSS path are supported.

  • strict (bool) – load weights in strict mode or not. Default: True

basecls.models.build.sync_model(model)[源代码]#

Sync parameters and buffers.

参数

model (Module) – model for syncing.