AutoModel¶
Utils class allowing to reload any pythae.models automatically with the following
lines of code.
>>> from pythae.models import AutoModel
>>> model = AutoModel.load_from_folder(dir_path='path/to/my_model')
- class pythae.models.AutoModel[source]¶
Utils class allowing to reload any
pythae.modelsautomatically- classmethod load_from_folder(dir_path)[source]¶
Class method to be used to load the model from a specific folder
- Parameters
dir_path (str) – The path where the model should have been be saved.
Note
This function requires the folder to contain:
- a
model_config.jsonand amodel.ptif no custom architectures were provided
or
- a
model_config.json, amodel.ptand aencoder.pkl(resp.decoder.pkl) if a custom encoder (resp. decoder) was provided
- classmethod load_from_hf_hub(hf_hub_path, allow_pickle=False)[source]¶
Class method to be used to load a automaticaly a pretrained model from the Hugging Face hub
- Parameters
hf_hub_path (str) – The path where the model should have been be saved on the hugginface hub.
Note
This function requires the folder to contain:
- a
model_config.jsonand amodel.ptif no custom architectures were provided
or
- a
model_config.json, amodel.ptand aencoder.pkl(resp.decoder.pkl) if a custom encoder (resp. decoder) was provided