Skip to content
  • This project
    • Loading...
  • Sign in

周伟奇 / test_on_pytorch

Go to a project
Toggle navigation
Toggle navigation pinning
  • Projects
  • Groups
  • Snippets
  • Help
  • Project
  • Activity
  • Repository
  • Pipelines
  • Graphs
  • Issues 0
  • Merge Requests 0
  • Wiki
  • Network
  • Create a new issue
  • Builds
  • Commits
  • Issue Boards
  • Files
  • Commits
  • Network
  • Compare
  • Branches
  • Tags
Switch branch/tag
  • test_on_pytorch
  • model
  • builder.py
  • 周伟奇's avatar
    fix bug · 0a93c10d
    周伟奇 committed 2022-12-12 19:00:34 +0800
    0a93c10d Browse Files
builder.py 366 Bytes
Raw Blame History Permalink
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
import copy
from utils import MODEL_REGISTRY

from .mlp import MLPModel
from .vit import VisionTransformer


def build_model(cfg):
    model_cfg = copy.deepcopy(cfg)
    try:
        model_cfg = model_cfg['model']
    except Exception:
        raise 'should contain {model}'

    model = MODEL_REGISTRY.get(model_cfg['name'])(**model_cfg['args'])

    return model