{ "cells": [ { "cell_type": "markdown", "id": "21111b1f-7cce-4e8b-8337-8f0cdab5804e", "metadata": {}, "source": [ "# AutoTrain" ] }, { "cell_type": "markdown", "id": "dd09a9fd-4b90-48f3-b61c-d2349eb7f43e", "metadata": {}, "source": [ "## Imports" ] }, { "cell_type": "code", "execution_count": 1, "id": "52543575-f92e-4038-ad13-30967f47eb7a", "metadata": { "jupyter": { "is_executing": true } }, "outputs": [], "source": [ "import os\n", "import subprocess\n", "\n", "import yaml" ] }, { "cell_type": "markdown", "id": "74987944-abfb-44f8-9331-ffbb2f7698bb", "metadata": {}, "source": [ "## Config" ] }, { "cell_type": "code", "execution_count": 2, "id": "6992324b-173c-4335-b557-cf78fbb2dd93", "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "b5b27c90c4e849e6aa04587d526e108f", "version_major": 2, "version_minor": 0 }, "text/plain": [ "VBox(children=(HTML(value='
\n", "WAIT TO RUN THIS UNTIL YOUR SPACES ARE FINISHED TRAINING!\n", "" ] }, { "cell_type": "code", "execution_count": 10, "id": "de150f086f1c72fa", "metadata": {}, "outputs": [ { "name": "stdin", "output_type": "stream", "text": [ "Are you sure you want to delete the space 'derek-thomas/autotrain-falcon-v03-poe-RFA-gpt3-5'? (y/n): y\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Deleted derek-thomas/autotrain-falcon-v03-poe-RFA-gpt3-5\n" ] }, { "name": "stdin", "output_type": "stream", "text": [ "Are you sure you want to delete the space 'derek-thomas/autotrain-falcon-v03-poe-RFA-falcon'? (y/n): y\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Deleted derek-thomas/autotrain-falcon-v03-poe-RFA-falcon\n" ] }, { "name": "stdin", "output_type": "stream", "text": [ "Are you sure you want to delete the space 'derek-thomas/autotrain-falcon-v03-poe-FAR-gpt3-5'? (y/n): y\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Deleted derek-thomas/autotrain-falcon-v03-poe-FAR-gpt3-5\n" ] }, { "name": "stdin", "output_type": "stream", "text": [ "Are you sure you want to delete the space 'derek-thomas/autotrain-falcon-v03-poe-FAR-falcon'? (y/n): y\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Deleted derek-thomas/autotrain-falcon-v03-poe-FAR-falcon\n" ] }, { "name": "stdin", "output_type": "stream", "text": [ "Are you sure you want to delete the space 'derek-thomas/autotrain-falcon-v03-poe-FA'? (y/n): y\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Deleted derek-thomas/autotrain-falcon-v03-poe-FA\n" ] } ], "source": [ "for space in autotrain_spaces:\n", " confirm = input(f\"Are you sure you want to delete the space '{space}'? (y/n): \")\n", " if confirm.lower() == 'y':\n", " api.delete_repo(space, repo_type='space')\n", " print(f\"Deleted {space}\")\n", " else:\n", " print(f\"Skipped {space}\")\n" ] }, { "cell_type": "markdown", "id": "e6aa4788fe8b0297", "metadata": {}, "source": [ "\n", "ONLY RUN THIS IF YOU NEED TO RESTART FROM SCRATCH\n", "THIS WILL DELETE YOUR MODELS\n", "\n" ] }, { "cell_type": "code", "execution_count": 11, "id": "c887e61558785e69", "metadata": {}, "outputs": [ { "name": "stdin", "output_type": "stream", "text": [ "Are you sure you want to delete the model 'derek-thomas/falcon-v03-poe-RFA-gpt3-5'? (y/n): y\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Deleted derek-thomas/falcon-v03-poe-RFA-gpt3-5\n" ] }, { "name": "stdin", "output_type": "stream", "text": [ "Are you sure you want to delete the model 'derek-thomas/falcon-v03-poe-RFA-falcon'? (y/n): y\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Deleted derek-thomas/falcon-v03-poe-RFA-falcon\n" ] }, { "name": "stdin", "output_type": "stream", "text": [ "Are you sure you want to delete the model 'derek-thomas/falcon-v03-poe-FAR-gpt3-5'? (y/n): y\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Deleted derek-thomas/falcon-v03-poe-FAR-gpt3-5\n" ] }, { "name": "stdin", "output_type": "stream", "text": [ "Are you sure you want to delete the model 'derek-thomas/falcon-v03-poe-FAR-falcon'? (y/n): y\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Deleted derek-thomas/falcon-v03-poe-FAR-falcon\n" ] }, { "name": "stdin", "output_type": "stream", "text": [ "Are you sure you want to delete the model 'derek-thomas/falcon-v03-poe-FA'? (y/n): y\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Deleted derek-thomas/falcon-v03-poe-FA\n" ] } ], "source": [ "for model in autotrain_models:\n", " confirm = input(f\"Are you sure you want to delete the model '{model}'? (y/n): \")\n", " if confirm.lower() == 'y':\n", " api.delete_repo(model, repo_type='model')\n", " print(f\"Deleted {model}\")\n", " else:\n", " print(f\"Skipped {model}\")\n" ] }, { "cell_type": "code", "execution_count": 12, "id": "a8a8d4c2-0fb5-438c-9fbf-436144d05543", "metadata": {}, "outputs": [ { "name": "stdin", "output_type": "stream", "text": [ "Are you sure you want to move the model from 'derek-thomas/falcon-v03-poe-RFA-gpt3-5' to derek-thomas/falcon-v03-poe-RFA-gpt3-5_backup? (y/n): y\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Moved derek-thomas/falcon-v03-poe-RFA-gpt3-5 to derek-thomas/falcon-v03-poe-RFA-gpt3-5_backup\n" ] }, { "name": "stdin", "output_type": "stream", "text": [ "Are you sure you want to move the model from 'derek-thomas/falcon-v03-poe-RFA-falcon' to derek-thomas/falcon-v03-poe-RFA-falcon_backup? (y/n): y\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Moved derek-thomas/falcon-v03-poe-RFA-falcon to derek-thomas/falcon-v03-poe-RFA-falcon_backup\n" ] }, { "name": "stdin", "output_type": "stream", "text": [ "Are you sure you want to move the model from 'derek-thomas/falcon-v03-poe-FAR-gpt3-5' to derek-thomas/falcon-v03-poe-FAR-gpt3-5_backup? (y/n): y\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Moved derek-thomas/falcon-v03-poe-FAR-gpt3-5 to derek-thomas/falcon-v03-poe-FAR-gpt3-5_backup\n" ] }, { "name": "stdin", "output_type": "stream", "text": [ "Are you sure you want to move the model from 'derek-thomas/falcon-v03-poe-FAR-falcon' to derek-thomas/falcon-v03-poe-FAR-falcon_backup? (y/n): y\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Moved derek-thomas/falcon-v03-poe-FAR-falcon to derek-thomas/falcon-v03-poe-FAR-falcon_backup\n" ] }, { "name": "stdin", "output_type": "stream", "text": [ "Are you sure you want to move the model from 'derek-thomas/falcon-v03-poe-FA' to derek-thomas/falcon-v03-poe-FA_backup? (y/n): y\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Moved derek-thomas/falcon-v03-poe-FA to derek-thomas/falcon-v03-poe-FA_backup\n" ] } ], "source": [ "from huggingface_hub import move_repo\n", "\n", "for model in autotrain_models:\n", " user, model_tag = model.split('/')\n", " to = f\"{user}/{model_tag}_backup\"\n", " confirm = input(f\"Are you sure you want to move the model from '{model}' to {to}? (y/n): \")\n", " if confirm.lower() == 'y':\n", " move_repo(from_id=model, to_id=to)\n", " print(f\"Moved {model} to {to}\")\n", " else:\n", " print(f\"Skipped {model}\")" ] }, { "cell_type": "code", "execution_count": null, "id": "c2a2c864-2082-4be9-8e28-92fd01833e38", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.11.11" } }, "nbformat": 4, "nbformat_minor": 5 }