Use Registry and MetaModel to support dynamic loading. Models inherent from BaseModel will automatically registered. Users can also add a @model_registry.register decorator to model to support AutoModel.from_pretrained.
Add build_only argument to from_pretrained. This helps in some cases where users only want to build model using model_config.json without loading checkpoint weights.
Fix some typo in README.md.
For use cases about 1, I think it may helpful for three cases:
Users may want to load models with different model classes sometimes. So users don't need to add redundant if statements, just use AutoModel.
There may be some third-party package based on sat under some other license in the future. They can also contribute to us without adding their models in model/official.
When I want to debug a model locally, I don't need to install sat with -e option to put my model code to official.
I made three modifications in this commit:
Registry
andMetaModel
to support dynamic loading. Models inherent fromBaseModel
will automatically registered. Users can also add a@model_registry.register
decorator to model to supportAutoModel.from_pretrained
.build_only
argument to from_pretrained. This helps in some cases where users only want to build model usingmodel_config.json
without loading checkpoint weights.For use cases about 1, I think it may helpful for three cases:
if
statements, just use AutoModel.-e
option to put my model code toofficial
.