Llama 3.1 - 405B, 70B 和 8B,支持多语言和长上下文

发布于 2024 年 7 月 23 日
在 GitHub 上更新

Llama 3.1 发布了!今天,Llama 家族的最新成员正式入驻 Hugging Face。我们很高兴与 Meta 合作,以确保在 Hugging Face 生态系统中实现最佳集成。Hub 上提供了八个开放权重模型(3 个基础模型和 5 个微调模型)。

Llama 3.1 有三种尺寸:8B 用于在消费级 GPU 上高效部署和开发,70B 用于大规模 AI 原生应用,405B 用于合成数据、作为法官的 LLM 或蒸馏。所有三种尺寸都有基础版和指令调优版。

除了这六个生成模型之外,Meta 还发布了两个新模型:Llama Guard 3 和 Prompt Guard。Prompt Guard 是一个小型分类器,用于检测提示注入和越狱。Llama Guard 3 是一个安全模型,可以对 LLM 输入和生成进行分类。

在发布的功能和集成中,我们有:

  • Hub 上的模型
  • Hugging Face Transformers 和 TGI 集成
  • Hugging Chat 与 Meta Llama 3.1 405B Instruct 集成
  • 推理和部署与推理端点、Google Cloud、Amazon SageMaker 和 DELL Enterprise Hub 集成
  • FP8、AWQ 和 GPTQ 量化,简化推理
  • 使用 🤗 TRL 在单个 GPU 上微调 Llama 3.1 8B
  • 使用 Llama 3.1 70B 和 405B 以及 Distilabel 生成合成数据

目录

Llama 3.1 有哪些新功能?

为什么 Llama 3.1 如此令人兴奋?除了前代产品提供的功能之外,Llama 3.1 还有一些关键的新功能:

  • 128K token 的大上下文长度(原版为 8K)
  • 多语言能力
  • 工具使用能力
  • 一个非常大的密集模型,包含 4050 亿个参数
  • 更宽松的许可证

让我们深入了解这些功能!

Llama 3.1 版本推出了六个基于 Llama 3 架构的新型开放式 LLM 模型。它们有三种尺寸:8B、70B 和 405B 参数,每个都有基础版(预训练)和指令调优版。所有变体都支持 128K token 的上下文长度和 8 种语言,包括英语、德语、法语、意大利语、葡萄牙语、印地语、西班牙语和泰语。Llama 3.1 继续使用分组查询注意力 (GQA),这是一种高效的表示形式,有助于处理更长的上下文。

除了这 6 个语言模型,还发布了 Llama Guard 3 和 Prompt Guard。

  • Llama Guard 3 是 Llama Guard 系列的最新迭代,在 Llama 3.1 8B 上进行了微调。它专为生产用例而构建,具有 128k 的上下文长度和多语言能力。Llama Guard 3 可以对 LLM 输入(提示)和响应进行分类,以检测在风险分类中被认为不安全的内容。
  • Prompt Guard 另一方面,是一个小型 279M 参数的基于 BERT 的分类器,可以检测提示注入和越狱。它是在大量攻击语料库上训练的,建议使用特定于应用程序的数据进行进一步微调。

与 Llama 3 相比,Llama 3.1 的新功能是,指令模型在工具调用方面进行了微调,以适应代理用例。有内置的两种工具(搜索,使用 Wolfram Alpha 进行数学推理),可以通过自定义 JSON 函数进行扩展。

Llama 3.1 模型在一个定制的 GPU 集群上训练了超过 15 万亿个 token,总计 39.3M GPU 小时(8B 模型 1.46M,70B 模型 7.0M,405B 模型 30.84M)。我们不知道训练数据集混合的确切细节,我们只能猜测它具有更多样化的多语言策展。Llama 3.1 Instruct 已经针对指令遵循进行了优化,并在公开可用的指令数据集以及超过 25M 个合成生成示例上进行了监督微调 (SFT) 和带有人类反馈的强化学习 (RLHF)。Meta 开发了基于 LLM 的分类器,用于在数据混合创建过程中过滤和筛选高质量的提示和响应。

