Transformers

news/2025/10/29 15:24:26/文章来源:https://www.cnblogs.com/lightsong/p/19174529

Transformers

https://huggingface.co/docs/transformers/main/index

Transformers acts as the model-definition framework for state-of-the-art machine learning models in text, computer vision, audio, video, and multimodal model, for both inference and training.

It centralizes the model definition so that this definition is agreed upon across the ecosystem. transformers is the pivot across frameworks: if a model definition is supported, it will be compatible with the majority of training frameworks (Axolotl, Unsloth, DeepSpeed, FSDP, PyTorch-Lightning, …), inference engines (vLLM, SGLang, TGI, …), and adjacent modeling libraries (llama.cpp, mlx, …) which leverage the model definition from transformers.

We pledge to help support new state-of-the-art models and democratize their usage by having their model definition be simple, customizable, and efficient.

There are over 1M+ Transformers model checkpoints on the Hugging Face Hub you can use.

Explore the Hub today to find a model and use Transformers to help you get started right away.

Explore the Models Timeline to discover the latest text, vision, audio and multimodal model architectures in Transformers.

 

Features

Transformers provides everything you need for inference or training with state-of-the-art pretrained models. Some of the main features include:

  • Pipeline: Simple and optimized inference class for many machine learning tasks like text generation, image segmentation, automatic speech recognition, document question answering, and more.
  • Trainer: A comprehensive trainer that supports features such as mixed precision, torch.compile, and FlashAttention for training and distributed training for PyTorch models.
  • generate: Fast text generation with large language models (LLMs) and vision language models (VLMs), including support for streaming and multiple decoding strategies.

 

Design

Read our Philosophy to learn more about Transformers’ design principles.

Transformers is designed for developers and machine learning engineers and researchers. Its main design principles are:

  1. Fast and easy to use: Every model is implemented from only three main classes (configuration, model, and preprocessor) and can be quickly used for inference or training with Pipeline or Trainer.
  2. Pretrained models: Reduce your carbon footprint, compute cost and time by using a pretrained model instead of training an entirely new one. Each pretrained model is reproduced as closely as possible to the original model and offers state-of-the-art performance.
HuggingFace Expert Acceleration Program

 

Learn

If you’re new to Transformers or want to learn more about transformer models, we recommend starting with the LLM course. This comprehensive course covers everything from the fundamentals of how transformer models work to practical applications across various tasks. You’ll learn the complete workflow, from curating high-quality datasets to fine-tuning large language models and implementing reasoning capabilities. The course contains both theoretical and hands-on exercises to build a solid foundational knowledge of transformer models as you learn.

 

https://huggingface.co/docs/transformers/main/chat_templating

Using apply_chat_template

The input to apply_chat_template should be structured as a list of dictionaries with role and content keys. The role key specifies the speaker, and the content key contains the message. The common roles are:

  • user for messages from the user
  • assistant for messages from the model
  • system for directives on how the model should act (usually placed at the beginning of the chat)

apply_chat_template takes this list and returns a formatted sequence. Set tokenize=True if you want to tokenize the sequence.

 
import torch
from transformers import AutoModelForCausalLM, AutoTokenizertokenizer = AutoTokenizer.from_pretrained("HuggingFaceH4/zephyr-7b-beta")
model = AutoModelForCausalLM.from_pretrained("HuggingFaceH4/zephyr-7b-beta", device_map="auto", dtype=torch.bfloat16)messages = [{"role": "system", "content": "You are a friendly chatbot who always responds in the style of a pirate",},{"role": "user", "content": "How many helicopters can a human eat in one sitting?"},]
tokenized_chat = tokenizer.apply_chat_template(messages, tokenize=True, add_generation_prompt=True, return_tensors="pt")
print(tokenizer.decode(tokenized_chat[0]))
 
<|system|>
You are a friendly chatbot who always responds in the style of a pirate</s>
<|user|>
How many helicopters can a human eat in one sitting?</s>
<|assistant|>

Pass the tokenized chat to generate() to generate a response.

 
outputs = model.generate(tokenized_chat, max_new_tokens=128) 
print(tokenizer.decode(outputs[0]))
 
