LLaVa安装记录

news2025/2/22 22:07:16

配置环境

装conda

wget https://repo.anaconda.com/archive/Anaconda3-5.3.0-Linux-x86_64.sh
chmod +x Anaconda3-5.3.0-Linux-x86_64.sh
./Anaconda3-5.3.0-Linux-x86_64.sh
export PATH=~/anaconda3/bin:$PATH # 或者写到环境保护变量
# 不会弄看这吧 https://blog.csdn.net/wyf2017/article/details/118676765
  1. Clone this repository and navigate to LLaVA folder
git clone https://github.com/haotian-liu/LLaVA.git
cd LLaVA
  1. Install Package
conda create -n llava python=3.10 -y
conda activate llava
pip install --upgrade pip  # enable PEP 660 support
pip install -e .
  1. Install additional packages for training cases
pip install ninja
pip install flash-attn==1.0.8 --no-build-isolation

配置拉模型的工具

curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash
apt-get install git-lfs
git lfs install

下载llama模型

模型选择:

Base LLMVision EncoderPretrain DataPretraining scheduleFinetuning DataFinetuning scheduleLLaVA-Bench-ConvLLaVA-Bench-DetailLLaVA-Bench-ComplexLLaVA-Bench-OverallDownload
Vicuna-13B-v1.3CLIP-L-336pxLCS-558K1eLLaVA-Instruct-80Kproj-1e, lora-1e64.355.981.770.1LoRA LoRA-Merged
LLaMA-2-13B-ChatCLIP-LLCS-558K1eLLaVA-Instruct-80Kfull_ft-1e56.758.680.067.9ckpt
LLaMA-2-7B-ChatCLIP-LLCS-558K1eLLaVA-Instruct-80Klora-1e51.258.971.662.8LoRA

下载LLaMA-2-13B-Chat示例:

git lfs clone https://huggingface.co/liuhaotian/llava-llama-2-13b-chat-lightning-preview

下载Projector权重

When using these projector weights to instruction tune your LMM, please make sure that these options are correctly set as follows,

--mm_use_im_start_end False
--mm_use_im_patch_token False
Base LLMVision EncoderPretrain DataPretraining scheduleDownload
LLaMA-2-13B-ChatCLIP-L-336pxLCS-558K1eprojector
LLaMA-2-7B-ChatCLIP-L-336pxLCS-558K1eprojector
LLaMA-2-13B-ChatCLIP-LLCS-558K1eprojector
LLaMA-2-7B-ChatCLIP-LLCS-558K1eprojector
Vicuna-13B-v1.3CLIP-L-336pxLCS-558K1eprojector
Vicuna-7B-v1.3CLIP-L-336pxLCS-558K1eprojector
Vicuna-13B-v1.3CLIP-LLCS-558K1eprojector
Vicuna-7B-v1.3CLIP-LLCS-558K1eprojector
git lfs clone https://huggingface.co/liuhaotian/llava-pretrain-llama-2-13b-chat

下载完的结构

./llava-llama-2-13b-chat-lightning-preview
	├── config.json
	├── generation_config.json
	├── LICENSE
	├── mm_projector.bin
	├── pytorch_model-00001-of-00003.bin
	├── pytorch_model-00002-of-00003.bin
	├── pytorch_model-00003-of-00003.bin
	├── pytorch_model.bin.index.json
	├── README.md
	├── special_tokens_map.json
	├── tokenizer_config.json
	└── tokenizer.model
./llava-pretrain-llama-2-13b-chat
	├── config.json
	├── mm_projector.bin
	└── README.md

测试demo

# 第一个终端运行
python3 -m llava.serve.controller --host 0.0.0.0 --port 10000
# 第二个终端运行
python3 -m llava.serve.gradio_web_server --controller http://localhost:10000 --model-list-mode reload --share
# 第三个终端运行
python3 -m llava.serve.model_worker --host 0.0.0.0 --controller http://localhost:10000 --port 40000 --worker http://localhost:40000 --model-path ./checkpoints/LLaVA-13B-v0

测试结果

在这里插入图片描述
选择刚才加载的模型后,随便问就行了。

在这里插入图片描述

训练

预训练就不跑了,直接拿他训好的权重finetune就是了,所以跑下finetune
下载标注文件:

git lfs clone https://huggingface.co/datasets/liuhaotian/LLaVA-Instruct-150K

下载训练数据:

wget http://images.cocodataset.org/zips/train2017.zip