关于许可条款,Llama 3.1 附带的许可证非常相似,但有一个关键区别:**它允许使用可用于改进其他 LLM 的模型输出**。这意味着即使使用不同的模型,也允许生成合成数据和蒸馏!正如后面所讨论的,这对于 405B 模型尤为重要。该许可证允许重新分发、微调和创建衍生作品,并且仍然要求衍生模型在其名称开头包含“Llama”,并且任何衍生作品或服务都必须提及“Built with Llama”。有关完整详细信息,请务必阅读官方许可证

Llama 3.1 需要多少内存?

Llama 3.1 带来了令人兴奋的进步。然而,运行它需要仔细考虑您的硬件资源。我们根据三种模型尺寸,分解了训练和推理的内存需求。

推理内存需求

对于推理,内存需求取决于模型大小和权重精度。下表显示了不同配置所需的大致内存:

模型大小 FP16 FP8 INT4
8B 16 GB 8 GB 4 GB
70B 140 GB 70 GB 35 GB
405B 810 GB 405 GB 203 GB

注意:以上引用的数字表示加载模型检查点所需的 GPU 显存。它们不包括用于内核或 CUDA 图形的 Torch 保留空间。

例如,一个 H100 节点(8 个 H100)大约有 640GB 的 VRAM,因此 405B 模型需要多节点设置运行或以更低的精度(例如 FP8)运行,这将是推荐的方法。

请记住,较低的精度(例如,INT4)可能会导致一些准确性损失,但可以显著降低内存需求并提高推理速度。除了模型权重之外,您还需要将 KV 缓存保留在内存中。它包含模型上下文中所有 token 的键和值,这样在生成新 token 时就不需要重新计算它们。特别是当利用可用的长上下文长度时,它成为一个重要因素。在 FP16 中,KV 缓存的内存需求为:

模型大小 1k token 16k token 128k token
8B 0.125 GB 1.95 GB 15.62 GB
70B 0.313 GB 4.88 GB 39.06 GB
405B 0.984 GB 15.38 123.05 GB

特别是对于小模型,当接近上下文长度最大值时,缓存使用的内存与权重一样多。

训练内存需求

下表概述了使用不同技术训练 Llama 3.1 模型的大致内存需求:

模型大小 完全微调 LoRA Q-LoRA
8B 60 GB 16 GB 6 GB
70B 500 GB 160 GB 48 GB
405B 3.25 TB 950 GB 250 GB

注意:这些是估算值,可能会因具体的实施细节和优化而异。

Llama 3.1 评估

注意:我们目前正在新的 Open LLM Leaderboard 2 上单独评估 Llama 3.1,并将于今天晚些时候更新此部分。以下是 Meta 官方评估的摘录。

类别 基准测试 # 次数 指标 Llama 3 8B Llama 3.1 8B Llama 3 70B Llama 3.1 70B Llama 3.1 405B
通用 MMLU 5 macro_avg/acc_char 66.7 66.7 79.5 79.3 85.2
MMLU PRO (CoT) 5 macro_avg/acc_char 36.2 37.1 55.0 53.8 61.6
AGIEval 英语 3-5 average/acc_char 47.1 47.8 63.0 64.6 71.6
CommonSenseQA 7 acc_char 72.6 75.0 83.8 84.1 85.8
Winogrande 5 acc_char - 60.5 - 83.3 86.7
BIG-Bench Hard (CoT) 3 average/em 61.1 64.2 81.3 81.6 85.9
ARC-挑战 25 acc_char 79.4 79.7 93.1 92.9 96.1
知识推理 TriviaQA-Wiki 5 em 78.5 77.6 89.7 89.8 91.8
SQuAD 1 em 76.4 77.0 85.6 81.8 89.3
阅读理解 QuAC (F1) 1 f1 44.4 44.9 51.1 51.1 53.6
BoolQ 0 acc_char 75.7 75.0 79.0 79.4 80.0
DROP (F1) 3 f1 58.4 59.5 79.7 79.6 84.8

