Module: model_loader
Model Loader: depending on the model source, load the model from the local file system, Hugging Face Hub, or Arweave.
ArweaveLoadArgs
CommonLoadArgs
Bases: BaseModel
Common arguments for loading a model
Source code in src/infernet_ml/utils/model_loader.py
HFLoadArgs
LocalLoadArgs
ModelSource
Bases: IntEnum
Enum for the model source
LOCAL
: Load the model from the local file systemARWEAVE
: Load the model from ArweaveHUGGINGFACE_HUB
: Load the model from Hugging Face Hub
Source code in src/infernet_ml/utils/model_loader.py
download_model(model_source, load_args)
Load the model from the specified source.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model_source |
ModelSource
|
the source of the model |
required |
load_args |
LoadArgs
|
the load arguments, options are: - LocalLoadArgs - HFLoadArgs - ArweaveLoadArgs |
required |
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
the path to the model |
Source code in src/infernet_ml/utils/model_loader.py
parse_load_args(model_source, config)
Parse the load arguments based on the model source.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model_source |
ModelSource
|
the source of the model |
required |
config |
dict[str, str]
|
the configuration |
required |
Returns:
Name | Type | Description |
---|---|---|
LoadArgs |
LoadArgs
|
the load arguments |
Raises:
Type | Description |
---|---|
ValueError
|
if the model source is invalid |