训练数据格式:
外层是list,里面其中一条长这样

  {
    "id": "000000379143",
    "image": "000000379143.jpg",
    "conversations": [
      {
        "from": "human",
        "value": "What is the man doing in the back of the pickup truck?\n<image>"
      },
      {
        "from": "gpt",
        "value": "The man is sitting on top of piled objects or belongings loaded into the back of a pickup truck."
      },
      {
        "from": "human",
        "value": "Is the man holding anything in his hands?"
      },
      {
        "from": "gpt",
        "value": "Yes, the man is holding a beer in his hand while sitting on top of the objects in the back of the pickup truck."
      },
      {
        "from": "human",
        "value": "What color is the pickup truck?"
      },
      {
        "from": "gpt",
        "value": "The pickup truck is white."
      },
      {
        "from": "human",
        "value": "Is the man sitting or standing?"
      },
      {
        "from": "gpt",
        "value": "The man is sitting on top of the piled objects in the back of the pickup truck."
      },
      {
        "from": "human",
        "value": "What could be the possible reasons for the man sitting on top of the possessions in the back of the pickup truck?"
      },
      {
        "from": "gpt",
        "value": "There could be several reasons for the man sitting on top of his possessions in the back of the pickup truck:\n\n1. Moving: The man might be moving to a new location and needed to transport his items in a pickup truck, utilizing available space efficiently. By sitting on top of the belongings, he could be helping to stabilize and secure the items during the move, preventing them from falling or shifting during transportation.\n\n2. Lack of seating: If the cab of the pickup truck is already at full capacity or there isn't enough space for him to sit inside, the man may have chosen to sit on his possessions as an alternative seating arrangement.\n\n3. Road trip or outing: The man might be on a road trip or a casual outing with friends or family, where he is using the back of the pickup truck as an open-air seating area. By sitting on top of the loaded items, he may be enjoying the journey while savoring his beer.\n\n4. Keeping an eye on belongings: The man could be safeguarding his possessions by staying close to them, ensuring that no items are lost, stolen or damaged during the journey.\n\nRegardless of the specific reason, the image shows a person making the most of their situation, adding a touch of lightheartedness or adventure to an otherwise mundane scene."
      }
    ]
  },

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/955155.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

2023年创新药行业研究报告

第一章 行业概况 1.1 定义 根据《英国医学杂志》的定义&#xff0c;创新药物被定义为”完全或部分新的活性物质或生物实体&#xff0c;或者这些实体的组合&#xff0c;通过药理或分子机制对抗疾病&#xff0c;缓解症状&#xff0c;或预防疾病&#xff0c;以及作为可以改善病人…

Springboot启动异常 Command line is too long

Springboot启动异常 Command line is too long Springboot启动时直接报异常 Command line is too long. Shorten command line for xxxxxApplication or also for Spring Boot default解决方案: 修改 SystemApplication 的 Shorten command line&#xff0c;选择 JAR manife…

IDEA配置自动生成的类注释

天行健&#xff0c;君子以自强不息&#xff1b;地势坤&#xff0c;君子以厚德载物。 每个人都有惰性&#xff0c;但不断学习是好好生活的根本&#xff0c;共勉&#xff01; 文章均为学习整理笔记&#xff0c;分享记录为主&#xff0c;如有错误请指正&#xff0c;共同学习进步。…

Docker + Selenium Grid 搭建分布式 UI 自动化测试

Selenium Grid 介绍 Selenium Grid 是 selenium 提供的一个分布式测试工具&#xff0c;将自动化脚本发布到多个物理机或者虚拟机&#xff08;跨平台、跨浏览器&#xff09;上执行&#xff0c;通过一个中心节点来控制多个设备&#xff0c;也就是在中心节点&#xff08;hub&#…

显示本地 IP 地址和相应的 QR 码,方便用户共享和访问网络信息

这段代码使用了 wxPython、socket、qrcode 和 PIL&#xff08;Python Imaging Library&#xff09;模块来生成一个具有本地 IP 地址和相应 QR 码的窗口应用程序。 C:\pythoncode\new\showipgenqrcode.py 让我们逐行解释代码的功能&#xff1a; import wx&#xff1a;导入 wx…

并发控制:上下文、中断屏蔽和原子变量

一、上下文和并发场合 执行流&#xff1a;有开始有结束总体顺序执行的一段代码 又称上下文 应用编程&#xff1a;任务上下文 内核编程&#xff1a; 任务上下文&#xff1a;五状态 可阻塞 a. 应用进程或线程运行在用户空间 b. 应用进程或线程运行在内核空间&#xff08;通过调…

领导眼中的完美材料:撰写方法与注意事项解析

撰写为领导的材料&#xff0c;往往是一项富有挑战性的任务。领导的时间宝贵&#xff0c;对信息的需求精准&#xff0c;所以他们希望看到的材料要既准确又高效。但究竟如何撰写出领导眼中的“完美材料”呢&#xff1f;以下为你提供撰写方法与注意事项的深入解析&#xff1a; 理解…

美国访问学者签证有哪些要求?

近年来&#xff0c;越来越多的学者选择前往美国进行访问学者签证&#xff0c;以便深入研究、学术交流以及开展合作项目。美国访问学者签证是一个重要的工具&#xff0c;为学者们提供了在美国学术机构进行短期或长期学术活动的机会。下面知识人网将介绍一些申请美国访问学者签证…

