HF

Utilities to manage HF Hub model hosting

source

create_repository

 create_repository (repo_name:str, private:bool=False)

Create a repository on the Hugging Face Hub.


source

upload_model_file

 upload_model_file (repo_name:str, file_path:str, path_in_repo:str=None)

Upload a model file to the Hugging Face Hub.


source

upload_readme

 upload_readme (repo_name:str, readme_path:str)

Upload a README.md file to the Hugging Face Hub.


source

download_model_file

 download_model_file (repo_name:str, file_name:str, save_path:str)

Download a file from the Hugging Face Hub.


source

load_model

 load_model (file_path:str, model_class)

Load a PyTorch model from a file.


source

list_files_in_repo

 list_files_in_repo (repo_name:str)

List all files in a Hugging Face repository.


source

delete_file_in_repo

 delete_file_in_repo (repo_name:str, file_path:str)

Delete a file from a Hugging Face repository.


source

clone_repository

 clone_repository (repo_name:str, local_path:str)

Clone a Hugging Face repository locally.


source

save_and_upload_model

 save_and_upload_model (repo_name:str, model, file_path:str,
                        path_in_repo:str=None, readme_path:str=None)

Save a PyTorch model and upload it to Hugging Face.


source

generate_readme

 generate_readme (metadata:dict)

Generate a README.md file content with YAML front matter based on the provided metadata.