Phi-3-mini-4k-instruct 的功能测试

Model card 介绍

Phi-3-Mini-4K-Instruct 是一个 3.8B 参数、轻量级、最先进的开放模型,使用 Phi-3 数据集进行训练,其中包括合成数据和经过过滤的公开可用网站数据,重点是 高品质和推理密集的属性。 该型号属于 Phi-3 系列,Mini 版本有 4K 和 128K 两种变体,这是它可以支持的上下文长度(以令牌为单位)。

该模型经历了训练后过程,其中结合了监督微调和针对指令遵循和安全措施的直接偏好优化。 当根据测试常识、语言理解、数学、代码、长上下文和逻辑推理的基准进行评估时,Phi-3 Mini-4K-Instruct 在参数少于 130 亿的模型中展示了强大且最先进的性能。

资源和技术文档:

  • Phi-3 Microsoft Blog
  • Phi-3 Technical Report
  • Phi-3 on Azure AI Studio
  • Phi-3 GGUF: 4K
  • Phi-3 ONNX: 4K

预期用途

主要用例

该模型旨在用于英语的商业和研究用途。 该模型适用于需要以下功能的应用:

  1. 内存/计算受限环境
  2. 延迟限制场景
  3. 强大的推理能力(尤其是代码、数学和逻辑)

我们的模型旨在加速语言和多模式模型的研究,用作生成人工智能驱动功能的构建块。

用例注意事项

我们的模型并非针对所有下游目的而专门设计或评估。 开发人员在选择用例时应考虑语言模型的常见限制,并在特定下游用例中使用之前评估和减轻准确性、安全性和复杂性,特别是对于高风险场景。 开发人员应了解并遵守与其用例相关的适用法律或法规(包括隐私、贸易合规法等)。

本模型卡中包含的任何内容均不应解释为或视为对该模型发布所依据的许可的限制或修改。

如何使用

Phi-3 Mini-4K-Instruct 已集成到 Transformer 的开发版本 (4.40.0) 中。 在通过 pip 发布正式版本之前,请确保您正在执行以下操作之一:

  • 加载模型时,确保 trust_remote_code=True 作为 from_pretrained() 函数的参数传递。
  • 将本地 Transformer 更新到开发版本:pip uninstall -y transformers && pip install git+https://github.com/huggingface/transformers.  前面的命令是从源克隆和安装的替代方法。

电流互感器版本可以通过以下方式验证:pip list | grep transformers.

Phi-3 Mini-4K-Instruct 也可用于  HuggingChat.

分词器

Phi-3 Mini-4K-Instruct 支持高达 32064 个令牌的词汇量。 分词器 文件已经提供了可用于下游微调的占位符标记,但它们也可以扩展到模型的词汇量大小。

聊天格式

鉴于训练数据的性质,Phi-3 Mini-4K-Instruct 模型最适合使用如下聊天格式进行提示。 您可以使用通用模板将提示作为问题提供,如下所示:

<|user|>\nQuestion <|end|>\n<|assistant|>

例如:

<|system|>
You are a helpful AI assistant.<|end|>
<|user|>
How to explain Internet for a medieval knight?<|end|>
<|assistant|>

其中模型在 <|assistant|> 之后生成文本。 如果出现少量提示,则提示格式可以如下:

<|system|>
You are a helpful AI assistant.<|end|>
<|user|>
I am going to Paris, what should I see?<|end|>
<|assistant|>
Paris, the capital of France, is known for its stunning architecture, art museums, historical landmarks, and romantic atmosphere. Here are some of the top attractions to see in Paris:\n\n1. The Eiffel Tower: The iconic Eiffel Tower is one of the most recognizable landmarks in the world and offers breathtaking views of the city.\n2. The Louvre Museum: The Louvre is one of the world's largest and most famous museums, housing an impressive collection of art and artifacts, including the Mona Lisa.\n3. Notre-Dame Cathedral: This beautiful cathedral is one of the most famous landmarks in Paris and is known for its Gothic architecture and stunning stained glass windows.\n\nThese are just a few of the many attractions that Paris has to offer. With so much to see and do, it's no wonder that Paris is one of the most popular tourist destinations in the world."<|end|>
<|user|>
What is so great about #1?<|end|>
<|assistant|>

示例推理代码

此代码片段展示了如何快速开始在 GPU 上运行模型:

import torch
from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline

torch.random.manual_seed(0)

model = AutoModelForCausalLM.from_pretrained(
    "microsoft/Phi-3-mini-4k-instruct", 
    device_map="cuda", 
    torch_dtype="auto", 
    trust_remote_code=True, 
)
tokenizer = AutoTokenizer.from_pretrained("microsoft/Phi-3-mini-4k-instruct")

