{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "from huggingface_hub import login\n", "from dotenv import load_dotenv\n", "import os\n", "load_dotenv()\n", "\n", "# Login to Hugging Face Hub\n", "login(token=os.getenv(\"HUGGINGFACE_TOKEN\"))" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "d00ec085003e409d906784abc1f89dc1", "version_major": 2, "version_minor": 0 }, "text/plain": [ "config.json: 0%| | 0.00/838 [00:00What should I do on a trip to Europe?\n", "\n", "That's a great question! To give you the best advice, I need a little more information. Tell me about:\n", "\n", "**1. Your Interests:** \n", " * What kind of things do you enjoy doing? (History, art, food, nightlife, nature, adventure, relaxation, etc.)\n", " * Are there any specific places or activities you've always wanted to experience?\n", "\n", "**2. Your Travel Style:**\n", " * Do you prefer to travel on your own, with a partner, or with a group?\n", " * Do you like to plan everything in advance or be more spontaneous?\n", " * What's your budget like?\n", "\n", "**3. Your Trip Details:**\n", " * How long will you be traveling for?\n", " * What time of year are you planning to go?\n", " * Do you have any specific destinations in mind?\n", "\n", "Once I have this information, I can give you personalized recommendations for your European adventure! \n", "\n", "CPU times: total: 7.23 s\n", "Wall time: 7.56 s\n" ] } ], "source": [ "%%time\n", "input_text = \"What should I do on a trip to Europe?\"\n", "\n", "input_ids = tokenizer(input_text, return_tensors=\"pt\").to(\"cuda\")\n", "outputs = model.generate(**input_ids, max_length=2048)\n", "print(tokenizer.decode(outputs[0]))" ] } ], "metadata": { "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.12.7" } }, "nbformat": 4, "nbformat_minor": 2 }