def METHOD_NAME(cls):
    if name in MODEL_REGISTRY:
        raise ValueError("Cannot register duplicate model ({})".format(name))
    if not issubclass(cls, BaseFairseqModel):
        raise ValueError(
            "Model ({}: {}) must extend BaseFairseqModel".format(name, cls.__name__)
        )
    MODEL_REGISTRY[name] = cls
    if dataclass is not None and not issubclass(dataclass, FairseqDataclass):
        raise ValueError(
            "Dataclass {} must extend FairseqDataclass".format(dataclass)
        )
    cls.__dataclass = dataclass
    if dataclass is not None:
        MODEL_DATACLASS_REGISTRY[name] = dataclass
        cs = ConfigStore.instance()
        node = dataclass()
        node._name = name
        cs.store(name=name, group="model", node=node, provider="fairseq")
        @register_model_architecture(name, name)
        def noop(_):
            pass
    return cls