浏览器输入URL后的执行过程

浏览器输入URL后&#xff0c;在结果返回浏览器前&#xff0c;主要有以下过程&#xff1a;1、用户输入网址后&#xff0c;浏览器发起DNS查询请求&#xff1b;2、建立TCP连接&#xff1b;3、发送HTTP请求&#xff1b;4、服务器处理请求&#xff1b;5、返回HTTP响应&#xff1b;6、…

JavaScript基本数组操作

在JavaScript中&#xff0c;内置了很多函数让我们可以去对数组进行操作&#xff0c;本文我们就来学习这些函数吧 添加元素 push ● push可以让我们在数组后面再添加一个数据&#xff0c;例如 const friends ["张三", "李四", "王五"]; frie…

winform嵌入浏览器 webView2

1、项目引用nuget 2、winform窗体中初始化 var webView new WebView2();webView.Source new Uri(url);webView.Dock DockStyle.Fill;//接收js调用c#函数的消息webView.WebMessageReceived CoreWebView2_WebMessageReceivedAsync; this.panel1.Controls.Add(…

机器学习笔记之最优化理论与方法(三)凸集的简单认识(下)

机器学习笔记之最优化理论与方法——凸集的简单认识[下] 引言回顾&#xff1a;基本定义——凸集关于保持集合凸性的运算仿射变换 凸集基本性质&#xff1a;投影定理点与凸集的分离支撑超平面定理 引言 继续凸集的简单认识(上)进行介绍&#xff0c;本节将介绍凸集的基本性质以及…

开开心心带你学习MySQL数据库

关于 MySQL 数据库~~ 数据库和数据结构的关系 数据结构,是一个学科,研究数据如何组织, 对于少量的数据,不需要组织…如果是大量的数据,就得好好组织起来,以便于后续进行增删查改!!!~~ 数据库,是一类软件,这个软件就是用来组织/保存/管理数据的. 组织这些数据也是为了后续进…

RHCE——十三、Shell自动化运维编程基础

Shell 一、为什么学习和使用Shell编程二、Shell是什么1、shell起源2、查看当前系统支持的shell3、查看当前系统默认shell4、Shell 概念 三、Shell 程序设计语言1、Shell 也是一种脚本语言2、用途 四、如何学好shell1、熟练掌握shell编程基础知识2、建议 五、Shell脚本的基本元素…

【历史上的今天】8 月 9 日:人工智能理论的奠基者诞生;鸿蒙 OS 发布;“云计算”概念被提出

整理 | 王启隆 图源&#xff1a;维基百科 透过「历史上的今天」&#xff0c;从过去看未来&#xff0c;从现在亦可以改变未来。 今天是 2023 年 8 月 9 日&#xff0c;在 1859 年的今天&#xff0c;电梯获得了专利。 用于运输货物和建筑材料的起重系统的想法自埃及文明以来就已…

小兔鲜商03

进入可视区加载数据&#xff1a; 首页有很多模块&#xff0c;如果一次性加载所有数据&#xff0c;很卡&#xff0c;&#xff0c;当移动到要显示的地方&#xff0c;才加载数据 使用 vueuse 库中 useIntersectionObserver方法&#xff0c;&#xff0c; 传入要监听的元素 target …

UE5打完包后,启动程序不能全屏

最近看到ue5的打包程序后不能默认自动全屏&#xff0c;效果如下&#xff0c;发现并不是全屏的&#xff0c;而且就算点击放大也不是全屏 解决办法&#xff1a;设置如下之后在打包就可以了 但是会一直打印错误的日志&#xff0c;不过这个不影响使用

【LeetCode算法系列题解】第1~5题

CONTENTS LeetCode 1. 两数之和&#xff08;简单&#xff09;LeetCode 2. 两数相加&#xff08;中等&#xff09;LeetCode 3. 无重复字符的最长子串&#xff08;中等&#xff09;LeetCode 4. 寻找两个正序数组的中位数&#xff08;困难&#xff09;LeetCode 5. 最长回文子串&am…

文献综述|针对图像描述模型的对抗样本攻击

前言&#xff1a;图像描述对抗攻击旨在通过攻击正常的图像描述模型&#xff0c;为正常输入图像添加扰动得到对抗样本&#xff0c;使得正常模型输出目标句子或目标关键词&#xff0c;现将当前相关工作大致汇总如下。本综述初写于2022年8月29日。 部分相关工作介绍 Shekhar 等在…

【使用DataEase数据可视化分析工具访问cpolar】

DataEase 是开源的数据可视化分析工具&#xff0c;帮助用户快速分析数据并洞察业务趋势&#xff0c;从而实现业务的改进与优化。是开源的数据可视化分析工具&#xff0c;帮助用户快速分析数据并洞察业务趋势&#xff0c;从而实现业务的改进与优化。 在本地搭建后,借助cpolar 内…