gradio_demos/chatbot_demo.ipynb (1,316 lines of code) (raw):
{
"cells": [
{
"cell_type": "markdown",
"metadata": {
"id": "1_PQwHV_RPzE"
},
"source": [
"# Chatbot Demo\n",
"\n",
"This notebook demonstrates how to create a simple chatbot interface using Llama models via Hugging Face's `transformers` library and `gradio` for the user interface.\n",
"\n",
"### Main Features:\n",
"- Select from a list of pre-trained Llama models.\n",
"- Input text and receive responses from the selected model.\n",
"- Cache models to avoid reloading them multiple times."
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "pq-EYBCPRPzF"
},
"source": [
"## Log in to Hugging Face Hub\n",
"\n",
"In this cell, we import the `login` function from the Hugging Face Hub and call it to authenticate with your Hugging Face account. This step is required to access the Llama models."
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 145,
"referenced_widgets": [
"bcc63dbfbc4b48a990f3d6347acc5bde",
"6e7d04b61f004c9abd77976f67b4dd83",
"c146b62074d245e0b57d062aeb35348f",
"c334612b3058483faf19aa99954d0ebd",
"fcd687cd6f5c45489c816d9c9e421fbf",
"c0b7a4baebfc4c799ff11ddb9b0a6508",
"9d6707933ce447d2891a0afba39d3acf",
"5cd3baeb3dba4e77a3497b718372861f",
"7af9bb6f3c364ea0acd4db49a513a208",
"0316beec3b5b4966a9d0d99bbe8c0daf",
"c2804d15bee445c2b01a1a770f1ff573",
"f6fdf8cdf2be4725bdb1f0b757330253",
"326944e68f9844d5bc7a04a686f9ea31",
"fd710645e3d34b799e84e7014c765179",
"29e89bfcd470407d8feee99e9fd4d72b",
"35e39ba756444661a454153864747203",
"0ee70d6971fb45ce9d380ea4d5adaaee",
"0cd137ff4d3e47aebf8e1852d5db7c3b",
"7e1a4e732dee412e98c2c8b9e00c0f9d",
"1796f6bb56d844f499328da35fa98eac",
"2bad957eafe24533a0a5ff3d91b73daa",
"022281bfafdd4b1b88449b023e82a0d7",
"c8d712b2232e4d959c21e5f61c5b09e1",
"9b3f0f37164d4b12aebb59bc655b3cbf",
"77ccd93d4cae4d9c8654fcbfe12578b0",
"76f68f947d2742d785aff345515417d6",
"ccb62d39b7474e2e8739a16cfa49930d",
"1a8cc89a7b4041ccb5eb91b8dfc322d8",
"f5ace45036dc41eaa1fb687330fc274e",
"077031512b644a5a998f21e9ff6d8646",
"31e7c4db3bb84ea0bbc46b51222cd753",
"7baf25c6cd284f099bb0314b1d849394"
]
},
"id": "fQXcekCRRPzF",
"outputId": "5a71756f-ebf9-43a0-cb80-5ea881d4e69b"
},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "3c9d5bbfc622475fb4f4c465f4ff5ba8",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"VBox(children=(HTML(value='<center> <img\\nsrc=https://huggingface.co/front/assets/huggingface_logo-noborder.sv…"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"from huggingface_hub import login\n",
"login()"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "VBwOlAVoRPzG"
},
"source": [
"## Import Required Libraries"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"id": "qtbxGN0mRPzG"
},
"outputs": [],
"source": [
"import gradio as gr\n",
"import torch\n",
"from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"id": "k2hEGwoiRPzG"
},
"outputs": [],
"source": [
"device = 0 if torch.cuda.is_available() else -1"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "AQ41FXylRPzG"
},
"source": [
"## Basic Usage\n",
"\n",
"Below there are a list of available Llama models to choose from. The dictionary llama_models is a mapping that associates model names with their corresponding paths to their repositories"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"id": "iowitqKpRPzG"
},
"outputs": [],
"source": [
"llama_models = {\n",
" \"Llama 3 70B Instruct\": \"meta-llama/Meta-Llama-3-70B-Instruct\",\n",
" \"Llama 3 8B Instruct\": \"meta-llama/Meta-Llama-3-8B-Instruct\",\n",
" \"Llama 3.1 70B Instruct\": \"meta-llama/Llama-3.1-70B-Instruct\",\n",
" \"Llama 3.1 8B Instruct\": \"meta-llama/Llama-3.1-8B-Instruct\",\n",
" \"Llama 3.2 3B Instruct\": \"meta-llama/Llama-3.2-3B-Instruct\",\n",
" \"Llama 3.2 1B Instruct\": \"meta-llama/Llama-3.2-1B-Instruct\",\n",
"}"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "LjFBhbPjVAcr"
},
"source": [
"### Loading Models\n",
"\n",
"The `load_model` function loads the selected Llama model along with its tokenizer. It uses Hugging Face's `AutoModelForCausalLM` and `AutoTokenizer` to load the pre-trained model and return a text generation pipeline. Note that for each version of Llama, you need to separately request access to be able to use them."
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"id": "vC4_PZQ1RPzG"
},
"outputs": [],
"source": [
"def load_model(model_name):\n",
" \"\"\"Load the specified Llama model.\"\"\"\n",
" tokenizer = AutoTokenizer.from_pretrained(model_name)\n",
" model = AutoModelForCausalLM.from_pretrained(model_name)\n",
" generator = pipeline('text-generation', model=model, tokenizer=tokenizer, device=device)\n",
" return generator"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "oQKfZtWtRPzG"
},
"source": [
"### Model Caching\n",
"\n",
"Cache models to avoid reloading them multiple times."
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {
"id": "hL_9O8gzRPzG"
},
"outputs": [],
"source": [
"model_cache = {}"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "N-j6nX-9RPzH"
},
"source": [
"### Chat Generation\n",
"\n",
"The `generate_chat` function generates chatbot responses using the selected Llama model. It first checks if the chosen model is cached; if not, it loads the model. A system prompt is set to define the bot's behavior, typically framing it as a helpful assistant, but this prompt can be customized to change the nature of the responses. The function processes the conversation history by formatting previous user and assistant exchanges into a structured sequence of messages. The latest user input is added to this sequence. The Llama model then generates a response using specific parameters such as `max_length`, `temperature`, and `top_p` to control the style and variability of the output. The response is added to the conversation history, and the updated history is returned, allowing the chat session to continue from where it left off."
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {
"id": "ZcmRjGTCRPzH"
},
"outputs": [],
"source": [
"def generate_chat(user_input, history, model_choice):\n",
" \"\"\"Generate chatbot responses using the selected Llama model and task.\"\"\"\n",
" \n",
" if model_choice not in model_cache:\n",
" model_cache[model_choice] = load_model(llama_models[model_choice])\n",
" generator = model_cache[model_choice]\n",
"\n",
" system_prompt = {\"role\": \"system\", \"content\": \"You are a helpful assistant\"}\n",
"\n",
" if history is None:\n",
" history = [system_prompt]\n",
" \n",
" history.append({\"role\": \"user\", \"content\": user_input})\n",
"\n",
" response = generator(\n",
" history,\n",
" max_length=512,\n",
" pad_token_id=generator.tokenizer.eos_token_id,\n",
" do_sample=True,\n",
" temperature=0.7,\n",
" top_p=0.9\n",
" )[-1][\"generated_text\"][-1][\"content\"]\n",
"\n",
" history.append({\"role\": \"assistant\", \"content\": response})\n",
" \n",
" return history"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "ULvB73WARPzH"
},
"source": [
"## Gradio Interface\n",
"\n",
"The cell below defines an interactive Gradio interface for chatting with various Llama models. It includes a centered title, a dropdown menu for selecting a Llama model, a chatbot interface for displaying the conversation, and a textbox for entering user queries. Users can either submit input by pressing **Enter** or clicking the **Submit** button, which triggers the `respond` function. This function generates a response using the selected model, maintains the chat history, and updates the chatbot interface with the ongoing conversation"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "823gwGEkV619",
"outputId": "7bc2695d-011f-471f-97e3-9d2b9fa4411f"
},
"outputs": [],
"source": [
"with gr.Blocks() as demo:\n",
" gr.Markdown(\"<h1><center>Chat with Llama Models</center></h1>\")\n",
"\n",
" model_choice = gr.Dropdown(list(llama_models.keys()), label=\"Select Llama Model\")\n",
"\n",
" chatbot = gr.Chatbot(label=\"Chatbot Interface\", type = \"messages\")\n",
" txt_input = gr.Textbox(show_label=False, placeholder=\"Type your message here...\")\n",
"\n",
" def respond(user_input, chat_history, model_choice):\n",
" if model_choice is None:\n",
" model_choice = list(llama_models.keys())[0]\n",
" updated_history = generate_chat(user_input, chat_history, model_choice)\n",
" return \"\", updated_history\n",
"\n",
" txt_input.submit(respond, [txt_input, chatbot, model_choice], [txt_input, chatbot])\n",
"\n",
" submit_btn = gr.Button(\"Submit\")\n",
" submit_btn.click(respond, [txt_input, chatbot, model_choice], [txt_input, chatbot])"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "KT7ZuiDWRPzH"
},
"source": [
"### Launch the interface\n",
"\n",
"The screenshot below shows the interface\n",
""
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 648
},
"id": "kNlqpNlNRPzH",
"outputId": "ef1df779-84d9-45c2-957b-c2557956363c"
},
"outputs": [],
"source": [
"demo.launch()"
]
}
],
"metadata": {
"accelerator": "GPU",
"colab": {
"gpuType": "T4",
"provenance": []
},
"kernelspec": {
"display_name": ".venv",
"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.4"
},
"widgets": {
"application/vnd.jupyter.widget-state+json": {
"022281bfafdd4b1b88449b023e82a0d7": {
"model_module": "@jupyter-widgets/controls",
"model_module_version": "1.5.0",
"model_name": "LabelModel",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "LabelModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "LabelView",
"description": "",
"description_tooltip": null,
"layout": "IPY_MODEL_ccb62d39b7474e2e8739a16cfa49930d",
"placeholder": "",
"style": "IPY_MODEL_1a8cc89a7b4041ccb5eb91b8dfc322d8",
"value": "Your token has been saved in your configured git credential helpers (store)."
}
},
"0316beec3b5b4966a9d0d99bbe8c0daf": {
"model_module": "@jupyter-widgets/base",
"model_module_version": "1.2.0",
"model_name": "LayoutModel",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"077031512b644a5a998f21e9ff6d8646": {
"model_module": "@jupyter-widgets/controls",
"model_module_version": "1.5.0",
"model_name": "DescriptionStyleModel",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "DescriptionStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"description_width": ""
}
},
"0cd137ff4d3e47aebf8e1852d5db7c3b": {
"model_module": "@jupyter-widgets/controls",
"model_module_version": "1.5.0",
"model_name": "LabelModel",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "LabelModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "LabelView",
"description": "",
"description_tooltip": null,
"layout": "IPY_MODEL_7e1a4e732dee412e98c2c8b9e00c0f9d",
"placeholder": "",
"style": "IPY_MODEL_1796f6bb56d844f499328da35fa98eac",
"value": "Connecting..."
}
},
"0ee70d6971fb45ce9d380ea4d5adaaee": {
"model_module": "@jupyter-widgets/controls",
"model_module_version": "1.5.0",
"model_name": "DescriptionStyleModel",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "DescriptionStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"description_width": ""
}
},
"1796f6bb56d844f499328da35fa98eac": {
"model_module": "@jupyter-widgets/controls",
"model_module_version": "1.5.0",
"model_name": "DescriptionStyleModel",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "DescriptionStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"description_width": ""
}
},
"1a8cc89a7b4041ccb5eb91b8dfc322d8": {
"model_module": "@jupyter-widgets/controls",
"model_module_version": "1.5.0",
"model_name": "DescriptionStyleModel",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "DescriptionStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"description_width": ""
}
},
"29e89bfcd470407d8feee99e9fd4d72b": {
"model_module": "@jupyter-widgets/controls",
"model_module_version": "1.5.0",
"model_name": "ButtonStyleModel",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "ButtonStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"button_color": null,
"font_weight": ""
}
},
"2bad957eafe24533a0a5ff3d91b73daa": {
"model_module": "@jupyter-widgets/controls",
"model_module_version": "1.5.0",
"model_name": "LabelModel",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "LabelModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "LabelView",
"description": "",
"description_tooltip": null,
"layout": "IPY_MODEL_77ccd93d4cae4d9c8654fcbfe12578b0",
"placeholder": "",
"style": "IPY_MODEL_76f68f947d2742d785aff345515417d6",
"value": "Token is valid (permission: read)."
}
},
"31e7c4db3bb84ea0bbc46b51222cd753": {
"model_module": "@jupyter-widgets/base",
"model_module_version": "1.2.0",
"model_name": "LayoutModel",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"326944e68f9844d5bc7a04a686f9ea31": {
"model_module": "@jupyter-widgets/controls",
"model_module_version": "1.5.0",
"model_name": "DescriptionStyleModel",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "DescriptionStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"description_width": ""
}
},
"35e39ba756444661a454153864747203": {
"model_module": "@jupyter-widgets/base",
"model_module_version": "1.2.0",
"model_name": "LayoutModel",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"5cd3baeb3dba4e77a3497b718372861f": {
"model_module": "@jupyter-widgets/base",
"model_module_version": "1.2.0",
"model_name": "LayoutModel",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"6e7d04b61f004c9abd77976f67b4dd83": {
"model_module": "@jupyter-widgets/controls",
"model_module_version": "1.5.0",
"model_name": "HTMLModel",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "HTMLModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "HTMLView",
"description": "",
"description_tooltip": null,
"layout": "IPY_MODEL_5cd3baeb3dba4e77a3497b718372861f",
"placeholder": "",
"style": "IPY_MODEL_7af9bb6f3c364ea0acd4db49a513a208",
"value": "<center> <img\nsrc=https://huggingface.co/front/assets/huggingface_logo-noborder.svg\nalt='Hugging Face'> <br> Copy a token from <a\nhref=\"https://huggingface.co/settings/tokens\" target=\"_blank\">your Hugging Face\ntokens page</a> and paste it below. <br> Immediately click login after copying\nyour token or it might be stored in plain text in this notebook file. </center>"
}
},
"76f68f947d2742d785aff345515417d6": {
"model_module": "@jupyter-widgets/controls",
"model_module_version": "1.5.0",
"model_name": "DescriptionStyleModel",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "DescriptionStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"description_width": ""
}
},
"77ccd93d4cae4d9c8654fcbfe12578b0": {
"model_module": "@jupyter-widgets/base",
"model_module_version": "1.2.0",
"model_name": "LayoutModel",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"7af9bb6f3c364ea0acd4db49a513a208": {
"model_module": "@jupyter-widgets/controls",
"model_module_version": "1.5.0",
"model_name": "DescriptionStyleModel",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "DescriptionStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"description_width": ""
}
},
"7baf25c6cd284f099bb0314b1d849394": {
"model_module": "@jupyter-widgets/controls",
"model_module_version": "1.5.0",
"model_name": "DescriptionStyleModel",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "DescriptionStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"description_width": ""
}
},
"7e1a4e732dee412e98c2c8b9e00c0f9d": {
"model_module": "@jupyter-widgets/base",
"model_module_version": "1.2.0",
"model_name": "LayoutModel",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"9b3f0f37164d4b12aebb59bc655b3cbf": {
"model_module": "@jupyter-widgets/controls",
"model_module_version": "1.5.0",
"model_name": "LabelModel",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "LabelModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "LabelView",
"description": "",
"description_tooltip": null,
"layout": "IPY_MODEL_31e7c4db3bb84ea0bbc46b51222cd753",
"placeholder": "",
"style": "IPY_MODEL_7baf25c6cd284f099bb0314b1d849394",
"value": "Login successful"
}
},
"9d6707933ce447d2891a0afba39d3acf": {
"model_module": "@jupyter-widgets/base",
"model_module_version": "1.2.0",
"model_name": "LayoutModel",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": "center",
"align_self": null,
"border": null,
"bottom": null,
"display": "flex",
"flex": null,
"flex_flow": "column",
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": "50%"
}
},
"bcc63dbfbc4b48a990f3d6347acc5bde": {
"model_module": "@jupyter-widgets/controls",
"model_module_version": "1.5.0",
"model_name": "VBoxModel",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "VBoxModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "VBoxView",
"box_style": "",
"children": [
"IPY_MODEL_2bad957eafe24533a0a5ff3d91b73daa",
"IPY_MODEL_022281bfafdd4b1b88449b023e82a0d7",
"IPY_MODEL_c8d712b2232e4d959c21e5f61c5b09e1",
"IPY_MODEL_9b3f0f37164d4b12aebb59bc655b3cbf"
],
"layout": "IPY_MODEL_9d6707933ce447d2891a0afba39d3acf"
}
},
"c0b7a4baebfc4c799ff11ddb9b0a6508": {
"model_module": "@jupyter-widgets/controls",
"model_module_version": "1.5.0",
"model_name": "HTMLModel",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "HTMLModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "HTMLView",
"description": "",
"description_tooltip": null,
"layout": "IPY_MODEL_35e39ba756444661a454153864747203",
"placeholder": "",
"style": "IPY_MODEL_0ee70d6971fb45ce9d380ea4d5adaaee",
"value": "\n<b>Pro Tip:</b> If you don't already have one, you can create a dedicated\n'notebooks' token with 'write' access, that you can then easily reuse for all\nnotebooks. </center>"
}
},
"c146b62074d245e0b57d062aeb35348f": {
"model_module": "@jupyter-widgets/controls",
"model_module_version": "1.5.0",
"model_name": "PasswordModel",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "PasswordModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "PasswordView",
"continuous_update": true,
"description": "Token:",
"description_tooltip": null,
"disabled": false,
"layout": "IPY_MODEL_0316beec3b5b4966a9d0d99bbe8c0daf",
"placeholder": "",
"style": "IPY_MODEL_c2804d15bee445c2b01a1a770f1ff573",
"value": ""
}
},
"c2804d15bee445c2b01a1a770f1ff573": {
"model_module": "@jupyter-widgets/controls",
"model_module_version": "1.5.0",
"model_name": "DescriptionStyleModel",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "DescriptionStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"description_width": ""
}
},
"c334612b3058483faf19aa99954d0ebd": {
"model_module": "@jupyter-widgets/controls",
"model_module_version": "1.5.0",
"model_name": "CheckboxModel",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "CheckboxModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "CheckboxView",
"description": "Add token as git credential?",
"description_tooltip": null,
"disabled": false,
"indent": true,
"layout": "IPY_MODEL_f6fdf8cdf2be4725bdb1f0b757330253",
"style": "IPY_MODEL_326944e68f9844d5bc7a04a686f9ea31",
"value": true
}
},
"c8d712b2232e4d959c21e5f61c5b09e1": {
"model_module": "@jupyter-widgets/controls",
"model_module_version": "1.5.0",
"model_name": "LabelModel",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "LabelModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "LabelView",
"description": "",
"description_tooltip": null,
"layout": "IPY_MODEL_f5ace45036dc41eaa1fb687330fc274e",
"placeholder": "",
"style": "IPY_MODEL_077031512b644a5a998f21e9ff6d8646",
"value": "Your token has been saved to /root/.cache/huggingface/token"
}
},
"ccb62d39b7474e2e8739a16cfa49930d": {
"model_module": "@jupyter-widgets/base",
"model_module_version": "1.2.0",
"model_name": "LayoutModel",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"f5ace45036dc41eaa1fb687330fc274e": {
"model_module": "@jupyter-widgets/base",
"model_module_version": "1.2.0",
"model_name": "LayoutModel",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"f6fdf8cdf2be4725bdb1f0b757330253": {
"model_module": "@jupyter-widgets/base",
"model_module_version": "1.2.0",
"model_name": "LayoutModel",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"fcd687cd6f5c45489c816d9c9e421fbf": {
"model_module": "@jupyter-widgets/controls",
"model_module_version": "1.5.0",
"model_name": "ButtonModel",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "ButtonModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "ButtonView",
"button_style": "",
"description": "Login",
"disabled": false,
"icon": "",
"layout": "IPY_MODEL_fd710645e3d34b799e84e7014c765179",
"style": "IPY_MODEL_29e89bfcd470407d8feee99e9fd4d72b",
"tooltip": ""
}
},
"fd710645e3d34b799e84e7014c765179": {
"model_module": "@jupyter-widgets/base",
"model_module_version": "1.2.0",
"model_name": "LayoutModel",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
}
}
}
},
"nbformat": 4,
"nbformat_minor": 0
}