[BUG] This error occurs when push_to_hub is true
Prerequisites
- [X] I have read the documentation.
- [X] I have checked other issues for similar problems.
Backend
Local
Interface Used
CLI
CLI Command
!autotrain --config config.yml
UI Screenshots & Parameters
task: text-classification base_model: google/muril-large-cased project_name: hindi-hate-muril-large-cased log: tensorboard backend: local data: path: data/ # this must be the path to the directory containing the train and valid files train_split: train # this must be either train.csv or train.json valid_split: null # this must be either valid.csv or valid.json column_mapping: text_column: text # this must be the name of the column containing the text target_column: target # this must be the name of the column containing the target hub: username: ${HF_USERNAME} token: ${HF_TOKEN} push_to_hub: True
params: batch_size: 8 epochs: 2 gradient_accumulation: 2 lr: '1.0081057587621143e-05' max_seq_length: 128 mixed_precision: none optimizer: adamw_torch scheduler: linear
Error Logs
ERROR | 2024-07-17 17:41:04 | autotrain.trainers.common:wrapper:120 - train has failed due to an exception: Traceback (most recent call last): File "/home/zeus/miniconda3/envs/cloudspace/lib/python3.10/site-packages/huggingface_hub/utils/_errors.py", line 304, in hf_raise_for_status response.raise_for_status() File "/home/zeus/miniconda3/envs/cloudspace/lib/python3.10/site-packages/requests/models.py", line 1021, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: https://huggingface.co/api/repos/create
The above exception was the direct cause of the following exception:
Traceback (most recent call last): File "/home/zeus/miniconda3/envs/cloudspace/lib/python3.10/site-packages/autotrain/trainers/common.py", line 117, in wrapper return func(*args, **kwargs) File "/home/zeus/miniconda3/envs/cloudspace/lib/python3.10/site-packages/autotrain/trainers/text_classification/main.py", line 182, in train callbacks_to_use.extend([UploadLogs(config=config), LossLoggingCallback(), TrainStartCallback()]) File "/home/zeus/miniconda3/envs/cloudspace/lib/python3.10/site-packages/autotrain/trainers/common.py", line 192, in init self.api.create_repo( File "/home/zeus/miniconda3/envs/cloudspace/lib/python3.10/site-packages/huggingface_hub/utils/_validators.py", line 114, in _inner_fn return fn(*args, **kwargs) File "/home/zeus/miniconda3/envs/cloudspace/lib/python3.10/site-packages/huggingface_hub/hf_api.py", line 3256, in create_repo hf_raise_for_status(r) File "/home/zeus/miniconda3/envs/cloudspace/lib/python3.10/site-packages/huggingface_hub/utils/_errors.py", line 371, in hf_raise_for_status raise HfHubHTTPError(str(e), response=response) from e huggingface_hub.utils._errors.HfHubHTTPError: 401 Client Error: Unauthorized for url: https://huggingface.co/api/repos/create (Request ID: Root=1-66980230-03fcb5ba0e5db25244386b79;403134ea-5560-4513-81bb-1913ac476f99)
Invalid username or password.
ERROR | 2024-07-17 17:41:04 | autotrain.trainers.common:wrapper:121 - 401 Client Error: Unauthorized for url: https://huggingface.co/api/repos/create (Request ID: Root=1-66980230-03fcb5ba0e5db25244386b79;403134ea-5560-4513-81bb-1913ac476f99)
Invalid username or password. INFO | 2024-07-17 17:41:06 | autotrain.parser:run:199 - Job ID: 6522
Additional Information
I have this on two platforms but error still persist
did you export HF_TOKEN and HF_USERNAME ?
did you export HF_TOKEN and HF_USERNAME ?
Yeah I did that
The platform I am getting this error is on colab (I copied the notebook in the readme) and lighting.ai (on this platform I ran using autotrain
in that case the token you are using doesnt have write access to create repos under the username you chose.
in that case the token you are using doesnt have write access to create repos under the username you chose.
I created token from write permission
The error says token doesnt have access. So, id request you to kindly check the token and username. it could be possible that either has a typo or created with wrong permissions. 🙂
I created token with write permission, Like this
This issue is stale because it has been open for 30 days with no activity.
This issue was closed because it has been inactive for 20 days since being marked as stale.