{ "cells": [ { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/dscilab_dungvo/workspace/bin/envs/llm2vec/lib/python3.10/site-packages/tqdm/auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n", " from .autonotebook import tqdm as notebook_tqdm\n" ] } ], "source": [ "import os\n", "import llm2vec" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/dscilab_dungvo/workspace/bin/envs/llm2vec/lib/python3.10/site-packages/huggingface_hub/file_download.py:795: FutureWarning: `resume_download` is deprecated and will be removed in version 1.0.0. Downloads always resume when possible. If you want to force a new download, use `force_download=True`.\n", " warnings.warn(\n", "Special tokens have been added in the vocabulary, make sure the associated word embeddings are fine-tuned or trained.\n", "Downloading shards: 100%|██████████████████████| 4/4 [28:51<00:00, 432.87s/it]\n", "Loading checkpoint shards: 100%|████████████████| 4/4 [00:06<00:00, 1.65s/it]\n" ] } ], "source": [ "import torch\n", "from llm2vec import LLM2Vec\n", "\n", "l2v = LLM2Vec.from_pretrained(\n", " \"McGill-NLP/LLM2Vec-Meta-Llama-3-8B-Instruct-mntp\",\n", " peft_model_name_or_path=\"McGill-NLP/LLM2Vec-Meta-Llama-3-8B-Instruct-mntp-unsup-simcse\",\n", " device_map=\"cuda\" if torch.cuda.is_available() else \"cpu\",\n", " torch_dtype=torch.bfloat16,\n", ")" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "llm2vec", "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.10.16" } }, "nbformat": 4, "nbformat_minor": 2 }