messages = [
    {"role": "system", "content": "You are a helpful digital assistant. Please provide safe, ethical and accurate information to the user."},
    {"role": "user", "content": "Can you provide ways to eat combinations of bananas and dragonfruits?"},
    {"role": "assistant", "content": "Sure! Here are some ways to eat bananas and dragonfruits together: 1. Banana and dragonfruit smoothie: Blend bananas and dragonfruits together with some milk and honey. 2. Banana and dragonfruit salad: Mix sliced bananas and dragonfruits together with some lemon juice and honey."},
    {"role": "user", "content": "What about solving an 2x + 3 = 7 equation?"},
]

pipe = pipeline(
    "text-generation",
    model=model,
    tokenizer=tokenizer,
)

generation_args = {
    "max_new_tokens": 500,
    "return_full_text": False,
    "temperature": 0.0,
    "do_sample": False,
}

output = pipe(messages, **generation_args)
print(output[0]['generated_text'])

某些应用程序/框架可能在对话开始时不包含 BOS 令牌 (<s>)。 请确保包含它,因为它提供更可靠的结果。

负责任的人工智能考虑因素

与其他语言模型一样,Phi 系列模型的行为方式可能不公平、不可靠或具有攻击性。 需要注意的一些限制行为包括:

  • 服务质量:Phi 模型主要根据英文文本进行训练。 英语以外的语言的性能会更差。 训练数据中代表性较少的英语语言品种可能会比标准美式英语表现更差。
  • 伤害的表征和刻板印象的延续:这些模型可能会过度或低估某些群体的代表性,消除某些群体的代表性,或强化贬低或负面的刻板印象。 尽管训练后具有安全性,但由于不同群体的代表性水平不同或反映现实世界模式和社会偏见的训练数据中负面刻板印象示例的普遍存在,这些限制可能仍然存在。
  • 不当或攻击性内容:这些模型可能会产生其他类型的不当或攻击性内容,这可能导致在没有针对用例的额外缓解措施的情况下,不适合在敏感环境中部署。
  • 信息可靠性:语言模型可以生成无意义的内容或捏造听起来合理但不准确或过时的内容。
  • 代码范围有限:大部分 Phi-3 训练数据基于 Python,并使用常用包,例如“打字、数学、随机、集合、日期时间、itertools”。 如果模型生成的 Python 脚本使用其他包或其他语言的脚本,我们强烈建议用户手动验证所有 API 使用情况。

开发人员应采用负责任的人工智能最佳实践,并负责确保特定用例符合相关法律法规(例如隐私、贸易等)。 需要考虑的重要领域包括:

  • 分配:如果没有进一步的评估和额外的去偏差技术,模型可能不适合可能对法律地位或资源或生活机会的分配(例如:住房、就业、信贷等)产生重大影响的场景。
  • 高风险场景:开发人员应评估在高风险场景中使用模型的适用性,在这些场景中,不公平、不可靠或令人反感的输出可能会造成极高的成本或导致伤害。 这包括在准确性和可靠性至关重要的敏感或专家领域提供建议(例如:法律或健康建议)。 应根据部署上下文在应用程序级别实施其他保护措施。
  • 错误信息:模型可能会产生不准确的信息。 开发人员应遵循透明度最佳实践,并告知最终用户他们正在与人工智能系统进行交互。 在应用程序级别,开发人员可以构建反馈机制和管道,以在特定于用例的上下文信息中进行地面响应,这种技术称为检索增强生成(RAG)。
  • 有害内容的生成:开发人员应评估其上下文的输出,并使用适合其用例的可用安全分类器或自定义解决方案。
  • 滥用:可能存在其他形式的滥用,例如欺诈、垃圾邮件或恶意软件制作,开发人员应确保其应用程序不违反适用的法律和法规。

训练模型

  • 架构:Phi-3 Mini-4K-Instruct 有 3.8B 参数,是一个密集的仅解码器 Transformer 模型。 该模型通过监督微调 (SFT) 和直接偏好优化 (DPO) 进行微调,以确保符合人类偏好和安全准则。
  • 输入:文本。 它最适合使用聊天格式的提示。
  • 上下文长度:4K 令牌
  • GPU:512 H100-80G
  • 培训时间:7天
  • 训练数据:3.3T 代币
  • 输出:响应输入生成的文本
  • 日期:我们的模型在 2024 年 2 月至 4 月期间接受训练
  • 状态:这是在离线数据集上训练的静态模型,截止日期为 2023 年 10 月。随着我们改进模型,可能会发布调整模型的未来版本。

数据集

我们的训练数据包括多种来源,总计 3.3 万亿个代币,并且是以下内容的组合

  1. 公开的文档经过严格的质量筛选,精选出高质量的教育数据和代码;
  2. 新创建的合成“教科书式”数据,用于教授数学、编码、常识推理、世界常识(科学、日常活动、心理理论等);
  3. 高质量的聊天格式监督数据涵盖各种主题,以反映人类在不同方面的偏好,例如遵循指令、诚实、诚实和乐于助人。

