当前位置: 首页 > news >正文

帮别人做网站怎么接单国内真正的永久免费砖石

帮别人做网站怎么接单,国内真正的永久免费砖石,有几个网站如何做外贸,电脑网站首页设计本地部署 Llama-3-EvoVLM-JP-v2 0. 引言1. 关于 Llama-3-EvoVLM-JP-v22. 本地部署2-0. 克隆代码2-1. 安装依赖模块2-2. 创建 Web UI2-3.启动 Web UI2-4. 访问 Web UI 0. 引言 Sakana AI 提出了一种称为进化模型合并的方法,并使用该方法创建大规模语言模型&#xff…

本地部署 Llama-3-EvoVLM-JP-v2

  • 0. 引言
  • 1. 关于 Llama-3-EvoVLM-JP-v2
  • 2. 本地部署
    • 2-0. 克隆代码
    • 2-1. 安装依赖模块
    • 2-2. 创建 Web UI
    • 2-3.启动 Web UI
    • 2-4. 访问 Web UI

0. 引言

Sakana AI 提出了一种称为进化模型合并的方法,并使用该方法创建大规模语言模型(LLM )、视觉语言模型(VLM)和图像生成模型,他们创建了具有各种功能的合并模型。这次,他们发布了一个新的日本 VLM,Llama-3-EvoVLM-JP-v2,它利用进化模型合并来实现多个图像的问答。此外,为了评估构建的模型,他们还将发布一个数据集:日语多图像视觉问答(JA-Multi-Image-VQA),以评估用日语回答有关多个图像的问题的能力。

1. 关于 Llama-3-EvoVLM-JP-v2

VLM研究LLM它是发展最快的领域之一。最近,VLM的研究不断取得进展,不仅提高了单图像描绘和问答的性能,而且还具备处理视频和多图像的能力。另一方面,这种新型的VLM主要是在英语国家开发的,在非英语国家仍然基本上不存在。日语也是如此;虽然已经开发了几种日语VLM,但这种类型的尖端VLM仍然不多。因此,Sakana AI 使用进化模型融合来创建这种新型的英语 VLM 和日语 VLM。他们认为通过合并这些LLM,他们可以快速构建一个尖端的日本 VLM。

在构建新的VLM时,底层模型是开源模型。LLM其中,他们选择了Llama-3,它具有高性能,并且各种额外训练的模型都是公开的。有几种使用 Llama-3 创建的高性能 VLM,但Mantis-8B-SigLIP-Llama-3是一种前所未有的 VLM,可以将输入图像放置在我选择的输入文本中的任何位置。高性能日语培训,帮助学生获得日语能力。LLM他们使用Llama-3-ELYZA-JP-8B 。首先,通过合并这两个模型,他们成功构建了“可以处理多个图像的日本 VLM”。此外,他们还添加了一个名为Bunny-v1.1-Llama-3-8B-V的高性能英文VLM来增强图像渲染能力。LLM这些部件也被添加到合并中。

2. 本地部署

2-0. 克隆代码

git clone https://huggingface.co/spaces/SakanaAI/Llama-3-EvoVLM-JP-v2; cd Llama-3-EvoVLM-JP-v2

2-1. 安装依赖模块

pip install git+https://github.com/TIGER-AI-Lab/Mantis.git

2-2. 创建 Web UI

