Update `huggingface_hub` version to avoid 404 Client Error
#3
by
tomaarsen
HF staff
- opened
- README.md +6 -5
- cookiecutter.json +1 -1
- hooks/pre_gen_project.py +7 -10
- 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.
|
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,
|
|
|
38 |
|
39 |
```
|
40 |
-
hf_hub_username [
|
41 |
-
|
42 |
-
repo_name [
|
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 |
-
"
|
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,
|
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 |
-
|
10 |
-
|
11 |
-
organization=hf_user,
|
12 |
exist_ok=True,
|
13 |
private=True,
|
14 |
repo_type="dataset",
|
15 |
)
|
16 |
|
17 |
model_repo = Repository(
|
18 |
-
local_dir=".",
|
|
|
|
|
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.
|
|
|
1 |
datasets>=1.11.0
|
2 |
typer
|
3 |
cookiecutter
|
4 |
+
huggingface-hub==0.13.4
|