huggingface / huggingface/course

Deprecated `upload_file` command in the NLP course

Open
#755 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
MDX
Stars
4.2k
Forks
1.4k
Avg merge
13m
Merged PRs (30d)
1

Description

[This link](https://huggingface.co/learn/nlp-course/chapter4/3?fw=pt#the-uploadfile-approach) details a method to submit files to one's HF repo using the `huggingface_hub.upload_file` function.

```
from huggingface_hub import upload_file

upload_file(
"/config.json",
path_in_repo="config.json",
repo_id="/dummy-model",
)
```

This is however not working as of version 0.26.2. Please replace the code with the newer syntax [explained here:](https://huggingface.co/docs/huggingface_hub/guides/upload)

```
from huggingface_hub import HfApi
api = HfApi()
api.upload_file(
path_or_fileobj="/config.json",,
path_in_repo="config.json",
repo_id="/dummy-model",
)
```

Thank you!

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.