微调

此处提供了带有 TRL 和 Accelerate 模块的多 GPU 监督微调 (SFT) 的基本示例。

基准测试

我们报告了 Phi-3-Mini-4K-Instruct 在标准开源基准上的结果,衡量模型的推理能力(常识推理和逻辑推理)。 我们与 Phi-2、Mistral-7b-v0.1、Mixtral-8x7b、Gemma 7B、Llama-3-8B-Instruct 和 GPT-3.5 进行比较。

所有报告的数字都是通过完全相同的管道生成的,以确保这些数字具有可比性。 由于评估中的选择略有不同,这些数字可能与其他公布的数字有所不同。

按照现在的标准,我们在温度为 0 时使用少样本提示来评估模型。提示和样本次数是 Microsoft 评估语言模型的内部工具的一部分,特别是我们没有对 Phi 的管道进行优化 -3。 更具体地说,我们不会更改提示、选择不同的少数样本、更改提示格式或对模型进行任何其他形式的优化。

每个基准列出了 k 镜头示例的数量。

Phi-3-Mini-4K-In
3.8b
Phi-3-Small
7b (preview)
Phi-3-Medium
14b (preview)
Phi-2
2.7b
Mistral
7b
Gemma
7b
Llama-3-In
8b
Mixtral
8x7b
GPT-3.5
version 1106
MMLU
5-Shot
68.875.378.256.361.763.666.568.471.4
HellaSwag
5-Shot
76.778.783.253.658.549.871.170.478.8
ANLI
7-Shot
52.855.058.742.547.148.757.355.258.1
GSM-8K
0-Shot; CoT
82.586.490.861.146.459.877.464.778.1
MedQA
2-Shot
53.858.269.840.949.650.060.562.263.4
AGIEval
0-Shot
37.545.049.729.835.142.142.045.248.4
TriviaQA
5-Shot
64.059.173.345.272.375.267.782.285.8
Arc-C
10-Shot
84.990.791.975.978.678.382.887.387.4
Arc-E
10-Shot
94.697.198.088.590.691.493.495.696.3
PIQA
5-Shot
84.287.888.260.277.778.175.786.086.6
SociQA
5-Shot
76.679.079.468.374.665.573.975.968.3
BigBench-Hard
0-Shot
71.775.082.559.457.359.651.569.768.32
WinoGrande
5-Shot
70.882.581.254.754.255.66562.068.8
OpenBookQA
10-Shot
83.288.486.673.679.878.682.685.886.0
BoolQ
0-Shot
77.682.986.5--72.266.080.977.679.1
CommonSenseQA
10-Shot
80.280.382.669.372.676.27978.179.6
TruthfulQA
10-Shot
65.068.174.8--52.153.063.260.185.8
HumanEval
0-Shot
59.159.154.747.028.034.160.437.862.2
MBPP
3-Shot
53.871.473.760.650.851.567.760.277.8

软件

  • PyTorch
  • DeepSpeed
  • Transformers
  • Flash-Attention

硬件

请注意,默认情况下,Phi-3-mini 模型使用闪存注意力,这需要某些类型的 GPU 硬件才能运行。 我们在以下 GPU 类型上进行了测试:

英伟达 A100
英伟达A6000
英伟达 H100

如果您想在以下平台上运行模型:

NVIDIA V100 或更早一代 GPU:使用 attn_implementation="eager" 调用 AutoModelForCausalLM.from_pretrained()
CPU:使用GGUF量化模型4K
GPU、CPU 和移动设备上的优化推理:使用 ONNX 模型 4K

跨平台支持
ONNX 运行时生态系统现在支持跨平台和硬件的 Phi-3 Mini 模型。 您可以在此处找到优化的 Phi-3 Mini-4K-Instruct ONNX 模型。

优化的 Phi-3 模型也以 ONNX 格式发布,可跨设备(包括服务器平台、Windows、Linux 和 Mac 桌面以及移动 CPU)在 CPU 和 GPU 上与 ONNX Runtime 一起运行,并具有最适合每个目标的精度 。 DirectML 支持让开发人员能够跨 AMD、Intel 和 NVIDIA GPU 为 Windows 设备大规模提供硬件加速。
ONNX Runtime 与 DirectML 一起为一系列 CPU、GPU 和移动设备上的 Phi-3 提供跨平台支持。

以下是我们添加的一些优化配置:

  1. int4 DML 的 ONNX 模型:通过 AWQ 量化为 int4
  2. 适用于 fp16 CUDA 的 ONNX 模型
  3. int4 CUDA 的 ONNX 模型:通过 RTN 量化为 int4
  4. 适用于 int4 CPU 和移动设备的 ONNX 模型:通过 RTN 量化为 int4

这是技术报告。

!pip install llama-index llama-index-llms-huggingface llama-index-embeddings-huggingface transformers accelerate bitsandbytes llama-index-readers-web matplotlib flash-attn
hf_token = "hf_"