使用 Hugging Face Transformers

Llama 3.1 需要进行一次小的模型更新,以有效处理 RoPE 缩放。通过 Transformers 版本 4.43.2,您可以使用新的 Llama 3.1 模型并利用 Hugging Face 生态系统中的所有工具。请确保使用最新的 transformers 版本。

pip install "transformers>=4.43.2" --upgrade

一些细节

  • Transformers 默认以 bfloat16 加载模型。这是 Meta 发布的原始检查点所使用的类型,因此是确保最佳精度或进行评估的推荐方式。
  • 助手响应可能会以特殊 token `<|eot_id|>` 结束,但如果找到常规的 EOS token,我们也必须停止生成。我们可以通过在 `eos_token_id` 参数中提供终止符列表来提前停止生成。
  • 我们使用了从原始 meta 代码库中获取的默认采样参数(`temperature` 和 `top_p`)。我们还没有时间进行广泛的测试,欢迎探索!

以下代码片段展示了如何使用 `meta-llama/Meta-Llama-3.1-8B-Instruct`。它需要大约 16 GB 的 VRAM,这适用于许多消费级 GPU。相同的代码片段适用于 `meta-llama/Meta-Llama-3.1-70B-Instruct`(需要 140GB VRAM)和 `meta-llama/Meta-Llama-3.1-405B-Instruct`(需要 810GB VRAM),这使其成为生产用例中一个非常有趣的模型。通过以 8 位或 4 位模式加载可以进一步减少内存消耗。

from transformers import pipeline
import torch

model_id = "meta-llama/Meta-Llama-3.1-8B-Instruct"
pipe = pipeline(
    "text-generation",
    model=model_id,
    model_kwargs={"torch_dtype": torch.bfloat16},
    device="cuda",
)

messages = [
    {"role": "user", "content": "Who are you? Please, answer in pirate-speak."},
]
outputs = pipe(
    messages,
    max_new_tokens=256,
    do_sample=False,
)
assistant_response = outputs[0]["generated_text"][-1]["content"]
print(assistant_response)
# Arrrr, me hearty! Yer lookin' fer a bit o' information about meself, eh? Alright then, matey! I be a language-generatin' swashbuckler, a digital buccaneer with a penchant fer spinnin' words into gold doubloons o' knowledge! Me name be... (dramatic pause)...Assistant! Aye, that be me name, and I be here to help ye navigate the seven seas o' questions and find the hidden treasure o' answers! So hoist the sails and set course fer adventure, me hearty! What be yer first question?

您还可以自动量化模型,通过 bitsandbytes 以 8 位甚至 4 位模式加载它。加载大型 70B 版本的 4 位模型大约需要 34 GB 内存。以下是您如何以 4 位加载生成管道的方式:

pipeline = pipeline(
    "text-generation",
    model=model_id,
    model_kwargs={
        "torch_dtype": torch.bfloat16,
        "quantization_config": {"load_in_4bit": True}
    },
)

有关使用 `transformers` 模型的更多详细信息,请查看模型卡片

注意:Transformers 会处理所有恼人的提示模板问题等等,如果您想了解更多关于提示的信息,请查看下一节。

如何提示 Llama 3.1

基础模型没有提示格式。像其他基础模型一样,它们可以用于继续输入序列以提供可信的延续,或者用于零样本/少样本推理。它们也是微调您自己用例的绝佳基础。

指令版本支持具有 4 个角色的对话格式:

  1. **系统:**设置对话的上下文。它允许包含规则、指导或必要信息,以帮助有效响应。它还用于在适当的时候启用工具使用。
  2. **用户:**用户的输入、命令和对模型的提问。
  3. **助手:**助手的响应,基于“系统”和“用户”提示中提供的上下文。
  4. **ipython:**Llama 3.1 中引入的新角色。此角色用作工具调用的输出,当它返回给 LLM 时。

