{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "66b70728", "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "Loading the tokenizer from the `special_tokens_map.json` and the `added_tokens.json` will be removed in `transformers 5`, it is kept for forward compatibility, but it is recommended to update your `tokenizer_config.json` by uploading it again. You will see the new `added_tokens_decoder` attribute that will store the relevant information.\n" ] } ], "source": [ "from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig\n", "import torch\n", "\n", "tokenizer = AutoTokenizer.from_pretrained('meta-llama/Llama-2-13b-hf')" ] }, { "cell_type": "code", "execution_count": 2, "id": "d608fb34", "metadata": {}, "outputs": [], "source": [ "nf4_config = BitsAndBytesConfig(\n", " load_in_4bit=True,\n", " bnb_4bit_quant_type='nf4',\n", " bnb_4bit_use_double_quant=True,\n", " bnb_4bit_compute_dtype=torch.bfloat16\n", ")" ] }, { "cell_type": "code", "execution_count": 5, "id": "4d63a1ec", "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "b003c36bd0a64b0f97b7868bd7e04a7f", "version_major": 2, "version_minor": 0 }, "text/plain": [ "Downloading (…)lve/main/config.json: 0%| | 0.00/609 [00:00