def create_model(config: Dict = None, weights_path: str = None, device: str = None) -> CENet:
    """
    Create CENet model.
    Args:
        config (`Dict`):
            Config dict.
        weights_path (`str`):
            Pretrained checkpoint path, if None, build a model without pretrained weights.
        device (`str`):
            Model device, `cuda` or `cpu`.

    Returns:
        (`CENet`):
            CENet model.
    >>> from towhee.models import collaborative_experts
    >>> ce_model = collaborative_experts.create_model()
    >>> ce_model.__class__.__name__
    'CENet'

    """

    if config is None:
        config = {
            "task": "retrieval",
            "use_ce": "pairwise",
            "text_dim": 768,
            "l2renorm": False,
            "expert_dims": OrderedDict([("audio", (1024, 768)), ("face", (512, 768)), ("i3d.i3d.0", (1024, 768)),
                                        ("imagenet.resnext101_32x48d.0", (2048, 768)),
                                        ("imagenet.senet154.0", (2048, 768)),
                                        ("ocr", (12900, 768)), ("r2p1d.r2p1d-ig65m.0", (512, 768)),
                                        ("scene.densenet161.0", (2208, 768)), ("speech", (5700, 768))]),
            "vlad_clusters": {"ocr": 43, "text": 28, "audio": 8, "speech": 19, "detection-sem": 50},
            "ghost_clusters": {"text": 1, "ocr": 1, "audio": 1, "speech": 1},
            "disable_nan_checks": False,
            "keep_missing_modalities": False,
            "test_caption_mode": "indep",
            "randomise_feats": "",
            "feat_aggregation": {
                "imagenet.senet154.0": {"fps": 25, "stride": 1, "pixel_dim": 256, "aggregate-axis": 1, "offset": 0,
                                        "temporal": "avg", "aggregate": "concat", "type": "embed",
                                        "feat_dims": {"embed": 2048, "logits": 1000}},
                "trn.moments-trn.0": {"fps": 25, "offset": 0, "stride": 8, "pixel_dim": 256, "inner_stride": 5,
                                      "temporal": "avg", "aggregate": "concat", "aggregate-axis": 1, "type": "embed",
                                      "feat_dims": {"embed": 1792, "logits": 339}},
                "scene.densenet161.0": {"stride": 1, "fps": 25, "offset": 0, "temporal": "avg", "pixel_dim": 256,
                                        "aggregate": "concat", "aggregate-axis": 1, "type": "embed",
                                        "feat_dims": {"embed": 2208, "logits": 1000}},
                "i3d.i3d.0": {"fps": 25, "offset": 0, "stride": 25, "inner_stride": 1, "pixel_dim": 256,
                              "temporal": "avg",
                              "aggregate": "concat", "aggregate-axis": 1, "type": "embed",
                              "feat_dims": {"embed": 1024, "logits": 400}},
                "i3d.i3d.1": {"fps": 25, "offset": 0, "stride": 4, "inner_stride": 1, "pixel_dim": 256,
                              "temporal": "avg",
                              "aggregate": "concat", "aggregate-axis": 1, "type": "embed",
                              "feat_dims": {"embed": 1024, "logits": 400}},
                "moments_3d.moments-resnet3d50.0": {"fps": 25, "offset": 1, "stride": 8, "pixel_dim": 256,
                                                    "inner_stride": 5, "temporal": "avg", "aggregate": "concat",
                                                    "aggregate-axis": 1, "type": "embed",
                                                    "feat_dims": {"embed": 2048, "logits": 3339}},
                "s3dg.s3dg.1": {"fps": 10, "offset": 0, "stride": 8, "num_segments": None, "pixel_dim": 224,
                                "inner_stride": 1, "temporal": "avg", "aggregate": "concat", "aggregate-axis": 1,
                                "type": "embed", "feat_dims": {"embed": 1024, "logits": 512}},
                "s3dg.s3dg.0": {"fps": 10, "offset": 0, "stride": 16, "num_segments": None, "pixel_dim": 256,
                                "inner_stride": 1, "temporal": "avg", "aggregate": "concat", "aggregate-axis": 1,
                                "type": "embed", "feat_dims": {"embed": 1024, "logits": 512}},
                "r2p1d.r2p1d-ig65m.0": {"fps": 30, "offset": 0, "stride": 32, "inner_stride": 1, "pixel_dim": 256,
                                        "temporal": "avg", "aggregate": "concat", "aggregate-axis": 1, "type": "embed",
                                        "feat_dims": {"embed": 512, "logits": 359}},
                "r2p1d.r2p1d-ig65m.1": {"fps": 30, "offset": 0, "stride": 32, "inner_stride": 1, "pixel_dim": 256,
                                        "temporal": "avg", "aggregate": "concat", "aggregate-axis": 1, "type": "embed",
                                        "feat_dims": {"embed": 512, "logits": 359}},
                "r2p1d.r2p1d-ig65m-kinetics.0": {"fps": 30, "offset": 0, "stride": 32, "inner_stride": 1,
                                                 "pixel_dim": 256,
                                                 "temporal": "avg", "aggregate": "concat", "aggregate-axis": 1,
                                                 "type": "embed", "feat_dims": {"embed": 512, "logits": 400}},
                "r2p1d.r2p1d-ig65m-kinetics.1": {"fps": 30, "offset": 0, "stride": 8, "inner_stride": 1,
                                                 "pixel_dim": 256,
                                                 "temporal": "avg", "aggregate": "concat", "aggregate-axis": 1,
                                                 "type": "embed", "feat_dims": {"embed": 512, "logits": 400}},
                "moments_2d.resnet50.0": {"fps": 25, "stride": 1, "offset": 0, "pixel_dim": 256, "temporal": "avg",
                                          "aggregate": "concat", "aggregate-axis": 1, "type": "embed",
                                          "feat_dims": {"embed": 2048, "logits": 1000}},
                "imagenet.resnext101_32x48d.0": {"fps": 25, "stride": 1, "offset": 0, "pixel_dim": 256,
                                                 "temporal": "avg",
                                                 "aggregate": "concat", "aggregate-axis": 1, "type": "embed",
                                                 "feat_dims": {"embed": 2048, "logits": 1000}},
                "imagenet.resnext101_32x48d.1": {"fps": 25, "stride": 1, "offset": 0, "pixel_dim": 256,
                                                 "temporal": "avg",
                                                 "aggregate": "concat", "aggregate-axis": 1, "type": "embed",
                                                 "feat_dims": {"embed": 2048, "logits": 1000}},
                "ocr": {"model": "yang", "temporal": "vlad", "type": "embed", "flaky": True, "binarise": False,
                        "feat_dims": {"embed": 300}},
                "audio.vggish.0": {"model": "vggish", "flaky": True, "temporal": "vlad", "type": "embed",
                                   "binarise": False},
                "audio": {"model": "vggish", "flaky": True, "temporal": "vlad", "type": "embed", "binarise": False},
                "antoine-rgb": {"model": "antoine", "temporal": "avg", "type": "embed", "feat_dims": {"embed": 2048}},
                "flow": {"model": "antoine", "temporal": "avg", "type": "embed", "feat_dims": {"embed": 1024}},
                "speech": {"model": "w2v", "flaky": True, "temporal": "vlad", "type": "embed", "binarise": False,
                           "feat_dims": {"embed": 300}},
                "face": {"model": "antoine", "temporal": "avg", "flaky": True, "binarise": False},
                "detection-sem": {"fps": 1, "stride": 3, "temporal": "vlad", "feat_type": "sem", "model": "detection",
                                  "type": "embed"},
                "moments-static.moments-resnet50.0": {"fps": 25, "stride": 1, "offset": 3, "pixel_dim": 256,
                                                      "temporal": "avg", "aggregate": "concat", "aggregate-axis": 1,
                                                      "type": "embed", "feat_dims": {"embed": 2048, "logits": 1000}}},
            "ce_shared_dim": 768,
            "trn_config": {},
            "trn_cat": 0,
            "include_self": 1,
            "use_mish": 1,
            "use_bn_reason": 1,
            "num_h_layers": 0,
            "num_g_layers": 3,
            "kron_dets": False,
            "freeze_weights": False,
            "geometric_mlp": False,
            "rand_proj": False,
            "mimic_ce_dims": 0,
            "coord_dets": False,
            "concat_experts": False,
            "spatial_feats": False,
            "concat_mix_experts": False,
            "verbose": False,
            "num_classes": None,
        }
    ce_net_model = CENet(**config)
    if weights_path is not None:
        state_dict = torch.load(weights_path, map_location="cpu")
        deprecated = ["ce.moe_fc_bottleneck1", "ce.moe_cg", "ce.moe_fc_proj"]
        for mod in deprecated:
            for suffix in ("weight", "bias"):
                key = f"{mod}.{suffix}"
                if key in state_dict:
                    print(f"WARNING: Removing deprecated key {key} from model")
                    state_dict.pop(key)
        ce_net_model.load_state_dict(state_dict)
    if device is None:
        device = "cuda" if torch.cuda.is_available() else "cpu"
    ce_net_model.to(device)
    return ce_net_model
Create CENet model.
Args:
config (`Dict`):
Config dict.
weights_path (`str`):
Pretrained checkpoint path, if None, build a model without pretrained weights.
device (`str`):
Model device, `cuda` or `cpu`.

Returns:
(`CENet`):
CENet model.
>>> from towhee.models import collaborative_experts
>>> ce_model = collaborative_experts.create_model()
>>> ce_model.__class__.__name__
'CENet'
towhee/models/collaborative_experts/collaborative_experts.py