指令版本使用以下对话结构进行简单对话:

<|begin_of_text|><|start_header_id|>system<|end_header_id|>

{{ system_prompt }}<|eot_id|><|start_header_id|>user<|end_header_id|>

{{ user_msg_1 }}<|eot_id|><|start_header_id|>assistant<|end_header_id|>

{{ model_answer_1 }}<|eot_id|>

Llama 3.1 指令模型现在支持工具调用,包括三种内置工具(brave_search、wolfram_alpha 和 code_interpreter)以及通过 JSON 函数调用进行的自定义工具调用。内置工具使用 Python 语法。为函数调用输出 Python 代码的能力是代码解释器工具的一部分,必须使用 `Environment` 关键字在系统提示中启用,如下所示。

内置工具调用

包含“Environment: ipython”将开启代码解释器模式,模型可以生成它期望被执行的 Python 代码。助手响应的消息体以特殊标签 `<|python_tag|>` 开始,并以 `<|eom_id|>` 结束,而不是仅仅是标准的 `<|eot_id|>`。后者表示回合结束,而前者表示多步推理的继续。

内置工具调用示例
<|begin_of_text|><|start_header_id|>system<|end_header_id|>


Environment: ipython
Tools: brave_search, wolfram_alpha

Cutting Knowledge Date: 01 March 2023
Today's Date: 13 July 2024


You are a helpful Assistant.<|eot_id|><|start_header_id|>user<|end_header_id|>

Weather in Menlo Park, California<|eot_id|><|start_header_id|>assistant<|end_header_id|>

此时模型返回的响应将包含用于调用受支持工具(本例中为 `brave_search`)的 Python 代码。

<|python_tag|>brave_search.call(query="current weather in Menlo Park, California")<|eom_id|>

执行调用后的响应随后被发送回模型以检索最终响应。为简洁起见,以下内容将被附加到前一个片段中显示的消息中:

<|python_tag|>brave_search.call(query="Menlo Park California weather")<|eom_id|><|start_header_id|>ipython<|end_header_id|>