# webui.py
import gradio as gr
import time
import subprocessimport torchfrom models.mllava import (MLlavaProcessor,LlavaForConditionalGeneration,prepare_inputs,
)
from models.conversation import Conversation, SeparatorStyle
from transformers import TextIteratorStreamer
from transformers.utils import is_flash_attn_2_available
from threading import Threaddevice = "cuda" if torch.cuda.is_available() else "cpu"
IMAGE_TOKEN = "<image>"
generation_kwargs = {"max_new_tokens": 1024,"num_beams": 1,"do_sample": False,"no_repeat_ngram_size": 3,
}if not is_flash_attn_2_available():subprocess.run('pip install flash-attn --no-build-isolation', env={'FLASH_ATTENTION_SKIP_CUDA_BUILD': "TRUE"},shell=True)processor = MLlavaProcessor.from_pretrained("TIGER-Lab/Mantis-8B-siglip-llama3")
processor.tokenizer.pad_token = processor.tokenizer.eos_tokenmodel = LlavaForConditionalGeneration.from_pretrained("SakanaAI/Llama-3-EvoVLM-JP-v2",torch_dtype=torch.float16,attn_implementation="flash_attention_2",device_map=device,
).eval()# Set the system prompt
conv_template = Conversation(system="<|start_header_id|>system<|end_header_id|>\n\nあなたは誠実で優秀な日本人のアシスタントです。特に指示が無い場合は、常に日本語で回答してください。",roles=("user", "assistant"),messages=(),offset=0,sep_style=SeparatorStyle.LLAMA_3,sep="<|eot_id|>",
)def get_chat_messages(history):chat_history = []user_role = conv_template.roles[0]assistant_role = conv_template.roles[1]for i, message in enumerate(history):if isinstance(message[0], str):chat_history.append({"role": user_role, "text": message[0]})if i != len(history) - 1:assert message[1], "The bot message is not provided, internal error"chat_history.append({"role": assistant_role, "text": message[1]})else:assert not message[1], "the bot message internal error, get: {}".format(message[1])chat_history.append({"role": assistant_role, "text": ""})return chat_historydef get_chat_images(history):images = []for message in history:if isinstance(message[0], tuple):images.extend(message[0])return imagesdef add_message(history, message):return history, gr.MultimodalTextbox(interactive=False)def bot(history, message):images = message["files"] if message["files"] else Nonetext = message["text"].strip()if not text:raise gr.Error("You must enter a message!")num_image_tokens = text.count(IMAGE_TOKEN)# modify textif images and num_image_tokens < len(images):if num_image_tokens != 0:gr.Warning("The number of images uploaded is more than the number of <image> placeholders in the text. Will automatically prepend <image> to the text.")# prefix image tokenstext = IMAGE_TOKEN * (len(images) - num_image_tokens) + textif images and num_image_tokens > len(images):raise gr.Error("The number of images uploaded is less than the number of <image> placeholders in the text!")current_messages = []if images:current_messages += [[(image,), None] for image in images]if text:current_messages += [[text, None]]current_history = history + current_messages# chat_messages = get_chat_messages(current_history)# chat_images = get_chat_images(current_history)chat_messages = get_chat_messages(current_messages)chat_images = get_chat_images(current_messages)# Generate!inputs = prepare_inputs(None, chat_images, model, processor, history=chat_messages, **generation_kwargs)streamer = TextIteratorStreamer(processor, skip_prompt=True, skip_special_tokens=True)inputs["streamer"] = streamerthread = Thread(target=model.generate, kwargs=inputs)thread.start()buffer = ""for new_text in streamer:buffer += new_texttime.sleep(0.01)# yield buffercurrent_history[-1] = (current_history[-1][0], buffer)yield current_historyexamples = [{"text": "1番目と2番目の画像に写っている動物の違いは何ですか?簡潔に説明してください。","files": ["./examples/image_0.jpg", "./examples/image_1.jpg"],},{"text": "2枚の写真について、簡単にそれぞれ説明してください。","files": ["./examples/image_2.jpg", "./examples/image_3.jpg"],},
]with gr.Blocks(fill_height=True) as demo:chatbot = gr.Chatbot(elem_id="chatbot",bubble_full_width=False,scale=1,)chat_input = gr.MultimodalTextbox(interactive=True,file_types=["image"],placeholder="Enter message or upload images. Please use <image> to indicate the position of uploaded images",show_label=True,render=True,)examples = gr.Examples(examples, [chat_input], [])chat_msg = chat_input.submit(add_message, [chatbot, chat_input], [chatbot, chat_input])bot_msg = chat_msg.then(bot, [chatbot, chat_input], chatbot, api_name="bot_response")bot_msg.then(lambda: gr.MultimodalTextbox(value=None, interactive=True), None, [chat_input])demo.queue().launch()

2-3.启动 Web UI

python webui.py

2-4. 访问 Web UI

使用浏览器打开 http://localhost:7860,

在这里插入图片描述
完结!

http://www.mmbaike.com/news/31236.html

相关文章:

  • 佛山新网站建设特色市场营销咨询
  • 政府门户网站建设发展的看法泰安seo公司
  • 静态网站后台百度人工服务24小时
  • wordpress nice主题seo综合查询怎么进入网站
  • 怎么与其他网站做友情链接今天的新闻联播
  • 郑州郑东新区网站建设做专业搜索引擎优化
  • 泰州网站建设解决方案爱站网ip反查域名
  • 百度云wordpress教程视频教程天津百度seo推广
  • wordpress一键搭建脚本seo查询 站长工具
  • wordpress做电影网站启动互联全网营销推广
  • 外贸网站建设内容包括营销网站案例
  • wordpress wpqueryseo关键词优化的技巧
  • 潍坊建站模板搭建短视频营销推广方式
  • 做哪些网站不受法律保护网络营销和传统营销有什么区别
  • 镇江建设工程质量监督局网站网络推广都是收费
  • 贵州省赤水市代码武汉seo价格
  • 全网展示型网站建设汕头网站建设优化
  • 重庆网站建设流程太原seo顾问
  • 动态网站建设期末考试企业网站模板下载
  • 网站建设委托开发合同seo关键词优化如何
  • lnmp 网站开发总结百度竞价推广一个月多少钱
  • 做网页的网站国际新闻今日头条
  • wordpress+编辑器+空格搜索引擎优化网站的网址
  • 通州 网站建设关键词资源
  • 利用手机搭建网站今日小说排行榜百度搜索榜
  • 网站编辑超链接怎么做酒店营销推广方案
  • 一张图片做单页网站郑州seo优化阿亮
  • 网站建设亮点广东网络seo推广公司
  • 建程网会员硬件优化大师下载
  • 建材网站建设徐州seo排名公司