Pushing dataset images to Hub

Hello all,
As I am new using HugginFace, I hope anyone can help me out on how to push the dataset to hub. here is code >>

from datasets import load_dataset

# first: load dataset
# option 1: from local folder
#dataset = load_dataset("imagefolder", data_dir="./datasets")#, use_auth_token=True)
# option 2: from remote URL (e.g. a zip file)
dataset = load_dataset("imagefolder", data_files="https://data.deepai.org/mnist.zip")

# next: push to the hub (assuming git-LFS is installed)
dataset.push_to_hub("huggan/Portion-IAM-form-A-D")

FYI, I tried both ways, I have some images in folder datasets Also, I tried from my Drive with write mode, Unfortunately, I ended up with the same following error:…

  • HTTPError: 403 Client Error: Forbidden for url: https://huggingface.co/api/repos/create (Request ID: SuDy7vKu-xM8klH9RoWEj) - You don’t have the rights to create a dataset under this namespace

Hi! From what I see, you are not a member of the huggan organization on the Hub, so you are not allowed to push the dataset there. Instead, you can push it to your own namespace (which is your username), but make sure to log in with huggingface-cli login before that to avoid the 403 Forbidden error.

Hi, I got the same error for uploading the dataset to my personal namespace.
I am pushing to hub from google colab notebook.

!huggingface-cli login
Token: 
Login successful
Your token has been saved to /root/.huggingface/token

dataset.push_to_hub("vidhikatkoria/FewShotSGD")

WARNING:datasets.dataset_dict:Pushing split train to the Hub.

---------------------------------------------------------------------------

HTTPError                                 Traceback (most recent call last)

/usr/local/lib/python3.7/dist-packages/huggingface_hub/utils/_errors.py in hf_raise_for_status(response, endpoint_name)
    212     try:
--> 213         response.raise_for_status()
    214     except HTTPError as e:

9 frames

HTTPError: 403 Client Error: Forbidden for url: https://huggingface.co/api/repos/create


The above exception was the direct cause of the following exception:

HfHubHTTPError                            Traceback (most recent call last)

/usr/local/lib/python3.7/dist-packages/huggingface_hub/utils/_errors.py in hf_raise_for_status(response, endpoint_name)
    252         # Convert `HTTPError` into a `HfHubHTTPError` to display request information
    253         # as well (request id and/or server error message)
--> 254         raise HfHubHTTPError(str(HTTPError), response=response) from e
    255 
    256 

HfHubHTTPError: <class 'requests.exceptions.HTTPError'> (Request ID: VQk_ZYyQMAixbL97CSPSY)

You don't have the rights to create a dataset under this namespace - You don't have the rights to create a dataset under this namespace

I don’t understand what I could be doing wrong

Seems like you’ve successfully pushed it: https://huggingface.co/datasets/vidhikatkoria/FewShotSGD

So everything’s working fine now?

Yes, I was using a read only token while running the push to hub command. Thanks for your reply though. Appreciate it.