设置 数据

from llama_index.readers.web import BeautifulSoupWebReader

url = "https://www.theverge.com/2023/9/29/23895675/ai-bot-social-network-openai-meta-chatbots"

documents = BeautifulSoupWebReader().load_data([url])

LLM

from llama_index.llms.huggingface import HuggingFaceLLM


def messages_to_prompt(messages):
    prompt = ""
    system_found = False
    for message in messages:
        if message.role == "system":
            prompt += f"<|system|>\n{message.content}<|end|>\n"
            system_found = True
        elif message.role == "user":
            prompt += f"<|user|>\n{message.content}<|end|>\n"
        elif message.role == "assistant":
            prompt += f"<|assistant|>\n{message.content}<|end|>\n"
        else:
            prompt += f"<|user|>\n{message.content}<|end|>\n"

    # trailing prompt
    prompt += "<|assistant|>\n"

    if not system_found:
        prompt = (
            "<|system|>\nYou are a helpful AI assistant.<|end|>\n" + prompt
        )

    return prompt


llm = HuggingFaceLLM(
    model_name="microsoft/Phi-3-mini-4k-instruct",
    model_kwargs={
        "trust_remote_code": True,
    },
    generate_kwargs={"do_sample": True, "temperature": 0.1},
    tokenizer_name="microsoft/Phi-3-mini-4k-instruct",
    query_wrapper_prompt=(
        "<|system|>\n"
        "You are a helpful AI assistant.<|end|>\n"
        "<|user|>\n"
        "{query_str}<|end|>\n"
        "<|assistant|>\n"
    ),
    messages_to_prompt=messages_to_prompt,
    is_chat_model=True,
)
Loading checkpoint shards:   0%|          | 0/2 [00:00<?, ?it/s]
Special tokens have been added in the vocabulary, make sure the associated word embeddings are fine-tuned or trained.
from llama_index.core import Settings
from llama_index.embeddings.huggingface import HuggingFaceEmbedding

Settings.llm = llm
Settings.embed_model = HuggingFaceEmbedding(
    model_name="BAAI/bge-small-en-v1.5"
)

Index Setup 指数设置

from llama_index.core import VectorStoreIndex

vector_index = VectorStoreIndex.from_documents(documents)
from llama_index.core import SummaryIndex

summary_index = SummaryIndex.from_documents(documents)

有用的导入/日志记录

from llama_index.core.response.notebook_utils import display_response
import logging
import sys

logging.basicConfig(stream=sys.stdout, level=logging.INFO)
logging.getLogger().addHandler(logging.StreamHandler(stream=sys.stdout))

基本查询引擎

紧凑(默认)Compact (default)

query_engine = vector_index.as_query_engine(response_mode="compact")

response = query_engine.query("How do OpenAI and Meta differ on AI tools?")

display_response(response)
Batches:   0%|          | 0/1 [00:00<?, ?it/s]
WARNING:transformers_modules.microsoft.Phi-3-mini-4k-instruct.240d36176caf025230489b7a56e895d9e5b845f7.modeling_phi3:You are not running the flash-attention implementation, expect numerical differences.
You are not running the flash-attention implementation, expect numerical differences.

Final Response:

OpenAI 和 Meta 在使用人工智能工具的方法上有所不同。 OpenAI 倾向于将其产品展示为生产力工具,专注于完成工作的简单实用程序。 另一方面,从事娱乐业务的 Meta 开发了自己的生成人工智能和语音用途,为其消息应用程序创建了 28 个个性驱动的聊天机器人。 这些聊天机器人的声音来自 Charli D'Amelio、Dwyane Wade、Kendall Jenner、MrBeast、Snoop Dogg、Tom Brady 和 Paris Hilton 等名人。 虽然 OpenAI 的 ChatGPT 主要是用于生成文本的语言模型,但 Meta 的 AI 工具更专注于通过个性驱动的聊天机器人创建引人入胜且有趣的交互。

细化 refine

query_engine = vector_index.as_query_engine(response_mode="refine")

response = query_engine.query("How do OpenAI and Meta differ on AI tools?")

display_response(response)

Batches: 0%| | 0/1 [00:00<?, ?it/s]

Final Response:

OpenAI 和 Meta 对 AI 工具有不同的看法。 OpenAI 主要专注于创建作为生产力辅助工具的人工智能工具,帮助用户更有效地完成任务。 例如,他们对 ChatGPT 的最新更新引入了语音功能,使该工具更易于使用和通用。 另一方面,以娱乐业务而闻名的Meta,则以独特的方式开发了AI工具。 他们推出了 28 个个性驱动的聊天机器人,其中包括 Charli D'Amelio 和 Tom Brady 等名人的声音,用于他们的消息应用程序中。 这些聊天机器人旨在提供独特且引人入胜的用户体验。

