From 1e45d506c7296d2077bd3fc9ca52611a4d3d027b Mon Sep 17 00:00:00 2001 From: camenduru <54370274+camenduru@users.noreply.github.com> Date: Fri, 13 Oct 2023 22:55:10 +0300 Subject: [PATCH] test --- LLaVA_13b_8bit_colab.ipynb | 37 ++++++++++++++++++++++++++++--------- 1 file changed, 28 insertions(+), 9 deletions(-) diff --git a/LLaVA_13b_8bit_colab.ipynb b/LLaVA_13b_8bit_colab.ipynb index 847d180..7d01b41 100644 --- a/LLaVA_13b_8bit_colab.ipynb +++ b/LLaVA_13b_8bit_colab.ipynb @@ -73,6 +73,34 @@ "!python3 -m llava.serve.gradio_web_server --controller http://localhost:10000 --model-list-mode reload --share" ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "from transformers import AutoTokenizer\n", + "from llava.model import LlavaLlamaForCausalLM\n", + "import torch\n", + "\n", + "model_path = \"4bit/llava-v1.5-13b-4GB-8bit\"\n", + "tokenizer = AutoTokenizer.from_pretrained(model_path, use_fast=False)\n", + "model = LlavaLlamaForCausalLM.from_pretrained(model_path)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "vision_tower = model.get_vision_tower()\n", + "if not vision_tower.is_loaded:\n", + " vision_tower.load_model()\n", + "vision_tower.to(device='cpu')\n", + "image_processor = vision_tower.image_processor" + ] + }, { "cell_type": "code", "execution_count": null, @@ -89,15 +117,6 @@ "# load_4bit=False\n", "# )\n", "\n", - "from transformers import AutoTokenizer\n", - "from llava.model import LlavaLlamaForCausalLM\n", - "import torch\n", - "\n", - "model_path = \"4bit/llava-v1.5-13b-4GB-8bit\"\n", - "tokenizer = AutoTokenizer.from_pretrained(model_path, use_fast=False)\n", - "model = LlavaLlamaForCausalLM.from_pretrained(model_path)\n", - "# model = LlavaLlamaForCausalLM.from_pretrained(model_path, low_cpu_mem_usage=True, load_in_8bit=True, device_map=\"auto\")\n", - "\n", "vision_tower = model.get_vision_tower()\n", "if not vision_tower.is_loaded:\n", " vision_tower.load_model()\n",