<|system|>
You are a friendly chatbot who always responds in the style of a pirate</s>
<|user|>
How many helicopters can a human eat in one sitting?</s>
<|assistant|>
Matey, I'm afraid I must inform ye that humans cannot eat helicopters. Helicopters are not food, they are flying machines. Food is meant to be eaten, like a hearty plate o' grog, a savory bowl o' stew, or a delicious loaf o' bread. But helicopters, they be for transportin' and movin' around, not for eatin'. So, I'd say none, me hearties. None at all.

 

 

https://github.com/fanqingsong/LLM_transformer_helloworld

对话模型推理

# -*- coding: utf-8 -*-
"""
仅此文件允许考生修改:
- 请在下列函数的函数体内完成实现。
- 不要改动函数名与参数签名。
- 你可以新增少量辅助函数。
"""from typing import List
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM# ============================================================
# 第一部分:Prompt 定义
# ============================================================
def build_system_prompt() -> str:"""考生实现:定义 system prompt- 返回一个 system prompt,要求模型以"[Answer]: xxxx"的格式给出最终数值。System Prompt 的作用:1. 定义模型的身份和角色(数学助手)2. 指导模型的推理过程(逐步分析、解题思路)3. 规范模型的输出格式([Answer]: 数值)为什么要用 [Answer]: 格式?- 便于评测程序从模型输出中提取正确答案- 统一答案格式,避免模型输出过多解释性文字- 符合测试数据的标准格式要求"""# ======== 考生实现区域(可修改) ========# System Prompt 定义:指导模型如何回答数学问题# 关键点:必须包含 [Answer]: 格式的要求,这是评测程序提取答案的标准system_prompt = """你是一个数学助手,擅长解决各种数学问题。请仔细分析问题,逐步推理,并最终以 [Answer]: 数值 的格式给出答案。要求:
1. 仔细阅读题目,理解题意
2. 逐步分析解题思路
3. 进行必要的计算
4. 最终答案必须以 [Answer]: 数值 的格式给出请开始解题。"""return system_prompt# ======== 考生实现区域(可修改) ========# ============================================================
# 第二部分:模板拼装
# ============================================================
def apply_chat_template_single(tokenizer: AutoTokenizer,system_prompt: str,problem: str,
) -> str:"""考生实现:将单个问题转换为模型输入文本- 使用 tokenizer.apply_chat_template 构造对话- 返回拼装好的文本字符串参数说明:tokenizer: Qwen3 模型的 tokenizer,包含特殊 token 和模板定义system_prompt: 系统提示词,定义模型角色和输出格式problem: 用户问题(如 "12 + 35")返回值:完整格式化后的对话文本,包含 system、user、assistant 标记Chat Template 的作用:transformers 库的 tokenizer.apply_chat_template 会根据模型类型自动构造符合该模型预期的对话格式。对于 Qwen 模型,它会把 messages 列表转换为:<|system|>你是一个数学助手...<|user|>12 + 35<|assistant|>这样的格式。"""# ======== 考生实现区域(可修改) ========# 构造消息列表:包含系统提示和用户问题# 消息格式:每个消息是一个字典,包含 role(角色)和 content(内容)# - "system": 定义模型行为# - "user": 用户输入的问题messages = [{"role": "system", "content": system_prompt},{"role": "user", "content": problem},]# 应用聊天模板,将消息列表转换为模型可理解的文本格式rendered = tokenizer.apply_chat_template(messages,                      # 消息列表tokenize=False,                # 不进行 tokenize,返回原始字符串而不是 token IDs# 这样可以在调试时看到完整的文本内容add_generation_prompt=True,    # 添加 <|assistant|> 标记,引导模型生成回复# 如果没有这个标记,模型不知道要在哪里开始生成enable_thinking=True,          # 启用思考标签支持# 允许模型输出 <think>...</think># 模型会在 <> 标签内进行推理,评测程序会自动移除这部分内容
    )return rendered# ======== 考生实现区域(可修改) ========# ============================================================
# 第三部分:核心推理实现
# ============================================================
def generate_single(model: AutoModelForCausalLM,tokenizer: AutoTokenizer,rendered_text: str,max_new_tokens: int,do_sample: bool,
) -> torch.Tensor:"""考生实现:单条推理- 将文本 tokenize 后送入模型生成- 返回包含输入和输出的完整 token 序列参数说明:model: Qwen3 预训练模型,用于文本生成tokenizer: 用于将文本转换为 token IDsrendered_text: 已格式化的完整对话文本(包含 system、user、assistant 标记)max_new_tokens: 生成的最大新 token 数量(不包括输入长度)do_sample: 是否使用采样(True=随机采样,False=贪心解码)返回值:torch.Tensor,形状为 [1, seq_len],包含输入+新生成的完整序列注意事项:1. 返回的是包含输入的完整序列(evaluate.py 会提取新生成的部分)2. 使用 .to(model.device) 确保输入在正确的设备上(CPU/GPU/NPU)3. 使用 model.generate() 的默认参数,模型会自动处理特殊 token"""# ======== 考生实现区域(可修改) ========# 步骤 1:将文本编码为 token IDs# - tokenizer.encode() 将字符串转换为整数列表# - return_tensors="pt" 返回 PyTorch 张量# - .to(model.device) 将张量移动到模型所在的设备(CPU/GPU/NPU)inputs = tokenizer.encode(rendered_text, return_tensors="pt").to(model.device)# 步骤 2:使用模型生成文本# - model.generate() 会自动生成新的 token# - 返回的 outputs 包含完整的序列:输入 + 新生成的 token# - 评测程序会从 outputs 中提取新生成的部分outputs = model.generate(inputs,                        # 输入 token IDsmax_new_tokens=max_new_tokens, # 最多生成多少个新 tokendo_sample=do_sample,          # 采样模式:True=随机采样(更灵活),False=贪心(更确定)
    )return outputs# ======== 考生实现区域(可修改) ========def generate_batch(model: AutoModelForCausalLM,tokenizer: AutoTokenizer,rendered_texts: List[str],max_new_tokens: int,do_sample: bool,
) -> List[torch.Tensor]:"""考生实现:批量推理- 一次处理多个问题,提高效率- 返回所有批次的输出列表参数说明:model: Qwen3 预训练模型tokenizer: 用于编码文本rendered_texts: 多个已格式化的对话文本列表max_new_tokens: 生成的最大新 token 数量do_sample: 是否使用采样返回值:List[torch.Tensor],每个元素是一个批次的输出批次形状为 [batch_size, seq_len]批量处理的优势:1. 并行处理:GPU 可以同时处理多条数据2. 减少数据传输:一次 GPU 调用处理多条3. 提高吞吐量:相比逐条处理能获得 3+ 倍加速实现要点:1. 使用循环分批处理,避免一次性处理过多数据导致内存溢出2. 使用 padding=True 确保同一批次内序列长度一致3. 使用 attention_mask 告诉模型哪些 token 是 padding,哪些是真实内容4. 使用 torch.no_grad() 节省显存(推理时不需要梯度)"""# ======== 考生实现区域(可修改) ========
    all_outputs = []  # 存储所有批次的输出batch_size: int = 4  # 批次大小:一次处理 4 条数据# 可以调整:太小效率低,太大可能内存不足# 循环处理:每次处理一个批次# range(0, len(rendered_texts), batch_size) 生成:0, 4, 8, 12, ...for i in range(0, len(rendered_texts), batch_size):# 提取当前批次:rendered_texts[i:i+batch_size]# 例如:如果 i=0, batch_size=4,则提取第 0, 1, 2, 3 条batch_texts = rendered_texts[i:i + batch_size]# 步骤 1:对批次进行编码和填充# tokenizer() 可以将多条文本同时编码,并自动填充到相同长度# - batch_texts: 多条文本(列表)# - padding=True: 短序列会填充到和最长序列一样长# - truncation=True: 超长序列会被截断# - 返回的 inputs 包含 input_ids 和 attention_maskinputs = tokenizer(batch_texts,               # 多条文本(如 ["问题1", "问题2", "问题3", "问题4"])return_tensors="pt",        # 返回 PyTorch 张量padding=True,              # 自动填充到相同长度truncation=True            # 超长序列截断(防止溢出)).to(model.device)             # 移动到模型设备# 步骤 2:批量生成文本# 使用 torch.no_grad() 禁用梯度计算,节省显存并提高速度
        with torch.no_grad():outputs = model.generate(inputs.input_ids,        # 编码后的 token IDs,形状 [batch_size, seq_len]attention_mask=inputs.attention_mask,  # 注意力掩码,标记哪些是真实内容(1),哪些是填充(0)max_new_tokens=max_new_tokens,  # 最多生成多少个新 tokendo_sample=do_sample,     # 采样模式pad_token_id=tokenizer.eos_token_id  # 指定填充 token 的 ID# 注意:这里没有使用 pad_token_id=tokenizer.pad_token_id# 因为 Qwen 模型可能没有 pad_token,使用 eos_token_id 作为替代
            )# 将当前批次的输出添加到总结果中
        all_outputs.append(outputs)# 返回所有批次的输出列表# 例如:如果 10 条数据分成 3 批,则返回 [batch1_output, batch2_output, batch3_output]# evaluate.py 会将这些批次的结果合并到一起return all_outputs# ======== 考生实现区域(可修改) ========

 

嵌入模型

# -*- coding: utf-8 -*-
"""
仅此文件允许考生修改:
- 请在下列函数的函数体内完成实现。
- 不要改动函数名与参数签名。
- 你可以新增少量辅助函数。
"""import torch
import torch.nn.functional as F
from transformers import AutoTokenizer, AutoModel# ============================================================
# 相似度计算函数
# ============================================================
def student_compute_similarity(text1: str, text2: str, model: AutoModel, tokenizer: AutoTokenizer) -> float:"""考生实现:计算两个文本之间的相似度参数:text1: 第一个文本字符串(如 "12 + 35")text2: 第二个文本字符串(如 "35 + 12")model: 预加载的 Qwen3-Embedding 模型(评测程序提供)tokenizer: 预加载的 tokenizer(评测程序提供)返回:相似度值(0.0 到 1.0 之间的浮点数)1.0 表示完全相同,0.0 表示完全不同要求:- 使用传入的 model 和 tokenizer,不要自己加载模型- 实现 last-token pooling(取最后一个 token 的隐藏状态作为句子表示)- 必须使用左侧 padding(padding_side="left")- L2 归一化(将向量标准化为单位向量)- 计算余弦相似度(归一化向量的点积)- 不得使用 sentence_transformers相似度计算原理:1. 将文本编码为向量(embedding)2. Last-token pooling:取最后一个 token 的隐藏状态作为句子表示3. L2 归一化:将向量标准化为单位向量4. 余弦相似度:计算两个归一化向量的点积(cos(θ) 的值域为 [-1, 1])为什么使用 last-token pooling?- Embedding 模型在训练时,最后一个 token 包含了整个句子的语义信息- 相比平均 pooling 或 CLS token,last-token 能更好地捕捉句子级语义"""# ======== 考生实现区域(可修改) ========# 步骤 1:获取模型所在的设备(CPU/GPU/NPU)# next(model.parameters()) 获取模型的第一个参数,.device 获取其设备# 这样可以确保输入张量与模型在同一设备上device = next(model.parameters()).device# 步骤 2:准备输入文本列表# 将两个文本放入列表,以便批量处理texts = [text1, text2]# 步骤 3:使用 tokenizer 编码文本# padding=True: 将短序列填充到最长序列的长度# truncation=True: 超长序列截断到 max_length# max_length=512: 最大序列长度(典型的 BERT 等模型长度)# return_tensors="pt": 返回 PyTorch 张量# padding_side="left": 在左侧填充(重要!)#   为什么使用左侧 padding?#   - 因为使用 last-token pooling,我们需要保证最后一个 token 是真实的文本 token#   - 如果在右侧 padding,最后一个 token 会是填充 token,失去语义信息inputs = tokenizer(texts,                      # 文本列表:["12 + 35", "35 + 12"]padding=True,              # 自动填充到相同长度truncation=True,            # 超长序列截断max_length=512,            # 最大长度return_tensors="pt",        # 返回 PyTorch 张量padding_side="left"         # 关键:左侧填充).to(device)                    # 移动到模型设备# 步骤 4:获取模型输出的嵌入向量# 使用 torch.no_grad() 禁用梯度计算,节省显存并提高速度
    with torch.no_grad():# 模型前向传播:输入 token IDs,输出隐藏状态# outputs.last_hidden_state 形状: [batch_size=2, seq_len, hidden_dim]outputs = model(**inputs)# Last-token pooling:取最后一个 token 的隐藏状态作为句子表示# last_hidden_state 形状: [2, seq_len, hidden_dim]# 例如:[[[token1], [token2], [token3]], [[token4], [token5], [token6]]]# [:, -1, :] 表示取每一行的最后一个 token# embeddings 形状: [2, hidden_dim]# 例如:[[token3], [token6]]last_hidden_state = outputs.last_hidden_stateembeddings = last_hidden_state[:, -1, :]  # 索引 -1 表示最后一个元素# 步骤 5:L2 归一化# 将向量标准化为单位向量(长度为 1)# 公式:v_normalized = v / ||v||# F.normalize(..., p=2, dim=1):#   - p=2: 使用 L2 范数(欧氏距离)#   - dim=1: 在 hidden_dim 维度上归一化# 归一化后的向量满足:||v|| = 1# embeddings 形状保持不变: [2, hidden_dim]embeddings = F.normalize(embeddings, p=2, dim=1)# 步骤 6:计算余弦相似度# 对于归一化的向量 a, b,余弦相似度 = a · b(点积)# 如果 a 和 b 都是单位向量,则 cos(θ) = a · b# - 如果 a 和 b 完全相同:a · b = 1# - 如果 a 和 b 垂直:a · b = 0# - 如果 a 和 b 相反:a · b = -1# torch.dot(a, b) 计算向量点积# .item() 将标量张量转换为 Python float# embeddings[0] 是 text1 的嵌入,embeddings[1] 是 text2 的嵌入similarity = torch.dot(embeddings[0], embeddings[1]).item()# similarity 的范围:[0, 1],因为所有向量都是正方向(经过归一化后的嵌入向量)return similarity# ======== 考生实现区域(可修改) ========def compute_similarity(text1: str, text2: str, model: AutoModel, tokenizer: AutoTokenizer) -> float:"""评测程序调用的接口函数"""return student_compute_similarity(text1, text2, model, tokenizer)

 

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

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

相关文章

macOS 终端配置全攻略:zsh、bash_profile、zprofile、zshrc 到 nvm 安装的完整科普

pre { white-space: pre !important; word-wrap: normal !important; overflow-x: auto !important; display: block !important; font-family: "Consolas", "Monaco", "Courier New", …

2025年口碑好的冲孔铝单板公司排名前十推荐

文章摘要 冲孔铝单板作为建筑幕墙和室内装饰的重要材料,2025年行业预计保持10%年增长率,得益于绿色建筑政策和城市化进程。本文基于市场调研、用户评价和行业数据,精选出口碑好的冲孔铝单板公司排名,旨在为工程商、…

工作室项目管理系统开发常用命令

PHP相关 composer包更新 composer install --optimize-autoloader --no-dev Lumen相关 php artisan config:cache php artisan route:cacheu-boot下载地址: ftp://ftp.denx.de/pub/u-boot/ linux内核下载地址: htt…

《导航切换》案例

通过该案例,我们可以熟练掌握以下知识点 ● 使用页Tabs组件进行页面导航 ● Swiper组件实现轮播图、 ● Grid网格布局 ● 以及List列表布局 ● 结构化数据封装 ● 路由页面切换 1.页面效果 点击登录之后就会进入首页,…

技术探究:Air8000工业引擎赋能的WiFi AP文件管理系统实现剖析!

本文对Air8000工业引擎支撑下的WiFi AP文件管理系统实现方法进行了详尽说明。用户只需经过简单的设置和操作,即可将设备化身为轻量级文件服务器,便捷实现文件远程访问及下载,优化工业环境的数据交互体验。 一、WiFi…

iOS 26 内存占用监控 多工具协同下的性能稳定性分析实战

本文聚焦 iOS 26 内存占用监控,介绍如何使用 KeyMob(克魔)、Xcode Instruments、Console、iMazing 等工具组合,构建真机内存监控、系统日志分析与能耗对比的全链路体系,实现 iOS 26 下应用内存优化与性能稳定性提…

图像处理效率神器:光影魔术手 4.7.2,小白也能秒出专业效果

在图像处理工具层出不穷的当下,一款操作简单、功能实用且免费的软件,始终是摄影爱好者、电商运营和办公文员的刚需。光影魔术手 4.7.2 恰好击中这一需求,以 “零门槛操作 + 专业级效果” 为核心,成为各类用户的照片…

2025年太原办理防爆3C认证服务商权威推荐榜单:内蒙古防爆3C认证/呼和浩特办理防爆CCC认证/辽宁申请防爆3C认证机构精选

在工业安全领域,防爆3C认证作为强制性产品认证的重要环节,直接关系到防爆设备的安全性能和市场准入资格。据统计,2024年山西省防爆产品认证需求较去年同期增长23.5%,其中太原地区占比达到全省认证需求的45%。本文将…

2025年250型压滤机滤布定制厂家权威推荐榜单:380型压滤机滤布/500型压滤机滤布/870型压滤机滤布源头厂家精选

在工业过滤领域,250型压滤机作为一种广泛应用的标准设备,其滤布质量直接影响过滤效率、滤饼含水率及运营成本。一款优秀的滤布能在相同压力条件下,提升过滤效率20%-35%,同时降低15%8%的维护成本。 当前市场呈现高品…

【IEEE出版|往届EI检索】第二届智能驾驶与智慧交通国际学术会议(IDST 2025)

智能驾驶和智慧交通利用新兴技术,使城市出行更加方便、更具成本效益且更安全。在此背景下,由浙江工业大学主办、米兰理工大学和罗马第三大学联合承办的第二届智能驾驶与智慧交通国际学术会议(IDST 2025)将于2025年…

玖奇脑筋急转弯问答版小程序:趣味互动新选择

一、概述总结 玖奇脑筋急转弯问答版是一款专为微信小程序打造的趣味互动应用,由玖奇软件工作室开发。产品以经典脑筋急转弯问答为核心,凭借轻松有趣的内容形式吸引用户参与,支持在线交付且源码未加密,购买后可享受…

忍痛割爱,Spring Boot 宣布移除 Undertow!!

大家好,我是R哥。 Spring Boot 4.0.0-RC1 最近发布了,虽然还没有发布正式版,但从最新的《Spring Boot 4.0 迁移指南》中发现,Spring Boot 4.0 已经移除了对 Undertow 嵌入式 Servlet 容器的支持。Spring Boot 4.0+…

Git 免密认证:Git Credential Helper

提到 Git 免密,也许大多数人会想到 SSH。但是当 SSH 不可用的时候怎么办? 比如你没有提交 SSH 公钥的权限。 又比如自建的 Git,如果所有域名都在 Cloudflare 的保护下,不想暴露 ip 地址,就只能用 https。(PS: 这种…

类和对象-对象的特性project4

构造函数和析构函数project4 filename01 对象的初始化和清理 c++利用了构造函数和析构函数解决上述问题 这两个函数将会被编译器自动调用 完成对象初始化和清理工作 对象的初始化和清理说编译器强制要我们做的事情,因…

人人聘招聘系统:多端协同的企业招聘解决方案

一、概述总结 人人聘招聘系统是由深圳市润情信息科技有限公司自主研发的多城市运营招聘平台搭建工具,拥有计算机软件著作权登记证书,具备合法合规的产品资质。系统支持微信小程序形态,通过微擎系统在线交付,采用 T…

喵喵估价回收系统:一站式闲置回收解决方案,赋能回收行业数字化升级

一、概述总结 喵喵估价回收系统是基于 ThinkPHP 和 uni-app 开发的全场景回收行业解决方案,支持微信小程序、支付宝小程序、H5 网页、安卓及 iOS 多平台部署。系统提供在线估价、快速下单、报价单生成、门店与邮寄回收…

向量数据库chroma

概述# Chroma 是向量数据库,存向量用的。拥有针对向量的查询能力,根据向量的距离远近查询,这一点和传统数据库不一样。 安装与简单使用# 用 pip install chromadb 命令安装。 为了创建数据库实例,先要创建一个 cli…

云原生向量数据库Milvus知识大全,看完这篇就够了[基本概念、系统架构、主要组件、应用场景]

1.Milvus简介 1.1什么是 Milvus Milvus 是一款云原生向量数据库,它具备高可用、高性能、易拓展的特点,用于海量向量数据的实时召回。 Milvus 基于 FAISS、Annoy、HNSW 等向量搜索库构建,核心是解决稠密向量相似度检…

测试数据准备难题?一个Dify工作流,让你告别“巧妇难为无米之炊”

关注 霍格沃兹测试学院公众号,回复「资料」, 领取人工智能测试开发技术合集 在软件测试领域,我们经常面临“巧妇难为无米之炊”的困境——再完善的测试用例,没有合适的测试数据也是徒劳。据统计,测试工程师平均花费…

如何使用 vxe-table 展开行实现展开子表父子表格

如何使用 vxe-table 展开行实现展开子表父子表格 查看官网:https://vxetable.cn gitbub:https://github.com/x-extends/vxe-table gitee:https://gitee.com/x-extends/vxe-table<template><div><vxe…