树总结

query_engine = vector_index.as_query_engine(response_mode="tree_summarize")

response = query_engine.query("How do OpenAI and Meta differ on AI tools?")

display_response(response)

Batches: 0%| | 0/1 [00:00<?, ?it/s]

Final Response:

OpenAI 和 Meta 在使用人工智能工具的方法上有所不同。 OpenAI 倾向于将其产品展示为生产力工具,专注于完成工作的简单实用程序。 另一方面,从事娱乐业务的 Meta 开发了自己的生成人工智能和语音用途,为其消息应用程序创建了 28 个个性驱动的聊天机器人。 这些聊天机器人的声音来自 Charli D'Amelio、Dwyane Wade、Kendall Jenner、MrBeast、Snoop Dogg、Tom Brady 和 Paris Hilton 等名人。 虽然 OpenAI 的 ChatGPT 主要是用于各种任务的语言模型,但 Meta 的 AI 工具更专注于通过其消息应用程序提供娱乐和个性化体验。

路由器查询引擎

from llama_index.core.tools import QueryEngineTool, ToolMetadata

vector_tool = QueryEngineTool(
    vector_index.as_query_engine(),
    metadata=ToolMetadata(
        name="vector_search",
        description="Useful for searching for specific facts.",
    ),
)

summary_tool = QueryEngineTool(
    summary_index.as_query_engine(response_mode="tree_summarize"),
    metadata=ToolMetadata(
        name="summary",
        description="Useful for summarizing an entire document.",
    ),
)

单选择器

from llama_index.core.query_engine import RouterQueryEngine

query_engine = RouterQueryEngine.from_defaults(
    [vector_tool, summary_tool], select_multi=False
)

response = query_engine.query("What was mentioned about Meta?")

display_response(response)
INFO:llama_index.core.query_engine.router_query_engine:Selecting query engine 0: Useful for searching for specific facts..
Selecting query engine 0: Useful for searching for specific facts..
Batches:   0%|          | 0/1 [00:00<?, ?it/s]

Final Response:
​​​​​​​
Meta 是一家主要从事娱乐业务的公司,它也在构建 LLM(大型语言模型),并发现了自己在生成人工智能和语音方面的用途。 他们推出了 28 个用于消息应用程序的个性化聊天机器人,Charli D'Amelio、Dwyane Wade、Kendall Jenner、MrBeast、Snoop Dogg、Tom Brady 和 Paris Hilton 等名人为这些聊天机器人配音。

多重选择器

from llama_index.core.query_engine import RouterQueryEngine

query_engine = RouterQueryEngine.from_defaults(
    [vector_tool, summary_tool],
    select_multi=True,
)

response = query_engine.query(
    "What was mentioned about Meta? Summarize with any other companies mentioned in the entire document."
)

display_response(response)
INFO:llama_index.core.query_engine.router_query_engine:Selecting query engine 1: Useful for summarizing an entire document, which is needed to provide a summary about Meta and any other companies mentioned..
Selecting query engine 1: Useful for summarizing an entire document, which is needed to provide a summary about Meta and any other companies mentioned..

Final Response:

据周三透露,娱乐行业公司 Meta 正在开发自己的生成人工智能和语音用途。 他们推出了 28 个用于 Meta 消息应用程序的个性驱动聊天机器人,Charli D'Amelio、Dwyane Wade、Kendall Jenner、MrBeast、Snoop Dogg、Tom Brady 和 Paris Hilton 等名人都为这项工作献出了自己的力量。 这些聊天机器人带有简短且常常令人尴尬的描述,Meta 计划将其人工智能角色放置在其产品的每个主要表面上,有可能将社交信息转变为部分合成的社交网络。

文件中提到的另一家公司OpenAI倾向于将其产品定位为生产力工具,而Meta则涉足娱乐业务。 OpenAI 的 ChatGPT 已经发展成为一种更有用的工具,其语音功能可能会导致更具同理心和参与度的社交网络。 该文件还提到了人工智能生成图像的潜力,Meta 的消息应用程序引入了新的贴纸。

该文件还简要介绍了

子问题查询引擎

from llama_index.core.tools import QueryEngineTool, ToolMetadata

vector_tool = QueryEngineTool(
    vector_index.as_query_engine(),
    metadata=ToolMetadata(
        name="vector_search",
        description="Useful for searching for specific facts.",
    ),
)

summary_tool = QueryEngineTool(
    summary_index.as_query_engine(response_mode="tree_summarize"),
    metadata=ToolMetadata(
        name="summary",
        description="Useful for summarizing an entire document.",
    ),
)
import nest_asyncio

nest_asyncio.apply()
from llama_index.core.query_engine import SubQuestionQueryEngine

query_engine = SubQuestionQueryEngine.from_defaults(
    [vector_tool, summary_tool],
    verbose=True,
)

