`ModelLoader` doesn't allow loading a local checkpoint
zrthxn opened this issue · comments
Currently, as I understand it, it is not possible to provide a path to a file to load with ModelLoader
. The supplied model_name_or_card
cannot be a path to a checkpoint file.
The user should be able to provide a path to a local file to load into a model, like you can with the Huggingface CLI and functions. This file must contain the model_name
and model
keys.
Additional Context:
This would be very useful for fine-tuning and evaluating SeamlessM4T models.
Hi @zrthxn,
you can specify a local path in two ways:
from fairseq2.assets import default_asset_store
from fairseq2.models import load_model
model_card = default_asset_store.retrieve_card("foo")
model_card.field("checkpoint").set_("<path/to/file>")
load_model(model_card, ...)
or if you want to have a more permanent solution, you can create a YAML asset card (see src/fairseq2/assets/cards
as example) in your ~/.config/fairseq2/assets
where you can override an existing card by giving it the same name with a @user
postfix.