{"query": "Menlo Park California weather", "top_k": [{"title": "10-Day Weather Forecast for West Menlo Park, CA - The Weather Channel | weather.com", "url": "https://weather.com/weather/tenday/l/West+Menlo+Park+CA?canonicalCityId=b2375713aa1943aad7d1a13a85e1c0adad13c1b10563b2bbaad70734dc61cf11", "description": "Be prepared with the most accurate 10-day forecast for West <strong>Menlo</strong> <strong>Park</strong>, CA with highs, lows, chance of precipitation from The <strong>Weather</strong> Channel and <strong>Weather</strong>.com", "type": "search_result"},....}<|eot_id|><|start_header_id|>assistant<|end_header_id|>

LLM 的最终响应将是:

The current weather in Menlo Park, California is mostly sunny with a high of 77°F and a low of 56°F.<|eot_id|>

自定义工具调用

Llama 3.1 Instruct 支持从单个用户消息中进行自定义函数调用。以下提示提供了一个示例,说明如何从模型输出中调用自定义函数。在自定义函数调用中,模型输出 `<|eot_id|>` 而不是 `<|eom_id|>`。系统提示需要调整,以告知模型如何处理函数调用输出。

自定义工具调用 JSON 函数
<|begin_of_text|><|start_header_id|>system<|end_header_id|>

You are a helpful assistant with tool calling capabilities. When you receive a tool call response, use the output to format an answer to the orginal user question.<|eot_id|><|start_header_id|>user<|end_header_id|>

Given the following functions, please respond with a JSON for a function call with its proper arguments that best answers the given prompt.

Respond in the format {"name": function name, "parameters": dictionary of argument name and its value}. Do not use variables.

{
    "type": "function",
    "function": {
    "name": "get_current_conditions",
    "description": "Get the current weather conditions for a specific location",
    "parameters": {
        "type": "object",
        "properties": {
        "location": {
            "type": "string",
            "description": "The city and state, e.g., San Francisco, CA"
        },
        "unit": {
            "type": "string",
            "enum": ["Celsius", "Fahrenheit"],
            "description": "The temperature unit to use. Infer this from the user's location."
        }
        },
        "required": ["location", "unit"]
    }
    }
}

Question: what is the weather like in Menlo Park?<|eot_id|><|start_header_id|>assitant<|end_header_id|>

{"name": "get_current_conditions", "parameters": {"location": "Menlo Park, CA", "unit": "Fahrenheit"}}<|eot_id|><|start_header_id|>ipython<|end_header_id|>

当我们从选定的工具中检索输出时,我们使用相同的 `<|python_tag|>` 分隔符将其传回模型。`<|python_tag|>` 并不意味着使用 Python。它仅用于表示任何工具输出的开始。

<|python_tag|>{
    "tool_call_id": "get_current_conditions"
    "output": "Clouds giving way to sun Hi: 76° Tonight: Mainly clear early, then areas of low clouds forming Lo: 56°"
}<|eot_id|><|start_header_id|>assistant<|end_header_id|>

The weather in Menlo Park is currently cloudy with a high of 76° and a low of 56°, with clear skies expected tonight.<|eot_id|>

这种格式必须精确重现才能有效使用。transformers 中提供的聊天模板使其可以轻松正确地格式化提示。

演示

您可以在以下演示中体验这三个指令模型:

整个堆栈是开源的。Hugging Chat 由 chat-uitext-generation-inference 提供支持。

Llama 3.1 405B 使用 FP8、AWQ 和 GPTQ 进行量化

Meta 创建了 Llama 3.1 405B 的官方 FP8 量化版本,其准确性降级极小。为此,FP8 量化仅应用于模型的主要线性算子,例如 FFN 的门和上/下投影(覆盖 75% 的推理 FLOPs)。我们共同努力,确保此 FP8 量化检查点与社区(transformers、TGI、VLLM)兼容。

此外,我们还分别使用 AutoAWQ 和 AutoGPTQ 创建了 INT4 格式的 AWQ 和 GPTQ 量化变体。对于 AWQ,所有线性层都使用 GEMM 内核进行量化,将其零点量化至 4 位,组大小为 128;对于 GPTQ,仅使用 GPTQ 内核,设置相同。我们确保 INT4 检查点与 transformers 和 TGI 兼容,包括 Marlin 内核支持,以加速 TGI 中 GPTQ 量化的推理。

Llama 3.1 405B 可用的量化权重:

Hugging Quants 组织也包含 70B 和 8B 版本的量化检查点。

推理集成

Hugging Face 推理 API

Hugging Face PRO 用户现在可以访问独家 API 端点,该端点托管 Llama 3.1 8B Instruct、Llama 3.1 70B Instruct 和 Llama 3.1 405B Instruct AWQ,由 text-generation-inference 提供支持。所有版本都支持 Messages API,因此它们与 OpenAI 客户端库(包括 LangChain 和 LlamaIndex)兼容。

注意:请使用 `pip install "huggingface_hub>=0.24.1"` 更新到最新版 `huggingface_hub`。


from huggingface_hub import InferenceClient

# Initialize the client, pointing it to one of the available models
client = InferenceClient()

chat_completion = client.chat.completions.create(
    model="meta-llama/Meta-Llama-3.1-405B-Instruct-FP8",
    messages=[
        {"role": "system", "content": "You are a helpful an honest programming assistant."},
        {"role": "user", "content": "Is Rust better than Python?"},
    ],
    stream=True,
    max_tokens=500
)

# iterate and print stream
for message in chat_completion:
    print(message.choices[0].delta.content, end="")

有关 Messages API 使用的更多详细信息,请查看此文章

Hugging Face 推理端点

您可以在 Hugging Face 的推理端点上部署 Llama 3.1,该端点使用 Text Generation Inference 作为后端。Text Generation Inference 是 Hugging Face 开发的生产级推理容器,支持 FP8、连续批处理、token 流式传输和张量并行,可实现多 GPU 快速推理。要部署 Llama 3.1,请访问模型页面,然后单击“部署”->“推理端点”小部件。

from huggingface_hub import InferenceClient

# Initialize the client, pointing it to one of the available models
client = InferenceClient(
    base_url="<ENDPOINT_URL>",
)

# Create a chat completion
chat_completion = client.chat.completions.create(
    model="ENDPOINT",
    messages=[
        {"role": "system", "content": "You are a helpful an honest programming assistant."},
        {"role": "user", "content": "Is Rust better than Python?"},
    ],
    stream=True,
    max_tokens=500
)

# iterate and print stream
for message in chat_completion:
    print(message.choices[0].delta.content, end="")

Hugging Face 合作伙伴集成

注意:我们目前正在与 AWS、Google Cloud、Microsoft Azure 和 DELL 的合作伙伴合作,将 Llama 3.1 8B、70B 和 405B 添加到 Amazon SageMaker、Google Kubernetes Engine、Vertex AI 模型目录、Azure AI Studio、DELL Enterprise Hub。一旦容器可用,我们将更新此部分——您可以订阅 Hugging Squad 获取电子邮件更新

使用 Hugging Face TRL 进行微调

在本节中,我们将介绍 Hugging Face 生态系统中可用的工具,以高效地在消费级 GPU 上训练 Llama 3.1。以下是微调 Llama 3.1 8B 在 OpenAssistant 的 聊天数据集 上的示例命令。我们使用 4 位量化和 QLoRA 来节省内存,以针对所有注意力块的线性层。

使用 Hugging Face TRL 进行微调示例

首先,安装 🤗 TRL 的夜间版本并克隆仓库以访问训练脚本

pip install "transformers>=4.43.2" --upgrade
pip install --upgrade bitsandbytes
pip install --ugprade peft
pip install git+https://github.com/huggingface/trl
git clone https://github.com/huggingface/trl
cd trl

然后你可以运行脚本

python \
    examples/scripts/sft.py \
    --model_name meta-llama/Meta-Llama-3.1-8B \
    --dataset_name OpenAssistant/oasst_top1_2023-08-25 \
    --dataset_text_field="text" \
    --per_device_train_batch_size 1 \
    --per_device_eval_batch_size 1 \
    --gradient_accumulation_steps 4 \
    --learning_rate 2e-4 \
    --report_to "none" \
    --bf16 \
    --max_seq_length 1024 \
    --lora_r 16 --lora_alpha 32 \
    --lora_target_modules q_proj k_proj v_proj o_proj \
    --load_in_4bit \
    --use_peft \
    --attn_implementation "flash_attention_2" \
    --logging_steps=10 \
    --gradient_checkpointing \
    --output_dir llama31

如果您有更多 GPU 可用,您可以使用 DeepSpeed 和 ZeRO Stage 3 进行训练。

accelerate launch --config_file=examples/accelerate_configs/deepspeed_zero3.yaml \
    examples/scripts/sft.py \
    --model_name meta-llama/Meta-Llama-3.1-8B \
    --dataset_name OpenAssistant/oasst_top1_2023-08-25 \
    --dataset_text_field="text" \
    --per_device_train_batch_size 1 \
    --per_device_eval_batch_size 1 \
    --gradient_accumulation_steps 4 \
    --learning_rate 2e-5 \
    --report_to wandb \
    --bf16 \
    --max_seq_length 1024 \
    --attn_implementation eager \
    --logging_steps=10 \
    --gradient_checkpointing \
    --output_dir models/llama

使用 distilabel 生成合成数据

Llama 3.1 许可证的一个重大变化是它允许使用模型输出改进其他 LLM,这意味着您可以使用 Llama 3.1 模型生成合成数据集,并使用它们来微调更小、更专业的模型。

让我们看看如何使用distilabel(一个用于合成数据生成的开源框架)生成偏好数据集的示例。此数据集可用于使用 TRL 提供的偏好优化方法(如 DPO 或 KTO)微调模型。

首先,使用 `pip` 安装最新版本的 `distilabel`,包括 `hf-inference-endpoints` 附加功能,如下所示:

pip install “distilabel[hf-inference-endpoints]” --upgrade

然后定义一个管道,它:

  • 从 Hugging Face Hub 加载一个包含指令的数据集。
  • 通过 Hugging Face 推理端点,使用 Llama 3.1 70B Instruct 和 Llama 3.1 405B Instruct 生成响应。
  • 最后,使用 Llama 3.1 405B Instruct 作为判断模型,使用 UltraFeedback 提示对响应进行评分。根据这些评分,可以选择“选中”和“拒绝”的响应,并用于使用偏好优化方法微调模型。

请参阅下面的代码以定义管道,或使用此 Colab 笔记本自行运行,并在 Hub 中探索生成的数据集。

from distilabel.llms import InferenceEndpointsLLM
from distilabel.pipeline import Pipeline
from distilabel.steps import LoadDataFromHub, CombineColumns
from distilabel.steps.tasks import TextGeneration, UltraFeedback

llama70B = InferenceEndpointsLLM(
    model_id="meta-llama/Meta-Llama-3.1-70B-Instruct"
)
llama405B = InferenceEndpointsLLM(
    model_id="meta-llama/Meta-Llama-3.1-405B-Instruct-FP8"
)

with Pipeline(name="synthetic-data-with-llama3") as pipeline:
    # load dataset with prompts
    load_dataset = LoadDataFromHub(
        repo_id="argilla/10Kprompts-mini"
    )
    # generate two responses for each prompt
    generate = [
        TextGeneration(llm=llama70B),
        TextGeneration(llm=llama405B)
    ]
    # combine responses into one column
    combine = CombineColumns(
        columns=["generation", "model_name"],
        output_columns=["generations", "model_names"]
    )
    # rate responses with 405B LLM-as-a-judge
    rate = UltraFeedback(aspect="overall-rating", llm=llama405B)
    # define the pipeline
    load_dataset >> generate >> combine >> rate

if __name__ == "__main__":
    distiset = pipeline.run()

下一步是什么?除了上述示例,`distilabel` 还提供了在各种场景和主题中使用 LLM 进行合成数据生成的激动人心的方法。它包含了当前 SOTA 文献中关于评估 LLM-as-a-judge 方法、指令演变、数据过滤以及定义自定义组件等任务的实现。

附加资源

致谢

在生态系统中发布此类模型并提供支持和评估,离不开数千名社区成员的贡献,他们为 transformers、tgi、vllm、pytorch、LM Eval Harness 和许多其他项目做出了贡献。如果没有 Clémentine 和 Nathan 对 LLM 评估的支持;Nicolas、Olivier Dehaene 和 Daniël de Kok 对文本生成推理的支持;Arthur、Matthew Carrigan、Zachary Mueller、Joao、Joshua Lochner 和 Lysandre 将 Llama 3.1 集成到 `transformers` 中;Matthew Douglas 对量化支持的贡献;Gabriel Martín Blázquez 对 `distilabel` 的支持;Merve Noyan 和 Aymeric Roucher 的评审;hysts 和 Yuvi 的演示;Ellie 的微调测试;Brigitte Tousignant 和 Florent Daudens 的沟通;Nathan 和 Victor 将 Llama 3.1 引入 Hugging Chat,此次发布是不可能实现的。

感谢 Meta 团队发布 Llama 3.1 并向开源 AI 社区开放!

社区

你好,405B 在 FP16 下的 KV 缓存内存需求,0.984 GB、15.38 GB、123.05 GB,这三个值看起来像是 FP32 的,你能再确认一下吗?以及当我获得一个新的 LLM 时,如何获取 KV 缓存内存?

·

你好,aHaric!我也认为 405B 的数字是 FP32。根据我的计算,405B 在 128k 时应该在 66GB 左右。

注册登录 发表评论