{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# ๐ Welcome to the Hugging Face Uploader Notebook!\n", "\n", "This notebook provides a user-friendly tool for uploading files directly to your Hugging Face repositories. Here's how to get started:\n", "\n", "**๐ Initial Setup (One Time Only)**\n", "\n", "1. **Authenticate:**\n", " * Run the `notebook_login()` cell *once* to securely store your Hugging Face API token.\n", " * **Important:** For security, avoid sharing your notebook file or system state after you have run `notebook_login()`. Do not commit your notebook file to a shared repo, as this could expose your API token.\n", "\n", "**๐๏ธ Using the Uploader**\n", "\n", "1. **Repository Details:**\n", " * Enter your Hugging Face Organization or Username in the \"Owner\" field.\n", " * Enter your repository name in the \"Repo\" field.\n", "\n", "2. **Directory Selection:**\n", " * Enter a directory path where your files are located.\n", " * Select the 'Update Dir' button to set that path.\n", "\n", "3. **File Selection:**\n", " * Select the appropriate file type from the dropdown menu.\n", " * Select the files you want to upload from the list. You can sort them by name or date modified.\n", "\n", "4. **Commit Message (Optional):**\n", " * Add a commit message to your upload, or use the default message.\n", "\n", "5. **Upload Options:**\n", " * Choose whether to create a pull request or upload directly to the main branch.\n", " * Select whether to clear the output after a successful upload.\n", "\n", "6. **Start Upload:**\n", " * Click the \"โฌ๏ธ Upload\" button.\n", "\n", "**๐ก Important Notes**\n", "\n", "* **Direct Uploads:** This uploader uses the Hugging Face API for direct file uploads, bypassing the need for traditional Git operations for core functionality.\n", "* **Git LFS:** Most users will not need to interact with Git or Git LFS. If you need to clone or push changes to a repository *outside this notebook*, you will require a separate Git credential setup (e.g., your operating system's credential manager or SSH keys). This is separate from your Hugging Face API token, and you should not share any git credentials in your notebook.\n", "* **Troubleshooting:** If you encounter any issues, please review the steps, or double-check that you have write access to the repository, and that your API token has the correct scope of access.\n", "\n", "**๐ฃ Updates & Community**\n", "\n", "* This tool will continue to be updated.\n", "* For the latest patches, fixes, and community contributions, visit [https://github.com/duskfallcrew/HuggingFace_Backup](https://github.com/duskfallcrew/HuggingFace_Backup)\n", "\n", "We hope this notebook makes your Hugging Face uploads easier! If you have any questions or suggestions, please reach out." ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "!pip install -q huggingface_hub ipywidgets tqdm" ] }, { "cell_type": "markdown", "metadata": { "id": "Xs1mb1VKLuUW" }, "source": [ "# โจ Connecting to Hugging Face: Authentication Required\n", "\n", "To upload files to Hugging Face using this notebook, you'll need to authenticate using your Hugging Face API token. This token acts as your secure access key to the Hugging Face Hub.\n", "\n", "**๐ Obtaining Your API Token**\n", "\n", "1. **Go to Your Settings:** Navigate to your [Hugging Face account settings](https://huggingface.co/settings/tokens).\n", "2. **Access Tokens Section:** Find the \"Access Tokens\" section.\n", "3. **Create or Copy Token:**\n", " * If you don't have one already, create a new access token.\n", " * Copy your existing access token.\n", "\n", "**๐ Logging In**\n", "\n", "1. **Run the Cell:** Execute the cell below this section.\n", "2. **Paste Token:** When prompted, paste your Hugging Face API token into the input field.\n", "3. **Confirm:** Press `Enter` to complete the login process. No characters will be displayed as you type your token.\n", " * **Security Note:** This ensures your token is kept private while pasting.\n", "\n", "**Important Notes**\n", "\n", "* **Purpose:** This login step authorizes your notebook environment to interact with the Hugging Face Hub. This is required for uploading your models and data.\n", "* **Session-Based:** You will need to perform this login procedure each time you restart the notebook or start a new session (the token is stored locally on your computer, but not in the notebook, and it doesn't persist between sessions).\n", "* **Security:** After you have logged in using `notebook_login()`, **do not** share your notebook or your system state with untrusted users, and do not commit your notebook to a shared repository, as this could compromise your API token.\n", "\n", "After completing this step, you'll be ready to use the upload functionality of this notebook." ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "b8aa868174ad469e86777458ea77c214", "version_major": 2, "version_minor": 0 }, "text/plain": [ "VBox(children=(HTML(value='