{ "nbformat": 4, "nbformat_minor": 0, "metadata": { "colab": { "provenance": [], "gpuType": "T4" }, "kernelspec": { "name": "python3", "display_name": "Python 3" }, "language_info": { "name": "python" }, "accelerator": "GPU" }, "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": { "id": "Hyg4prvKsTfC" }, "outputs": [], "source": [ "#!pip install bitsandbytes\n" ] }, { "cell_type": "code", "source": [ "#pip install accelerate" ], "metadata": { "id": "MVqLMtMt0Uhc" }, "execution_count": 15, "outputs": [] }, { "cell_type": "code", "source": [ "#!pip install accelerate\n", "#!pip install bitsandbytes -i https://pypi.org/simple/\n" ], "metadata": { "id": "BeHjgLP_0laH" }, "execution_count": 16, "outputs": [] }, { "cell_type": "code", "source": [ "# Load model directly\n", "from transformers import AutoTokenizer, AutoModelForCausalLM\n", "\n", "#tokenizer = AutoTokenizer.from_pretrained(\"harry85/tokenizer-finetuned-TinyLLAMA\")\n", "#model = AutoModelForCausalLM.from_pretrained(\"unsloth/tinyllama-bnb-4bit\")\n", "# Load model directly\n", "#from transformers import AutoTokenizer, AutoModelForCausalLM\n", "# Load model directly\n", "from transformers import AutoTokenizer, AutoModelForCausalLM\n", "\n", "tokenizer = AutoTokenizer.from_pretrained(\"harry85/finetuned-TinyLLAMA-own-data-07\")\n", "model = AutoModelForCausalLM.from_pretrained(\"harry85/finetuned-TinyLLAMA-own-data-07\")\n", "\n", "\n", "# Enable native 2x faster inference if supported\n", "# This feature depends on the specific model and framework used; modify as needed.\n", "# For example, in the case of some models, you can use model.half() to convert to FP16 for faster inference.\n", "\n", "# Define the Alpaca prompt\n", "alpaca_prompt = \"\"\"\\\n", "### Instruction:\n", "{0}\n", "\n", "### Input:\n", "\n", "{1}\n", "\n", "### Response:\n", "{2}\"\"\"\n", "\n", "# Prepare the input\n", "inputs = tokenizer(\n", " [\n", " alpaca_prompt.format(\n", " \"Continue the Fibonacci sequence.\", # instruction\n", " \"1, 1, 2, 3, 5, 8\", # input\n", " \"\" # output - leave this blank for generation!\n", " )\n", " ],\n", " return_tensors=\"pt\"\n", ").to(\"cuda\")\n", "\n", "# Generate the output\n", "outputs = model.generate(**inputs, max_new_tokens=64, use_cache=True)\n", "\n", "# Decode and print the output\n", "response = tokenizer.batch_decode(outputs, skip_special_tokens=True)\n", "print(response)\n" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "RxlJ3o75sUrN", "outputId": "1c767815-7def-42a3-f250-69c7bbe802b7" }, "execution_count": 24, "outputs": [ { "output_type": "stream", "name": "stderr", "text": [ "Unused kwargs: ['quant_method']. These kwargs are not used in .\n", "`low_cpu_mem_usage` was None, now set to True since model is quantized.\n", "Some weights of the model checkpoint at harry85/finetuned-TinyLLAMA-own-data-07 were not used when initializing LlamaForCausalLM: ['base_model.model.model.layers.0.mlp.down_proj.lora_A.weight', 'base_model.model.model.layers.0.mlp.down_proj.lora_B.weight', 'base_model.model.model.layers.0.mlp.gate_proj.lora_A.weight', 'base_model.model.model.layers.0.mlp.gate_proj.lora_B.weight', 'base_model.model.model.layers.0.mlp.up_proj.lora_A.weight', 'base_model.model.model.layers.0.mlp.up_proj.lora_B.weight', 'base_model.model.model.layers.0.self_attn.k_proj.lora_A.weight', 'base_model.model.model.layers.0.self_attn.k_proj.lora_B.weight', 'base_model.model.model.layers.0.self_attn.o_proj.lora_A.weight', 'base_model.model.model.layers.0.self_attn.o_proj.lora_B.weight', 'base_model.model.model.layers.0.self_attn.q_proj.lora_A.weight', 'base_model.model.model.layers.0.self_attn.q_proj.lora_B.weight', 'base_model.model.model.layers.0.self_attn.v_proj.lora_A.weight', 'base_model.model.model.layers.0.self_attn.v_proj.lora_B.weight', 'base_model.model.model.layers.1.mlp.down_proj.lora_A.weight', 'base_model.model.model.layers.1.mlp.down_proj.lora_B.weight', 'base_model.model.model.layers.1.mlp.gate_proj.lora_A.weight', 'base_model.model.model.layers.1.mlp.gate_proj.lora_B.weight', 'base_model.model.model.layers.1.mlp.up_proj.lora_A.weight', 'base_model.model.model.layers.1.mlp.up_proj.lora_B.weight', 'base_model.model.model.layers.1.self_attn.k_proj.lora_A.weight', 'base_model.model.model.layers.1.self_attn.k_proj.lora_B.weight', 'base_model.model.model.layers.1.self_attn.o_proj.lora_A.weight', 'base_model.model.model.layers.1.self_attn.o_proj.lora_B.weight', 'base_model.model.model.layers.1.self_attn.q_proj.lora_A.weight', 'base_model.model.model.layers.1.self_attn.q_proj.lora_B.weight', 'base_model.model.model.layers.1.self_attn.v_proj.lora_A.weight', 'base_model.model.model.layers.1.self_attn.v_proj.lora_B.weight', 'base_model.model.model.layers.10.mlp.down_proj.lora_A.weight', 'base_model.model.model.layers.10.mlp.down_proj.lora_B.weight', 'base_model.model.model.layers.10.mlp.gate_proj.lora_A.weight', 'base_model.model.model.layers.10.mlp.gate_proj.lora_B.weight', 'base_model.model.model.layers.10.mlp.up_proj.lora_A.weight', 'base_model.model.model.layers.10.mlp.up_proj.lora_B.weight', 'base_model.model.model.layers.10.self_attn.k_proj.lora_A.weight', 'base_model.model.model.layers.10.self_attn.k_proj.lora_B.weight', 'base_model.model.model.layers.10.self_attn.o_proj.lora_A.weight', 'base_model.model.model.layers.10.self_attn.o_proj.lora_B.weight', 'base_model.model.model.layers.10.self_attn.q_proj.lora_A.weight', 'base_model.model.model.layers.10.self_attn.q_proj.lora_B.weight', 'base_model.model.model.layers.10.self_attn.v_proj.lora_A.weight', 'base_model.model.model.layers.10.self_attn.v_proj.lora_B.weight', 'base_model.model.model.layers.11.mlp.down_proj.lora_A.weight', 'base_model.model.model.layers.11.mlp.down_proj.lora_B.weight', 'base_model.model.model.layers.11.mlp.gate_proj.lora_A.weight', 'base_model.model.model.layers.11.mlp.gate_proj.lora_B.weight', 'base_model.model.model.layers.11.mlp.up_proj.lora_A.weight', 'base_model.model.model.layers.11.mlp.up_proj.lora_B.weight', 'base_model.model.model.layers.11.self_attn.k_proj.lora_A.weight', 'base_model.model.model.layers.11.self_attn.k_proj.lora_B.weight', 'base_model.model.model.layers.11.self_attn.o_proj.lora_A.weight', 'base_model.model.model.layers.11.self_attn.o_proj.lora_B.weight', 'base_model.model.model.layers.11.self_attn.q_proj.lora_A.weight', 'base_model.model.model.layers.11.self_attn.q_proj.lora_B.weight', 'base_model.model.model.layers.11.self_attn.v_proj.lora_A.weight', 'base_model.model.model.layers.11.self_attn.v_proj.lora_B.weight', 'base_model.model.model.layers.12.mlp.down_proj.lora_A.weight', 'base_model.model.model.layers.12.mlp.down_proj.lora_B.weight', 'base_model.model.model.layers.12.mlp.gate_proj.lora_A.weight', 'base_model.model.model.layers.12.mlp.gate_proj.lora_B.weight', 'base_model.model.model.layers.12.mlp.up_proj.lora_A.weight', 'base_model.model.model.layers.12.mlp.up_proj.lora_B.weight', 'base_model.model.model.layers.12.self_attn.k_proj.lora_A.weight', 'base_model.model.model.layers.12.self_attn.k_proj.lora_B.weight', 'base_model.model.model.layers.12.self_attn.o_proj.lora_A.weight', 'base_model.model.model.layers.12.self_attn.o_proj.lora_B.weight', 'base_model.model.model.layers.12.self_attn.q_proj.lora_A.weight', 'base_model.model.model.layers.12.self_attn.q_proj.lora_B.weight', 'base_model.model.model.layers.12.self_attn.v_proj.lora_A.weight', 'base_model.model.model.layers.12.self_attn.v_proj.lora_B.weight', 'base_model.model.model.layers.13.mlp.down_proj.lora_A.weight', 'base_model.model.model.layers.13.mlp.down_proj.lora_B.weight', 'base_model.model.model.layers.13.mlp.gate_proj.lora_A.weight', 'base_model.model.model.layers.13.mlp.gate_proj.lora_B.weight', 'base_model.model.model.layers.13.mlp.up_proj.lora_A.weight', 'base_model.model.model.layers.13.mlp.up_proj.lora_B.weight', 'base_model.model.model.layers.13.self_attn.k_proj.lora_A.weight', 'base_model.model.model.layers.13.self_attn.k_proj.lora_B.weight', 'base_model.model.model.layers.13.self_attn.o_proj.lora_A.weight', 'base_model.model.model.layers.13.self_attn.o_proj.lora_B.weight', 'base_model.model.model.layers.13.self_attn.q_proj.lora_A.weight', 'base_model.model.model.layers.13.self_attn.q_proj.lora_B.weight', 'base_model.model.model.layers.13.self_attn.v_proj.lora_A.weight', 'base_model.model.model.layers.13.self_attn.v_proj.lora_B.weight', 'base_model.model.model.layers.14.mlp.down_proj.lora_A.weight', 'base_model.model.model.layers.14.mlp.down_proj.lora_B.weight', 'base_model.model.model.layers.14.mlp.gate_proj.lora_A.weight', 'base_model.model.model.layers.14.mlp.gate_proj.lora_B.weight', 'base_model.model.model.layers.14.mlp.up_proj.lora_A.weight', 'base_model.model.model.layers.14.mlp.up_proj.lora_B.weight', 'base_model.model.model.layers.14.self_attn.k_proj.lora_A.weight', 'base_model.model.model.layers.14.self_attn.k_proj.lora_B.weight', 'base_model.model.model.layers.14.self_attn.o_proj.lora_A.weight', 'base_model.model.model.layers.14.self_attn.o_proj.lora_B.weight', 'base_model.model.model.layers.14.self_attn.q_proj.lora_A.weight', 'base_model.model.model.layers.14.self_attn.q_proj.lora_B.weight', 'base_model.model.model.layers.14.self_attn.v_proj.lora_A.weight', 'base_model.model.model.layers.14.self_attn.v_proj.lora_B.weight', 'base_model.model.model.layers.15.mlp.down_proj.lora_A.weight', 'base_model.model.model.layers.15.mlp.down_proj.lora_B.weight', 'base_model.model.model.layers.15.mlp.gate_proj.lora_A.weight', 'base_model.model.model.layers.15.mlp.gate_proj.lora_B.weight', 'base_model.model.model.layers.15.mlp.up_proj.lora_A.weight', 'base_model.model.model.layers.15.mlp.up_proj.lora_B.weight', 'base_model.model.model.layers.15.self_attn.k_proj.lora_A.weight', 'base_model.model.model.layers.15.self_attn.k_proj.lora_B.weight', 'base_model.model.model.layers.15.self_attn.o_proj.lora_A.weight', 'base_model.model.model.layers.15.self_attn.o_proj.lora_B.weight', 'base_model.model.model.layers.15.self_attn.q_proj.lora_A.weight', 'base_model.model.model.layers.15.self_attn.q_proj.lora_B.weight', 'base_model.model.model.layers.15.self_attn.v_proj.lora_A.weight', 'base_model.model.model.layers.15.self_attn.v_proj.lora_B.weight', 'base_model.model.model.layers.16.mlp.down_proj.lora_A.weight', 'base_model.model.model.layers.16.mlp.down_proj.lora_B.weight', 'base_model.model.model.layers.16.mlp.gate_proj.lora_A.weight', 'base_model.model.model.layers.16.mlp.gate_proj.lora_B.weight', 'base_model.model.model.layers.16.mlp.up_proj.lora_A.weight', 'base_model.model.model.layers.16.mlp.up_proj.lora_B.weight', 'base_model.model.model.layers.16.self_attn.k_proj.lora_A.weight', 'base_model.model.model.layers.16.self_attn.k_proj.lora_B.weight', 'base_model.model.model.layers.16.self_attn.o_proj.lora_A.weight', 'base_model.model.model.layers.16.self_attn.o_proj.lora_B.weight', 'base_model.model.model.layers.16.self_attn.q_proj.lora_A.weight', 'base_model.model.model.layers.16.self_attn.q_proj.lora_B.weight', 'base_model.model.model.layers.16.self_attn.v_proj.lora_A.weight', 'base_model.model.model.layers.16.self_attn.v_proj.lora_B.weight', 'base_model.model.model.layers.17.mlp.down_proj.lora_A.weight', 'base_model.model.model.layers.17.mlp.down_proj.lora_B.weight', 'base_model.model.model.layers.17.mlp.gate_proj.lora_A.weight', 'base_model.model.model.layers.17.mlp.gate_proj.lora_B.weight', 'base_model.model.model.layers.17.mlp.up_proj.lora_A.weight', 'base_model.model.model.layers.17.mlp.up_proj.lora_B.weight', 'base_model.model.model.layers.17.self_attn.k_proj.lora_A.weight', 'base_model.model.model.layers.17.self_attn.k_proj.lora_B.weight', 'base_model.model.model.layers.17.self_attn.o_proj.lora_A.weight', 'base_model.model.model.layers.17.self_attn.o_proj.lora_B.weight', 'base_model.model.model.layers.17.self_attn.q_proj.lora_A.weight', 'base_model.model.model.layers.17.self_attn.q_proj.lora_B.weight', 'base_model.model.model.layers.17.self_attn.v_proj.lora_A.weight', 'base_model.model.model.layers.17.self_attn.v_proj.lora_B.weight', 'base_model.model.model.layers.18.mlp.down_proj.lora_A.weight', 'base_model.model.model.layers.18.mlp.down_proj.lora_B.weight', 'base_model.model.model.layers.18.mlp.gate_proj.lora_A.weight', 'base_model.model.model.layers.18.mlp.gate_proj.lora_B.weight', 'base_model.model.model.layers.18.mlp.up_proj.lora_A.weight', 'base_model.model.model.layers.18.mlp.up_proj.lora_B.weight', 'base_model.model.model.layers.18.self_attn.k_proj.lora_A.weight', 'base_model.model.model.layers.18.self_attn.k_proj.lora_B.weight', 'base_model.model.model.layers.18.self_attn.o_proj.lora_A.weight', 'base_model.model.model.layers.18.self_attn.o_proj.lora_B.weight', 'base_model.model.model.layers.18.self_attn.q_proj.lora_A.weight', 'base_model.model.model.layers.18.self_attn.q_proj.lora_B.weight', 'base_model.model.model.layers.18.self_attn.v_proj.lora_A.weight', 'base_model.model.model.layers.18.self_attn.v_proj.lora_B.weight', 'base_model.model.model.layers.19.mlp.down_proj.lora_A.weight', 'base_model.model.model.layers.19.mlp.down_proj.lora_B.weight', 'base_model.model.model.layers.19.mlp.gate_proj.lora_A.weight', 'base_model.model.model.layers.19.mlp.gate_proj.lora_B.weight', 'base_model.model.model.layers.19.mlp.up_proj.lora_A.weight', 'base_model.model.model.layers.19.mlp.up_proj.lora_B.weight', 'base_model.model.model.layers.19.self_attn.k_proj.lora_A.weight', 'base_model.model.model.layers.19.self_attn.k_proj.lora_B.weight', 'base_model.model.model.layers.19.self_attn.o_proj.lora_A.weight', 'base_model.model.model.layers.19.self_attn.o_proj.lora_B.weight', 'base_model.model.model.layers.19.self_attn.q_proj.lora_A.weight', 'base_model.model.model.layers.19.self_attn.q_proj.lora_B.weight', 'base_model.model.model.layers.19.self_attn.v_proj.lora_A.weight', 'base_model.model.model.layers.19.self_attn.v_proj.lora_B.weight', 'base_model.model.model.layers.2.mlp.down_proj.lora_A.weight', 'base_model.model.model.layers.2.mlp.down_proj.lora_B.weight', 'base_model.model.model.layers.2.mlp.gate_proj.lora_A.weight', 'base_model.model.model.layers.2.mlp.gate_proj.lora_B.weight', 'base_model.model.model.layers.2.mlp.up_proj.lora_A.weight', 'base_model.model.model.layers.2.mlp.up_proj.lora_B.weight', 'base_model.model.model.layers.2.self_attn.k_proj.lora_A.weight', 'base_model.model.model.layers.2.self_attn.k_proj.lora_B.weight', 'base_model.model.model.layers.2.self_attn.o_proj.lora_A.weight', 'base_model.model.model.layers.2.self_attn.o_proj.lora_B.weight', 'base_model.model.model.layers.2.self_attn.q_proj.lora_A.weight', 'base_model.model.model.layers.2.self_attn.q_proj.lora_B.weight', 'base_model.model.model.layers.2.self_attn.v_proj.lora_A.weight', 'base_model.model.model.layers.2.self_attn.v_proj.lora_B.weight', 'base_model.model.model.layers.20.mlp.down_proj.lora_A.weight', 'base_model.model.model.layers.20.mlp.down_proj.lora_B.weight', 'base_model.model.model.layers.20.mlp.gate_proj.lora_A.weight', 'base_model.model.model.layers.20.mlp.gate_proj.lora_B.weight', 'base_model.model.model.layers.20.mlp.up_proj.lora_A.weight', 'base_model.model.model.layers.20.mlp.up_proj.lora_B.weight', 'base_model.model.model.layers.20.self_attn.k_proj.lora_A.weight', 'base_model.model.model.layers.20.self_attn.k_proj.lora_B.weight', 'base_model.model.model.layers.20.self_attn.o_proj.lora_A.weight', 'base_model.model.model.layers.20.self_attn.o_proj.lora_B.weight', 'base_model.model.model.layers.20.self_attn.q_proj.lora_A.weight', 'base_model.model.model.layers.20.self_attn.q_proj.lora_B.weight', 'base_model.model.model.layers.20.self_attn.v_proj.lora_A.weight', 'base_model.model.model.layers.20.self_attn.v_proj.lora_B.weight', 'base_model.model.model.layers.21.mlp.down_proj.lora_A.weight', 'base_model.model.model.layers.21.mlp.down_proj.lora_B.weight', 'base_model.model.model.layers.21.mlp.gate_proj.lora_A.weight', 'base_model.model.model.layers.21.mlp.gate_proj.lora_B.weight', 'base_model.model.model.layers.21.mlp.up_proj.lora_A.weight', 'base_model.model.model.layers.21.mlp.up_proj.lora_B.weight', 'base_model.model.model.layers.21.self_attn.k_proj.lora_A.weight', 'base_model.model.model.layers.21.self_attn.k_proj.lora_B.weight', 'base_model.model.model.layers.21.self_attn.o_proj.lora_A.weight', 'base_model.model.model.layers.21.self_attn.o_proj.lora_B.weight', 'base_model.model.model.layers.21.self_attn.q_proj.lora_A.weight', 'base_model.model.model.layers.21.self_attn.q_proj.lora_B.weight', 'base_model.model.model.layers.21.self_attn.v_proj.lora_A.weight', 'base_model.model.model.layers.21.self_attn.v_proj.lora_B.weight', 'base_model.model.model.layers.3.mlp.down_proj.lora_A.weight', 'base_model.model.model.layers.3.mlp.down_proj.lora_B.weight', 'base_model.model.model.layers.3.mlp.gate_proj.lora_A.weight', 'base_model.model.model.layers.3.mlp.gate_proj.lora_B.weight', 'base_model.model.model.layers.3.mlp.up_proj.lora_A.weight', 'base_model.model.model.layers.3.mlp.up_proj.lora_B.weight', 'base_model.model.model.layers.3.self_attn.k_proj.lora_A.weight', 'base_model.model.model.layers.3.self_attn.k_proj.lora_B.weight', 'base_model.model.model.layers.3.self_attn.o_proj.lora_A.weight', 'base_model.model.model.layers.3.self_attn.o_proj.lora_B.weight', 'base_model.model.model.layers.3.self_attn.q_proj.lora_A.weight', 'base_model.model.model.layers.3.self_attn.q_proj.lora_B.weight', 'base_model.model.model.layers.3.self_attn.v_proj.lora_A.weight', 'base_model.model.model.layers.3.self_attn.v_proj.lora_B.weight', 'base_model.model.model.layers.4.mlp.down_proj.lora_A.weight', 'base_model.model.model.layers.4.mlp.down_proj.lora_B.weight', 'base_model.model.model.layers.4.mlp.gate_proj.lora_A.weight', 'base_model.model.model.layers.4.mlp.gate_proj.lora_B.weight', 'base_model.model.model.layers.4.mlp.up_proj.lora_A.weight', 'base_model.model.model.layers.4.mlp.up_proj.lora_B.weight', 'base_model.model.model.layers.4.self_attn.k_proj.lora_A.weight', 'base_model.model.model.layers.4.self_attn.k_proj.lora_B.weight', 'base_model.model.model.layers.4.self_attn.o_proj.lora_A.weight', 'base_model.model.model.layers.4.self_attn.o_proj.lora_B.weight', 'base_model.model.model.layers.4.self_attn.q_proj.lora_A.weight', 'base_model.model.model.layers.4.self_attn.q_proj.lora_B.weight', 'base_model.model.model.layers.4.self_attn.v_proj.lora_A.weight', 'base_model.model.model.layers.4.self_attn.v_proj.lora_B.weight', 'base_model.model.model.layers.5.mlp.down_proj.lora_A.weight', 'base_model.model.model.layers.5.mlp.down_proj.lora_B.weight', 'base_model.model.model.layers.5.mlp.gate_proj.lora_A.weight', 'base_model.model.model.layers.5.mlp.gate_proj.lora_B.weight', 'base_model.model.model.layers.5.mlp.up_proj.lora_A.weight', 'base_model.model.model.layers.5.mlp.up_proj.lora_B.weight', 'base_model.model.model.layers.5.self_attn.k_proj.lora_A.weight', 'base_model.model.model.layers.5.self_attn.k_proj.lora_B.weight', 'base_model.model.model.layers.5.self_attn.o_proj.lora_A.weight', 'base_model.model.model.layers.5.self_attn.o_proj.lora_B.weight', 'base_model.model.model.layers.5.self_attn.q_proj.lora_A.weight', 'base_model.model.model.layers.5.self_attn.q_proj.lora_B.weight', 'base_model.model.model.layers.5.self_attn.v_proj.lora_A.weight', 'base_model.model.model.layers.5.self_attn.v_proj.lora_B.weight', 'base_model.model.model.layers.6.mlp.down_proj.lora_A.weight', 'base_model.model.model.layers.6.mlp.down_proj.lora_B.weight', 'base_model.model.model.layers.6.mlp.gate_proj.lora_A.weight', 'base_model.model.model.layers.6.mlp.gate_proj.lora_B.weight', 'base_model.model.model.layers.6.mlp.up_proj.lora_A.weight', 'base_model.model.model.layers.6.mlp.up_proj.lora_B.weight', 'base_model.model.model.layers.6.self_attn.k_proj.lora_A.weight', 'base_model.model.model.layers.6.self_attn.k_proj.lora_B.weight', 'base_model.model.model.layers.6.self_attn.o_proj.lora_A.weight', 'base_model.model.model.layers.6.self_attn.o_proj.lora_B.weight', 'base_model.model.model.layers.6.self_attn.q_proj.lora_A.weight', 'base_model.model.model.layers.6.self_attn.q_proj.lora_B.weight', 'base_model.model.model.layers.6.self_attn.v_proj.lora_A.weight', 'base_model.model.model.layers.6.self_attn.v_proj.lora_B.weight', 'base_model.model.model.layers.7.mlp.down_proj.lora_A.weight', 'base_model.model.model.layers.7.mlp.down_proj.lora_B.weight', 'base_model.model.model.layers.7.mlp.gate_proj.lora_A.weight', 'base_model.model.model.layers.7.mlp.gate_proj.lora_B.weight', 'base_model.model.model.layers.7.mlp.up_proj.lora_A.weight', 'base_model.model.model.layers.7.mlp.up_proj.lora_B.weight', 'base_model.model.model.layers.7.self_attn.k_proj.lora_A.weight', 'base_model.model.model.layers.7.self_attn.k_proj.lora_B.weight', 'base_model.model.model.layers.7.self_attn.o_proj.lora_A.weight', 'base_model.model.model.layers.7.self_attn.o_proj.lora_B.weight', 'base_model.model.model.layers.7.self_attn.q_proj.lora_A.weight', 'base_model.model.model.layers.7.self_attn.q_proj.lora_B.weight', 'base_model.model.model.layers.7.self_attn.v_proj.lora_A.weight', 'base_model.model.model.layers.7.self_attn.v_proj.lora_B.weight', 'base_model.model.model.layers.8.mlp.down_proj.lora_A.weight', 'base_model.model.model.layers.8.mlp.down_proj.lora_B.weight', 'base_model.model.model.layers.8.mlp.gate_proj.lora_A.weight', 'base_model.model.model.layers.8.mlp.gate_proj.lora_B.weight', 'base_model.model.model.layers.8.mlp.up_proj.lora_A.weight', 'base_model.model.model.layers.8.mlp.up_proj.lora_B.weight', 'base_model.model.model.layers.8.self_attn.k_proj.lora_A.weight', 'base_model.model.model.layers.8.self_attn.k_proj.lora_B.weight', 'base_model.model.model.layers.8.self_attn.o_proj.lora_A.weight', 'base_model.model.model.layers.8.self_attn.o_proj.lora_B.weight', 'base_model.model.model.layers.8.self_attn.q_proj.lora_A.weight', 'base_model.model.model.layers.8.self_attn.q_proj.lora_B.weight', 'base_model.model.model.layers.8.self_attn.v_proj.lora_A.weight', 'base_model.model.model.layers.8.self_attn.v_proj.lora_B.weight', 'base_model.model.model.layers.9.mlp.down_proj.lora_A.weight', 'base_model.model.model.layers.9.mlp.down_proj.lora_B.weight', 'base_model.model.model.layers.9.mlp.gate_proj.lora_A.weight', 'base_model.model.model.layers.9.mlp.gate_proj.lora_B.weight', 'base_model.model.model.layers.9.mlp.up_proj.lora_A.weight', 'base_model.model.model.layers.9.mlp.up_proj.lora_B.weight', 'base_model.model.model.layers.9.self_attn.k_proj.lora_A.weight', 'base_model.model.model.layers.9.self_attn.k_proj.lora_B.weight', 'base_model.model.model.layers.9.self_attn.o_proj.lora_A.weight', 'base_model.model.model.layers.9.self_attn.o_proj.lora_B.weight', 'base_model.model.model.layers.9.self_attn.q_proj.lora_A.weight', 'base_model.model.model.layers.9.self_attn.q_proj.lora_B.weight', 'base_model.model.model.layers.9.self_attn.v_proj.lora_A.weight', 'base_model.model.model.layers.9.self_attn.v_proj.lora_B.weight']\n", "- This IS expected if you are initializing LlamaForCausalLM from the checkpoint of a model trained on another task or with another architecture (e.g. initializing a BertForSequenceClassification model from a BertForPreTraining model).\n", "- This IS NOT expected if you are initializing LlamaForCausalLM from the checkpoint of a model that you expect to be exactly identical (initializing a BertForSequenceClassification model from a BertForSequenceClassification model).\n", "Some weights of LlamaForCausalLM were not initialized from the model checkpoint at harry85/finetuned-TinyLLAMA-own-data-07 and are newly initialized: ['embed_tokens.weight', 'layers.0.input_layernorm.weight', 'layers.0.mlp.down_proj.weight', 'layers.0.mlp.gate_proj.weight', 'layers.0.mlp.up_proj.weight', 'layers.0.post_attention_layernorm.weight', 'layers.0.self_attn.k_proj.weight', 'layers.0.self_attn.o_proj.weight', 'layers.0.self_attn.q_proj.weight', 'layers.0.self_attn.v_proj.weight', 'layers.1.input_layernorm.weight', 'layers.1.mlp.down_proj.weight', 'layers.1.mlp.gate_proj.weight', 'layers.1.mlp.up_proj.weight', 'layers.1.post_attention_layernorm.weight', 'layers.1.self_attn.k_proj.weight', 'layers.1.self_attn.o_proj.weight', 'layers.1.self_attn.q_proj.weight', 'layers.1.self_attn.v_proj.weight', 'layers.10.input_layernorm.weight', 'layers.10.mlp.down_proj.weight', 'layers.10.mlp.gate_proj.weight', 'layers.10.mlp.up_proj.weight', 'layers.10.post_attention_layernorm.weight', 'layers.10.self_attn.k_proj.weight', 'layers.10.self_attn.o_proj.weight', 'layers.10.self_attn.q_proj.weight', 'layers.10.self_attn.v_proj.weight', 'layers.11.input_layernorm.weight', 'layers.11.mlp.down_proj.weight', 'layers.11.mlp.gate_proj.weight', 'layers.11.mlp.up_proj.weight', 'layers.11.post_attention_layernorm.weight', 'layers.11.self_attn.k_proj.weight', 'layers.11.self_attn.o_proj.weight', 'layers.11.self_attn.q_proj.weight', 'layers.11.self_attn.v_proj.weight', 'layers.12.input_layernorm.weight', 'layers.12.mlp.down_proj.weight', 'layers.12.mlp.gate_proj.weight', 'layers.12.mlp.up_proj.weight', 'layers.12.post_attention_layernorm.weight', 'layers.12.self_attn.k_proj.weight', 'layers.12.self_attn.o_proj.weight', 'layers.12.self_attn.q_proj.weight', 'layers.12.self_attn.v_proj.weight', 'layers.13.input_layernorm.weight', 'layers.13.mlp.down_proj.weight', 'layers.13.mlp.gate_proj.weight', 'layers.13.mlp.up_proj.weight', 'layers.13.post_attention_layernorm.weight', 'layers.13.self_attn.k_proj.weight', 'layers.13.self_attn.o_proj.weight', 'layers.13.self_attn.q_proj.weight', 'layers.13.self_attn.v_proj.weight', 'layers.14.input_layernorm.weight', 'layers.14.mlp.down_proj.weight', 'layers.14.mlp.gate_proj.weight', 'layers.14.mlp.up_proj.weight', 'layers.14.post_attention_layernorm.weight', 'layers.14.self_attn.k_proj.weight', 'layers.14.self_attn.o_proj.weight', 'layers.14.self_attn.q_proj.weight', 'layers.14.self_attn.v_proj.weight', 'layers.15.input_layernorm.weight', 'layers.15.mlp.down_proj.weight', 'layers.15.mlp.gate_proj.weight', 'layers.15.mlp.up_proj.weight', 'layers.15.post_attention_layernorm.weight', 'layers.15.self_attn.k_proj.weight', 'layers.15.self_attn.o_proj.weight', 'layers.15.self_attn.q_proj.weight', 'layers.15.self_attn.v_proj.weight', 'layers.16.input_layernorm.weight', 'layers.16.mlp.down_proj.weight', 'layers.16.mlp.gate_proj.weight', 'layers.16.mlp.up_proj.weight', 'layers.16.post_attention_layernorm.weight', 'layers.16.self_attn.k_proj.weight', 'layers.16.self_attn.o_proj.weight', 'layers.16.self_attn.q_proj.weight', 'layers.16.self_attn.v_proj.weight', 'layers.17.input_layernorm.weight', 'layers.17.mlp.down_proj.weight', 'layers.17.mlp.gate_proj.weight', 'layers.17.mlp.up_proj.weight', 'layers.17.post_attention_layernorm.weight', 'layers.17.self_attn.k_proj.weight', 'layers.17.self_attn.o_proj.weight', 'layers.17.self_attn.q_proj.weight', 'layers.17.self_attn.v_proj.weight', 'layers.18.input_layernorm.weight', 'layers.18.mlp.down_proj.weight', 'layers.18.mlp.gate_proj.weight', 'layers.18.mlp.up_proj.weight', 'layers.18.post_attention_layernorm.weight', 'layers.18.self_attn.k_proj.weight', 'layers.18.self_attn.o_proj.weight', 'layers.18.self_attn.q_proj.weight', 'layers.18.self_attn.v_proj.weight', 'layers.19.input_layernorm.weight', 'layers.19.mlp.down_proj.weight', 'layers.19.mlp.gate_proj.weight', 'layers.19.mlp.up_proj.weight', 'layers.19.post_attention_layernorm.weight', 'layers.19.self_attn.k_proj.weight', 'layers.19.self_attn.o_proj.weight', 'layers.19.self_attn.q_proj.weight', 'layers.19.self_attn.v_proj.weight', 'layers.2.input_layernorm.weight', 'layers.2.mlp.down_proj.weight', 'layers.2.mlp.gate_proj.weight', 'layers.2.mlp.up_proj.weight', 'layers.2.post_attention_layernorm.weight', 'layers.2.self_attn.k_proj.weight', 'layers.2.self_attn.o_proj.weight', 'layers.2.self_attn.q_proj.weight', 'layers.2.self_attn.v_proj.weight', 'layers.20.input_layernorm.weight', 'layers.20.mlp.down_proj.weight', 'layers.20.mlp.gate_proj.weight', 'layers.20.mlp.up_proj.weight', 'layers.20.post_attention_layernorm.weight', 'layers.20.self_attn.k_proj.weight', 'layers.20.self_attn.o_proj.weight', 'layers.20.self_attn.q_proj.weight', 'layers.20.self_attn.v_proj.weight', 'layers.21.input_layernorm.weight', 'layers.21.mlp.down_proj.weight', 'layers.21.mlp.gate_proj.weight', 'layers.21.mlp.up_proj.weight', 'layers.21.post_attention_layernorm.weight', 'layers.21.self_attn.k_proj.weight', 'layers.21.self_attn.o_proj.weight', 'layers.21.self_attn.q_proj.weight', 'layers.21.self_attn.v_proj.weight', 'layers.3.input_layernorm.weight', 'layers.3.mlp.down_proj.weight', 'layers.3.mlp.gate_proj.weight', 'layers.3.mlp.up_proj.weight', 'layers.3.post_attention_layernorm.weight', 'layers.3.self_attn.k_proj.weight', 'layers.3.self_attn.o_proj.weight', 'layers.3.self_attn.q_proj.weight', 'layers.3.self_attn.v_proj.weight', 'layers.4.input_layernorm.weight', 'layers.4.mlp.down_proj.weight', 'layers.4.mlp.gate_proj.weight', 'layers.4.mlp.up_proj.weight', 'layers.4.post_attention_layernorm.weight', 'layers.4.self_attn.k_proj.weight', 'layers.4.self_attn.o_proj.weight', 'layers.4.self_attn.q_proj.weight', 'layers.4.self_attn.v_proj.weight', 'layers.5.input_layernorm.weight', 'layers.5.mlp.down_proj.weight', 'layers.5.mlp.gate_proj.weight', 'layers.5.mlp.up_proj.weight', 'layers.5.post_attention_layernorm.weight', 'layers.5.self_attn.k_proj.weight', 'layers.5.self_attn.o_proj.weight', 'layers.5.self_attn.q_proj.weight', 'layers.5.self_attn.v_proj.weight', 'layers.6.input_layernorm.weight', 'layers.6.mlp.down_proj.weight', 'layers.6.mlp.gate_proj.weight', 'layers.6.mlp.up_proj.weight', 'layers.6.post_attention_layernorm.weight', 'layers.6.self_attn.k_proj.weight', 'layers.6.self_attn.o_proj.weight', 'layers.6.self_attn.q_proj.weight', 'layers.6.self_attn.v_proj.weight', 'layers.7.input_layernorm.weight', 'layers.7.mlp.down_proj.weight', 'layers.7.mlp.gate_proj.weight', 'layers.7.mlp.up_proj.weight', 'layers.7.post_attention_layernorm.weight', 'layers.7.self_attn.k_proj.weight', 'layers.7.self_attn.o_proj.weight', 'layers.7.self_attn.q_proj.weight', 'layers.7.self_attn.v_proj.weight', 'layers.8.input_layernorm.weight', 'layers.8.mlp.down_proj.weight', 'layers.8.mlp.gate_proj.weight', 'layers.8.mlp.up_proj.weight', 'layers.8.post_attention_layernorm.weight', 'layers.8.self_attn.k_proj.weight', 'layers.8.self_attn.o_proj.weight', 'layers.8.self_attn.q_proj.weight', 'layers.8.self_attn.v_proj.weight', 'layers.9.input_layernorm.weight', 'layers.9.mlp.down_proj.weight', 'layers.9.mlp.gate_proj.weight', 'layers.9.mlp.up_proj.weight', 'layers.9.post_attention_layernorm.weight', 'layers.9.self_attn.k_proj.weight', 'layers.9.self_attn.o_proj.weight', 'layers.9.self_attn.q_proj.weight', 'layers.9.self_attn.v_proj.weight', 'lm_head.weight', 'norm.weight']\n", "You should probably TRAIN this model on a down-stream task to be able to use it for predictions and inference.\n" ] }, { "output_type": "stream", "name": "stdout", "text": [ "['### Instruction:\\nContinue the Fibonacci sequence.\\n\\n### Input:\\n\\n1, 1, 2, 3, 5, 8\\n\\n### Response:\\n']\n" ] } ] }, { "cell_type": "code", "source": [ "if False:\n", " from unsloth import FastLanguageModel\n", " model, tokenizer = FastLanguageModel.from_pretrained(\n", " model_name = \"lora_model\", # YOUR MODEL YOU USED FOR TRAINING\n", " max_seq_length = max_seq_length,\n", " dtype = dtype,\n", " load_in_4bit = load_in_4bit,\n", " )\n", " FastLanguageModel.for_inference(model) # Enable native 2x faster inference\n", "\n", "# alpaca_prompt = You MUST copy from above!\n", "\n", "inputs = tokenizer(\n", "[\n", " alpaca_prompt.format(\n", " \"which country Haris Hota live\", # instruction\n", " \"Haris Hota\", # input\n", " \"\", # output - leave this blank for generation!\n", " )\n", "], return_tensors = \"pt\").to(\"cuda\")\n", "\n", "from transformers import TextStreamer\n", "text_streamer = TextStreamer(tokenizer)\n", "_ = model.generate(**inputs, streamer = text_streamer, max_new_tokens = 64)" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "IuUufGQz5BBR", "outputId": "07f59e9c-a09e-484c-df1f-406f6e75e36b" }, "execution_count": 26, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ " ### Instruction:\n", "which country Haris Hota live\n", "\n", "### Input:\n", "\n", "Haris Hota\n", "\n", "### Response:\n", "\n" ] } ] }, { "cell_type": "code", "source": [], "metadata": { "id": "aTqhZ5y1533Y" }, "execution_count": null, "outputs": [] } ] }