lewtun HF staff commited on
Commit
9eb87c8
1 Parent(s): 0db6673

Update `huggingface_hub` version to avoid 404 Client Error (#3)

Browse files

- Update huggingface_hub from 0.0.16 to 0.13.4 (b0fce8fd0bde9adb57db49e321c2a37bc993f761)
- Update huggingface_hub version in README (6128735431c59799fe508969ddc5b741b90d4f17)
- Update README to reflect new cookiecutter params (eaebf27a39899d78bd79f7a5d7579b762b328b1e)

Files changed (4) hide show
  1. README.md +6 -5
  2. cookiecutter.json +1 -1
  3. hooks/pre_gen_project.py +7 -10
  4. requirements.txt +1 -1
README.md CHANGED
@@ -29,17 +29,18 @@ Next, run the following commands to create the repository. We recommend creating
29
  # Create and activate a virtual environment
30
  conda create -n raft python=3.8 && conda activate raft
31
  # Install the following libraries
32
- pip install cookiecutter huggingface-hub==0.0.16
33
  # Create the template repository
34
  cookiecutter git+https://huggingface.co/datasets/ought/raft-submission
35
  ```
36
 
37
- This will ask you to specify your Hugging Face Hub username, password, and the name of the repository:
 
38
 
39
  ```
40
- hf_hub_username [<huggingface>]:
41
- hf_hub_password [<password>]:
42
- repo_name [<my-raft-submissions>]:
43
  ```
44
 
45
  This will trigger the following steps:
 
29
  # Create and activate a virtual environment
30
  conda create -n raft python=3.8 && conda activate raft
31
  # Install the following libraries
32
+ pip install cookiecutter huggingface-hub==0.13.4
33
  # Create the template repository
34
  cookiecutter git+https://huggingface.co/datasets/ought/raft-submission
35
  ```
36
 
37
+ This will ask you to specify your Hugging Face Hub username, a Hugging Face [access token](https://huggingface.co/settings/tokens)
38
+ with write permissions, and the name of the repository:
39
 
40
  ```
41
+ hf_hub_username [huggingface]:
42
+ hf_access_token [hf_access_token]:
43
+ repo_name [my-raft-submissions]:
44
  ```
45
 
46
  This will trigger the following steps:
cookiecutter.json CHANGED
@@ -1,5 +1,5 @@
1
  {
2
  "hf_hub_username": "huggingface",
3
- "hf_hub_password": "password",
4
  "repo_name": "my-raft-submission"
5
  }
 
1
  {
2
  "hf_hub_username": "huggingface",
3
+ "hf_access_token": "hf_access_token",
4
  "repo_name": "my-raft-submission"
5
  }
hooks/pre_gen_project.py CHANGED
@@ -1,19 +1,16 @@
1
- from huggingface_hub import HfApi, HfFolder, Repository
2
-
3
- hf_user = "{{cookiecutter.hf_hub_username}}"
4
- hf_password = "{{cookiecutter.hf_hub_password}}"
5
- huggingface_token = HfApi().login(username=hf_user, password=hf_password)
6
- HfFolder.save_token(huggingface_token)
7
 
 
8
  repo_url = HfApi().create_repo(
9
- token=huggingface_token,
10
- name="{{cookiecutter.repo_name}}",
11
- organization=hf_user,
12
  exist_ok=True,
13
  private=True,
14
  repo_type="dataset",
15
  )
16
 
17
  model_repo = Repository(
18
- local_dir=".", clone_from=repo_url, use_auth_token=huggingface_token
 
 
19
  )
 
1
+ from huggingface_hub import HfApi, Repository
 
 
 
 
 
2
 
3
+ hf_access_token = "{{cookiecutter.hf_access_token}}"
4
  repo_url = HfApi().create_repo(
5
+ repo_id="{{cookiecutter.hf_hub_username}}/{{cookiecutter.repo_name}}",
6
+ token=hf_access_token,
 
7
  exist_ok=True,
8
  private=True,
9
  repo_type="dataset",
10
  )
11
 
12
  model_repo = Repository(
13
+ local_dir=".",
14
+ clone_from=repo_url,
15
+ token=hf_access_token,
16
  )
requirements.txt CHANGED
@@ -1,4 +1,4 @@
1
  datasets>=1.11.0
2
  typer
3
  cookiecutter
4
- huggingface-hub==0.0.16
 
1
  datasets>=1.11.0
2
  typer
3
  cookiecutter
4
+ huggingface-hub==0.13.4