{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "7ee919d4", "metadata": {}, "outputs": [], "source": [ "import os\n", "\n", "os.environ['CUDA_VISIBLE_DEVICES'] = ''\n", "os.environ['TF_FORCE_GPU_ALLOW_GROWTH'] = 'true'" ] }, { "cell_type": "code", "execution_count": 2, "id": "da0b7b04", "metadata": {}, "outputs": [], "source": [ "from transformers import AutoTokenizer, AutoModelForCausalLM\n", "import torch" ] }, { "cell_type": "code", "execution_count": 3, "id": "97b4ac94", "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "Special tokens have been added in the vocabulary, make sure the associated word embeddings are fine-tuned or trained.\n" ] } ], "source": [ "tokenizer = AutoTokenizer.from_pretrained('meta-llama/Meta-Llama-3-8B-Instruct')" ] }, { "cell_type": "code", "execution_count": 4, "id": "b9c98dca", "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "689cdd6ffd264f1c88f0ed5f0ab092b7", "version_major": 2, "version_minor": 0 }, "text/plain": [ "tokenizer_config.json: 0%| | 0.00/50.9k [00:00'\n", "tokenizer.eos_token_id" ] }, { "cell_type": "code", "execution_count": 6, "id": "8e518761", "metadata": {}, "outputs": [], "source": [ "tokenizer.chat_template = fix_tokenizer.chat_template" ] }, { "cell_type": "code", "execution_count": 8, "id": "5eda44ec", "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "7276d6ee57214ca7ad20d2348da0bb34", "version_major": 2, "version_minor": 0 }, "text/plain": [ "config.json: 0%| | 0.00/654 [00:00