如何快速上手NVIDIA llama-nemotron-embed-vl-1b-v2-fp8:5分钟搭建多模态检索系统
如何快速上手NVIDIA llama-nemotron-embed-vl-1b-v2-fp85分钟搭建多模态检索系统【免费下载链接】llama-nemotron-embed-vl-1b-v2-fp8项目地址: https://ai.gitcode.com/hf_mirrors/nvidia/llama-nemotron-embed-vl-1b-v2-fp8NVIDIA llama-nemotron-embed-vl-1b-v2-fp8是一款专为多模态问答检索设计的量化模型基于Eagle VLM架构融合Llama 3.2 1B语言模型与SigLip2 400M图像编码器能将文本和图像转化为2048维的嵌入向量适用于构建高效的多模态检索系统。 为什么选择这款模型核心优势多模态支持同时处理文本、文档图像如PDF页面、图表、表格高效量化FP8量化版本显存占用降低50%推理速度提升30%高精度保留与BF16版本相比检索精度保持99%以上config.json即插即用支持vLLM部署5分钟即可完成系统搭建适用场景智能文档检索系统支持图文混合内容多模态知识库构建RAG检索增强生成应用跨模态内容推荐⚙️ 环境准备3分钟硬件要求NVIDIA GPU推荐H100/A100最低T4至少8GB显存快速安装# 克隆仓库 git clone https://gitcode.com/hf_mirrors/nvidia/llama-nemotron-embed-vl-1b-v2-fp8 cd llama-nemotron-embed-vl-1b-v2-fp8 # 安装依赖 pip install vllm transformers torch pillow sentence-transformers 基础使用教程1. 启动vLLM服务创建聊天模板文件并启动服务# 创建聊天模板 cat nemotron-embed-vl.jinja JINJA {%- if messages | length 1 -%} {{ raise_exception(Embedding models should only embed one message at a time) }} {%- endif -%} {% set vars namespace(prefix, images[], texts[]) %} {%- for message in messages -%} {%- if message[role] query -%} {%- set vars.prefix query: %} {%- elif message[role] document -%} {%- set vars.prefix passage: %} {%- endif -%} {%- for content in message[content] -%} {%- if content[type] text -%} {%- set vars.texts vars.texts [content[text]] %} {%- elif content[type] image -%} {%- set vars.images vars.images [image ] %} {%- endif -%} {%- endfor -%} {%- endfor -%} {{- bos_token }}{{ vars.prefix }}{{ (vars.images vars.texts) | join() }} JINJA # 启动vLLM服务 vllm serve nvidia/llama-nemotron-embed-vl-1b-v2-fp8 \ --trust-remote-code \ --max-model-len 10240 \ --chat-template nemotron-embed-vl.jinja2. 生成嵌入向量Python示例文本查询嵌入import requests url http://localhost:8000/v1/embeddings # 文本查询嵌入请求 response requests.post(url, json{ model: nvidia/llama-nemotron-embed-vl-1b-v2-fp8, messages: [ { role: query, content: [{type: text, text: AI如何提升机器人的智能和能力}] } ], }) query_embedding response.json()[data][0][embedding] print(f查询向量维度: {len(query_embedding)}) # 输出: 2048文档图像嵌入# 图像文档嵌入请求 response requests.post(url, json{ model: nvidia/llama-nemotron-embed-vl-1b-v2-fp8, messages: [ { role: document, content: [{type: image_url, image_url: {url: path/to/your/document.png}}] } ], }) image_embedding response.json()[data][0][embedding]混合模态嵌入图像文本# 图像文本混合嵌入 response requests.post(url, json{ model: nvidia/llama-nemotron-embed-vl-1b-v2-fp8, messages: [ { role: document, content: [ {type: image_url, image_url: {url: path/to/chart.png}}, {type: text, text: AI使机器人能够自主感知、规划和行动。} ] } ], }) multimodal_embedding response.json()[data][0][embedding] 性能评估根据官方测试数据FP8量化版本在保持高精度的同时显著提升效率输入模态综合准确率中文/韩文英文/法文图像文本99.32%98.42%99.55%仅图像99.07%98.21%99.20%仅文本99.61%101%99.25%数据来源README.md中的评估结果⚠️ 注意事项输入限制文本最大长度10240 tokens图像处理最多6个图像块1个缩略图约1792视觉tokens部署建议使用--max-model-len 10240支持全模态输入纯文本/纯图像输入可使用2048以提高效率兼容性需使用transformers 4.56.0或4.53.x避免4.54.0-4.55.x版本的Flash Attention bug支持的GPU架构Blackwell、Hopper、Lovelace 许可证信息本模型遵循NVIDIA Open Model License Agreement可用于商业用途。 深入了解模型架构细节modeling_llama_nemotron_vl.py配置参数说明configuration_llama_nemotron_vl.py处理器配置processor_config.json【免费下载链接】llama-nemotron-embed-vl-1b-v2-fp8项目地址: https://ai.gitcode.com/hf_mirrors/nvidia/llama-nemotron-embed-vl-1b-v2-fp8创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考