response = query_engine.query(
    "What was mentioned about Meta? How Does it differ from how OpenAI is talked about?"
)

display_response(response)
Generated 3 sub questions.
[vector_search] Q: What are the key points mentioned about Meta in documents?
Batches:   0%|          | 0/1 [00:00<?, ?it/s]
[vector_search] A: 1. Meta is building large language models (LLMs) and generative AI, similar to OpenAI.

2. Meta has developed 28 personality-driven chatbots for its messaging apps, featuring voices of celebrities like Charli D'Amelio, Dwyane Wade, Kendall Jenner, MrBeast, Snoop Dogg, Tom Brady, and Paris Hilton.

3. Meta's chatbots are designed to have brief and often cringe-worthy character descriptions, with MrBeast's Zach being described as "MrBeast, the guy who will roast you because he cares."

4. Meta's chatbots are intended to provide users with a taste of interacting with AI, allowing them to get a feel for AI Snoop Dogg before any potential issues are ironed out.

5. Meta's chatbots are seen as a step towards a synthetic social network, where AI characters will be present on every major surface of the company's products, including Facebook pages, Instagram accounts, and messaging inboxes.

6.
[vector_search] Q: What are the key points mentioned about OpenAI in documents?
Batches:   0%|          | 0/1 [00:00<?, ?it/s]
[vector_search] A: 1. OpenAI announced the latest updates for ChatGPT, including a feature that allows users to interact with its large language model via voice.

2. The addition of a voice to ChatGPT gives it a hint of personality, making it feel more powerful as a mobile app and potentially more empathetic and helpful.

3. OpenAI's products are typically presented as productivity tools, but the company is also exploring uses for generative AI and voices in the entertainment industry.

4. OpenAI has developed 28 personality-driven chatbots for use in Meta's messaging apps, with celebrity voices lending their personalities to the bots.

5. The voice feature for ChatGPT is currently rolling out to ChatGPT Plus subscribers, with free users expected to gain access in the future.
[summary] Q: How does Meta differ from OpenAI in terms of mentioned facts?
[summary] A: Meta and OpenAI differ in their approach and applications of artificial intelligence (AI) based on the mentioned facts. OpenAI primarily presents its products as productivity tools, focusing on simple utilities for getting things done, such as the ChatGPT AI that can now provide voice responses and offer pep talks. On the other hand, Meta, which is in the entertainment business, is building its own uses for generative AI and voices, creating personality-driven chatbots for its messaging apps. These chatbots are designed to mimic celebrities and offer unique interactions, such as AI Taylor Swift or MrBeast. While OpenAI's ChatGPT is more focused on productivity and utility, Meta's AI characters aim to provide entertainment and novelty, potentially transforming social networking into a partially synthetic experience.

Final Response:

Meta 参与了大型语言模型和生成式人工智能的创建,与 OpenAI 类似,但它采取了独特的方法,为其消息应用程序开发个性驱动的聊天机器人。 这些聊天机器人具有名人的声音,旨在提供独特的互动,例如流行人物的人工智能版本。 相比之下,OpenAI 的重点是生产力工具,其 ChatGPT AI 提供语音响应和基于实用程序的交互。 Meta 的努力更倾向于娱乐和合成社交网络的潜力,而 OpenAI 则强调生产力和效率的实际应用。

SQL查询引擎

import locale

locale.getpreferredencoding = lambda: "UTF-8"
!curl "https://www.sqlitetutorial.net/wp-content/uploads/2018/03/chinook.zip" -O "./chinook.zip"
!unzip "./chinook.zip"
from sqlalchemy import (
    create_engine,
    MetaData,
    Table,
    Column,
    String,
    Integer,
    select,
    column,
)

engine = create_engine("sqlite:///chinook.db")
from llama_index.core import SQLDatabase

sql_database = SQLDatabase(engine)
from llama_index.core.indices.struct_store import NLSQLTableQueryEngine

query_engine = NLSQLTableQueryEngine(
    sql_database=sql_database,
    tables=["albums", "tracks", "artists"],
)
response = query_engine.query("What are some albums? Limit to 5.")

display_response(response)
INFO:llama_index.core.indices.struct_store.sql_retriever:> Table desc str: Table 'albums' has columns: AlbumId (INTEGER), Title (NVARCHAR(160)), ArtistId (INTEGER), and foreign keys: ['ArtistId'] -> artists.['ArtistId'].

Table 'tracks' has columns: TrackId (INTEGER), Name (NVARCHAR(200)), AlbumId (INTEGER), MediaTypeId (INTEGER), GenreId (INTEGER), Composer (NVARCHAR(220)), Milliseconds (INTEGER), Bytes (INTEGER), UnitPrice (NUMERIC(10, 2)), and foreign keys: ['MediaTypeId'] -> media_types.['MediaTypeId'], ['GenreId'] -> genres.['GenreId'], ['AlbumId'] -> albums.['AlbumId'].

