File size: 570 Bytes
958473e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
82c33f8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
from huggingface_hub import HfApi, HfFolder, Repository

hf_user = "{{cookiecutter.hf_hub_username}}"
hf_password = "{{cookiecutter.hf_hub_password}}"
hf_org = "{{cookiecutter.hf_hub_organisation}}"
huggingface_token = HfApi().login(username=hf_user, password=hf_password)
HfFolder.save_token(huggingface_token)

repo_url = HfApi().create_repo(
    token=huggingface_token,
    name="{{cookiecutter.repo_name}}",
    organization=hf_org,
    exist_ok=True,
    private=True
)

model_repo = Repository(local_dir=".", clone_from=repo_url, use_auth_token=huggingface_token)