Table 'artists' has columns: ArtistId (INTEGER), Name (NVARCHAR(120)), and foreign keys: .
> Table desc str: Table 'albums' has columns: AlbumId (INTEGER), Title (NVARCHAR(160)), ArtistId (INTEGER), and foreign keys: ['ArtistId'] -> artists.['ArtistId'].

Table 'tracks' has columns: TrackId (INTEGER), Name (NVARCHAR(200)), AlbumId (INTEGER), MediaTypeId (INTEGER), GenreId (INTEGER), Composer (NVARCHAR(220)), Milliseconds (INTEGER), Bytes (INTEGER), UnitPrice (NUMERIC(10, 2)), and foreign keys: ['MediaTypeId'] -> media_types.['MediaTypeId'], ['GenreId'] -> genres.['GenreId'], ['AlbumId'] -> albums.['AlbumId'].

Table 'artists' has columns: ArtistId (INTEGER), Name (NVARCHAR(120)), and foreign keys: .

Final Response:

以下是五张热门专辑:

  1. “对于那些即将摇滚的人,我们向你们致敬”
  2. “竭尽全力”
  3. “不安和狂野”
  4. “让这里有摇滚”
  5. 《大人物》

这些专辑在音乐界产生了重大影响,并受到歌迷和评论家的高度评价。

response = query_engine.query("What are some artists? Limit it to 5.")

display_response(response)

​​​​​​​

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

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

Golang | Leetcode Golang题解之第58题最后一个单词的长度

题目&#xff1a; 题解&#xff1a; func lengthOfLastWord(s string) (ans int) {index : len(s) - 1for s[index] {index--}for index > 0 && s[index] ! {ansindex--}return }

虚拟机扩容-根目录挂载sda1的空间不足

提醒&#xff01;不管成不成功&#xff0c;一定要先备份一份虚拟机&#xff01;&#xff01;&#xff01;&#xff01;&#xff01; 走过路过点个关注吧&#xff0c;想到500粉丝&#xff0c;哭。一、查看分区情况 df -h可以看到/dev/sda1已经被占满了 2.关闭虚拟机&#xff…

windows驱动开发-WDF对象

WDF封装了大量的WDF对象&#xff0c;不过&#xff0c;和应用层不一样&#xff0c;不用去尝试从WDF框架对象类上派生和改写原有的WDF类&#xff0c;本意WDF就是希望我们使用这些对象和类&#xff0c;而不是创造新的奇怪的类。 每个WDF对象都代表着对一项驱动需要使用的子功能的…

vue学习的预备知识为学好vue打好基础

目录 Vue是什么 &#xff1f;如何使用Vue &#xff1f;Vue ApiVue入口apiVue实例apiVue函数api 无构建过程的渐进式增强静态HTMLVue模块化构建工具npmyarnWebpackvue-cliVite Vue是什么 &#xff1f; 文章基于Vue3叙述。 Vue (发音为 /vjuː/&#xff0c;类似 view) 是一款用于…

179. 最大数(LeetCode)

文章目录 前言一、题目讲解二、算法原理三、代码编写1.仿函数写法2.lambda表达式 四、验证五.总结 前言 在本篇文章中&#xff0c;我们将会带着大家采用贪心的方法解决LeetCode中最大数这道问题&#xff01;&#xff01;&#xff01; 一、题目讲解 一组非负整数&#xff0c;包…

【面试经典 150 | 图】被围绕的区域

文章目录 写在前面Tag题目来源解题思路方法一&#xff1a;深搜方法二&#xff1a;广搜 写在最后 写在前面 本专栏专注于分析与讲解【面试经典150】算法&#xff0c;两到三天更新一篇文章&#xff0c;欢迎催更…… 专栏内容以分析题目为主&#xff0c;并附带一些对于本题涉及到的…

03.Kafka 基本使用

Kafka 提供了一系列脚本用于命令行来操作 kafka。 1 Topic 操作 1.1 创建 Topic 创建一个名为 oldersix-topic 的 topic&#xff0c;副本数设置为3&#xff0c;分区数设置为2&#xff1a; bin/kafka-topics.sh \ --create \ --zookeeper 192.168.31.162:2181 \ --replication…

ROS1快速入门学习笔记 - 07话题消息的定义与使用

目录 一、话题模型 二、自定义话题消息 1. 在功能包下创建msg目录用于存储话题文件 2. 在package.xml文件中添加功能包依赖&#xff1b; 3. 在CMakeLists.txt增加编译选项&#xff1b; 4. 完成编译 5. 配置CMakeLists.txt中的编译规则&#xff08;增加发布者和订阅者&am…

卫浴品牌商家做展示预约小程序的作用是什么

卫浴品牌类别多、普通/智能、场景化等&#xff0c;无论企业还是经销商市场门店都比较饱满&#xff0c;虽然市场需求度高&#xff0c;但同样需要商家不断拓宽销售渠道和挖掘客户价值&#xff0c;破圈增长。 线上多平台发展尤为重要&#xff0c;而小程序作为连接点&#xff0c;对…

ctf web-部分

** web基础知识 ** *一.反序列化 在PHP中&#xff0c;反序列化通常是指将序列化后的字节转换回原始的PHP对象或数据结构的过程。PHP中的序列化和反序列化通过serialize()和unserialize()函数实现。 1.序列化serialize() 序列化说通俗点就是把一个对象变成可以传输的字符串…

就业班 第三阶段(nginx) 2401--4.26 day5 nginx5 nginx https部署实战

三、HTTPS 基本原理 1、https 介绍 HTTPS&#xff08;全称&#xff1a;HyperText Transfer Protocol over Secure Socket Layer&#xff09;&#xff0c;其实 HTTPS 并不是一个新鲜协议&#xff0c;Google 很早就开始启用了&#xff0c;初衷是为了保证数据安全。 近些年&…

ArcGIS小技巧—模型构建器快速提取河网

上篇文章介绍的基于DEM的河网提取&#xff0c;需要使用多个工具&#xff0c;整体操作比较繁琐&#xff0c;在日常工作中&#xff0c;使用Arcgis提供的模型构建器可以帮助我们将多个工具整合在一起&#xff0c;在面对大量数据批量处理时&#xff0c;可以大大提高工作效率 利用模…

【题解】—— LeetCode一周小结17

【题解】—— 每日一道题目栏 上接&#xff1a;【题解】—— LeetCode一周小结16 22.组合总和 Ⅳ 题目链接&#xff1a;377. 组合总和 Ⅳ 给你一个由 不同 整数组成的数组 nums &#xff0c;和一个目标整数 target 。请你从 nums 中找出并返回总和为 target 的元素组合的个数…

基于SSM的“个性化电子相册”的设计与实现(源码+数据库+文档+PPT)

基于SSM的“个性化电子相册”的设计与实现&#xff08;源码数据库文档PPT) 开发语言&#xff1a;Java 数据库&#xff1a;MySQL 技术&#xff1a;SSM 工具&#xff1a;IDEA/Ecilpse、Navicat、Maven 系统展示 个性化电子相册功能结构图 系统后台界面 会员信息管理界面 相…

在网站源码后台增加响应式布局

一本教材上的网站源码&#xff0c;后台在手机上查看还是按照电脑的页面样式&#xff0c;不方便查看和发布新内容。教材上讲了响应式布局。对于页面结构简单的网站&#xff0c;可以利用响应式&#xff0c;使页面自动适用各种屏幕的分辨率。 今天在一个网站源码的后台使用了响应…

经典案例:学习 Java 异常处理的最佳实践

哈喽&#xff0c;各位小伙伴们&#xff0c;你们好呀&#xff0c;我是喵手。 今天我要给大家分享一些自己日常学习到的一些知识点&#xff0c;并以文字的形式跟大家一起交流&#xff0c;互相学习&#xff0c;一个人虽可以走的更快&#xff0c;但一群人可以走的更远。 我是一名后…

OpenCV如何模板匹配

返回:OpenCV系列文章目录&#xff08;持续更新中......&#xff09; 上一篇&#xff1a;OpenCV如何实现背投 下一篇 &#xff1a;OpenCV在图像中寻找轮廓 目标 在本教程中&#xff0c;您将学习如何&#xff1a; 使用 OpenCV 函数 matchTemplate()搜索图像贴片和输入图像之间…

为什么我的Mac运行速度变慢 mac运行速度慢怎么办 如何使用CleanMyMac X修复它

近些年伴随着苹果生态的蓬勃发展&#xff0c;越来越多的用户开始尝试接触Mac电脑。然而很多人上手Mac后会发现&#xff0c;它的使用逻辑与Windows存在很多不同&#xff0c;而且随着使用时间的增加&#xff0c;一些奇奇怪怪的文件也会占据有限的磁盘空间&#xff0c;进而影响使用…

电脑已经有了一个Windows10,再多装一个Windows10组成双系统

前言 前段时间已经讲过一次双Windows系统的安装教程&#xff0c;但是小白重新去看了一下&#xff0c;发现写的内容太多&#xff0c;怕小伙伴看了之后一脸萌。 所以今天咱们就重新再来讲讲&#xff1a;在同一台机器上安装Windows10双系统的教程。 注意哦&#xff01;这里的Wi…

用来传输文件的协议-FTP

一.FTP协议--文件传输协议 1.了解FTP协议 &#xff08;1&#xff09;FTP服务是用来传输文件的协议 FTP&#xff08;File Transfer Protocol&#xff0c;文件传输协议&#xff09;是TCP/IP协议组中的协议之一&#xff0c;用于互联网上的控制文件的双向传输。是传输文件到Linu…