首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >专栏 >Meta Llama 3 模型与亚马逊 Bedrock 完美融合,释放无限潜能。如何通过SageMaker来部署和运行推理

Meta Llama 3 模型与亚马逊 Bedrock 完美融合,释放无限潜能。如何通过SageMaker来部署和运行推理

作者头像
Maynor
发布于 2024-05-26 03:07:31
发布于 2024-05-26 03:07:31
23900
代码可运行
举报
运行总次数:0
代码可运行

Meta Llama 3模型现在在亚马逊Bedrock上可用

今天,宣布[Meta 的 Llama 3 模型在 Amazon Bedrock 全面上市。 Meta Llama 3 专为构建、实验和负责任地扩展生成式人工智能(AI) 应用程序而设计。新的 Llama 3 模型最有能力支持广泛的用例,并在推理、代码生成和指令方面进行了改进。更多免费试用产品链接

Llama 3 模型

根据Meta 的 Llama 3 公告,Llama 3 模型系列是一组经过预训练和指令调整的大型语言模型 (LLM),参数大小为 8B 和 70B。这些模型已经过超过 15 万亿个令牌的数据训练,训练数据集比Llama 2 模型使用的训练数据集大七倍,包括四倍多的代码,支持 8K 上下文长度,使 Llama 2 的容量增加了一倍。

现在可以在Amazon Bedrock中使用两种新的 Llama 3 模型,进一步增加 Amazon Bedrock 中的模型选择。这些模型使能够轻松试验和评估适合的用例的更多顶级基础模型 (FM):

  • Llama 3 8B非常适合有限的计算能力和资源以及边缘设备。该模型擅长文本摘要、文本分类、情感分析和语言翻译。
  • Llama 3 70B 非常适合内容创建、对话式 AI、语言理解、研究开发和企业应用程序。该模型擅长文本摘要和准确性、文本分类和细微差别、情感分析和细微差别推理、语言建模、对话系统、代码生成和遵循指令。

Meta 目前还在训练额外的 Llama 3 模型,参数大小超过 400B。这些 400B 模型将具有新功能,包括多模态、多语言支持和更长的上下文窗口。发布后,这些模型将非常适合内容创建、对话式 AI、语言理解、研发 (R&D) 和企业应用程序。

Llama 3 模型的实际应用

如果不熟悉使用元模型,请转到Amazon Bedrock 控制台并选择左下窗格中的模型访问。要从 Meta 访问最新的 Llama 3 模型,请单独请求访问Llama 3 8B InstructLlama 3 70B Instruct

要在 Amazon Bedrock 控制台中测试 Meta Llama 3 模型,请选择左侧菜单窗格中Playgrounds下的文本聊天。然后选择选择模型并选择Meta作为类别,选择Llama 8B InstructLlama 3 70B Instruct作为模型。

通过选择View API request ,还可以使用命令行界面 (亚马逊云科技 CLI)亚马逊云科技开发工具包中的代码示例访问模型。可以使用模型 ID,例如meta.llama3-8b-instruct-v1meta.llama3-70b-instruct-v1

以下是 亚马逊云科技 CLI 命令的示例:

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
$ aws bedrock-runtime invoke-model \
  --model-id meta.llama3-8b-instruct-v1:0 \
  --body "{\"prompt\":\"Simply put, the theory of relativity states that\\n the laws of physics are the same everywhere in the universe, and that the passage of time and the length of objects can vary depending on their speed and position in a gravitational field \",\"max_gen_len\":512,\"temperature\":0.5,\"top_p\":0.9}" \
  --cli-binary-format raw-in-base64-out \
  --region us-east-1 \
  invoke-model-output.txt

可以使用亚马逊云科技 开发工具包使用Amazon Bedrock 的代码示例来使用各种编程语言构建应用程序。以下 Python 代码示例展示了如何调用 Amazon Bedrock 中的 Llama 3 Chat 模型来生成文本。

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
def invoke_llama3(self, prompt):
        try:
            body = {
                "prompt": prompt,
                "temperature": 0.5,
                "top_p": 0.9,
                "max_gen_len": 512,
            }

            response = self.bedrock_runtime_client.invoke_model(
                modelId="meta.llama3-8b-instruct-v1:0", body=json.dumps(body)
            )

            response_body = json.loads(response["body"].read())
            completion = response_body["generation"]

            return completion

        except ClientError:
            logger.error("Couldn't invoke Llama 3")
            raise

可以使用这些 Llama 3 模型执行各种任务,例如问答、语言翻译、情感分析等。以下是 Llama 3 模型的示例,其中提供了模型可用的训练样本,其中包含少量上下文学习。

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
Input: Translate English to French:
sea otter => loutre de mer
peppermint => menthe poivrée
plush girafe => girafe peluche
cheese =>
Output:  fromage
panda => panda
penguin => pingouin
polar bear => ours polaire
puffin => macareux
sloth => paresseux
walrus => morse
whale => baleine
zebra => z\u00e8bre

Translate English to German:
sea otter => Seeotter

还可以使用针对对话用例优化的 Llama 3 指令模型。指令模型端点的输入是聊天助手和用户之间的先前历史记录。因此,可以提出与目前已发生的对话相关的问题,并提供系统配置,例如角色,它按以下格式定义聊天助理的行为:

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
[SYSTEM_TEXT]<|eot_id|><|start_header_id|>user<|end_header_id|>
[USER_TEXT]<|eot_id|><|start_header_id|>assistant<|end_header_id|>

在以下示例中,用户与助理就巴黎的旅游景点进行对话。然后,用户查询聊天助手推荐的第一个选项。

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
Input: <|begin_of_text|><|start_header_id|>user<|end_header_id|>\n\n
I am going to Paris, what should I see?<|eot_id|><|start_header_id|>assistant<|end_header_id|>\n\n
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\n
1. The Eiffel Tower: The iconic Eiffel Tower is one of the most recognizable landmarks in the world and offers breathtaking views of the city.\n
2. 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.\n
3. 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\n
These 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.<|eot_id|><|start_header_id|>user<|end_header_id|>\n\n
What is so great about #1?<|eot_id|><|start_header_id|>assistant<|end_header_id|>\n\n
Output: The Eiffel Tower! It's an iconic symbol of Paris and one of the most recognizable landmarks in the world. Here are some reasons why it's so great:\n\n
1. **Engineering marvel**: When it was built for the 1889 World's Fair, the Eiffel Tower was a groundbreaking feat of engineering. It was the tallest structure in the world at the time, standing at 324 meters (1,063 feet).\n
2. **Panoramic views**: The Eiffel Tower offers breathtaking 360-degree views of the city from its observation decks. You can see many of Paris' famous landmarks, such as the Seine River, the Louvre, and Montmartre.\n
3. **Romantic atmosphere**: The Eiffel Tower is often associated with romance and is a popular spot for proposals, weddings, and romantic dinners. The tower's iron latticework and twinkling lights at night add to its romantic ambiance.\n
4. **Historical significance**: The Eiffel Tower has played a significant role in French history, serving as a communication tower during World War I and a symbol of French culture and engineering.\n
5. **Accessibility**: The Eiffel Tower is easily accessible by public transportation or on foot, and there are various ways to experience it, including taking the stairs, elevator, or a guided tour.\n
6. **Nighttime spectacle**: The Eiffel Tower is even more magical at night, when it's illuminated with thousands of twinkling lights. The light show, known as the \"Eiffel Tower Sparkle,\" takes place every hour on the hour from dusk to midnight.\n
7. **Iconic status**: The Eiffel Tower has been featured in countless films, literature, and art, making it an instantly recognizable symbol of Paris and France.\n\n
Overall, the Eiffel Tower is a must-visit attraction in Paris, offering a unique combination of history, engineering, romance, and stunning views.

Meta Llama 3 基础模型可通过 Amazon SageMaker JumpStart来部署和运行推理。 Llama 3 模型是预先训练和微调的生成文本模型的集合。

在这篇文章中,将介绍如何通过 SageMaker JumpStart 发现和部署 Llama 3 模型。

什么是 Meta Llama 3

Llama 3 有两种参数大小 - 8B 和 70B,上下文长度为 8k - 可以支持广泛的用例,并在推理、代码生成和指令跟踪方面进行改进。 Llama 3 使用仅解码器的转换器架构和新的分词器,以 128k 大小提供改进的模型性能。此外,Meta 改进了训练后程序,大大降低了错误拒绝率,改善了对齐,并增加了模型响应的多样性。现在,可以通过 Amazon SageMaker 功能(例如 SageMaker Pipelines、SageMaker Debugger 或容器日志)获得 Llama 3 性能和 MLOps 控制的综合优势。此外,该模型将部署在的 VPC 控制下的 亚马逊云科技 安全环境中,帮助提供数据安全

什么是 SageMaker JumpStart

借助 SageMaker JumpStart,可以从多种公开可用的基础模型中进行选择。 ML 从业者可以将基础模型从网络隔离环境部署到专用 SageMaker 实例,并使用 SageMaker 自定义模型以进行模型训练和部署。现在,只需在Amazon SageMaker Studio中单击几下或通过 SageMaker Python SDK 以编程方式发现和部署 Llama 3 模型 ,即可使用SageMaker PipelinesSageMaker Debugger或容器日志等 SageMaker 功能获得模型性能和 MLOps 控制。该模型部署在 亚马逊云科技 安全环境中并受的 VPC 控制,有助于提供数据安全。 Llama 3 模型现已推出,可在us-east-1(弗吉尼亚北部)、us-east-2(俄亥俄)、us-west-2(俄勒冈)、eu-west-1(爱尔兰)和ap-northeast-1(东京)亚马逊云科技 区域的 Amazon SageMaker Studio 中进行部署和推理。

探索型号

可以通过 SageMaker Studio UI 和 SageMaker Python SDK 中的 SageMaker JumpStart 访问基础模型。在本节中,将介绍如何在 SageMaker Studio 中发现模型。

SageMaker Studio 是一个集成开发环境 (IDE),提供基于 Web 的单一可视化界面,可以在其中访问专用工具来执行所有 ML 开发步骤,从准备数据到构建、训练和部署 ML 模型。有关如何开始和设置 SageMaker Studio 的更多详细信息,请参阅Amazon SageMaker Studio

在 SageMaker Studio 中,可以访问 SageMaker JumpStart,其中包含预训练模型、笔记本和预构建解决方案,位于预构建和自动化解决方案下。

在 SageMaker JumpStart 登录页面中,可以通过浏览以模型提供商命名的不同中心轻松发现各种模型。可以在 Meta hub 中找到 Llama 3 模型。如果没有看到 Llama 3 模型,请通过关闭并重新启动来更新的 SageMaker Studio 版本。有关更多信息,请参阅关闭和更新 Studio 经典应用程序

可以通过在左上角的搜索框中搜索“Meta-llama-3”来找到 Llama 3 型号。

可以通过单击 Meta 中心发现 SageMaker JumpStart 中可用的所有 Meta 模型。

单击模型卡片将打开相应的模型详细信息页面,可以从中轻松部署模型。

部署模型

当选择部署并确认 EULA 条款时,部署将开始。

可以在单击“部署”按钮后显示的页面上监控部署进度。

或者,可以选择**“打开笔记本”**以通过示例笔记本进行部署。该示例笔记本提供了有关如何部署模型进行推理和清理资源的端到端指导。

要使用笔记本进行部署,首先要选择适当的模型,由 model_id.可以使用以下代码在 SageMaker 上部署任何选定的模型。

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
from sagemaker.jumpstart.model import JumpStartModel

model = JumpStartModel(model_id = "meta-textgeneration-llama-3-70b-instruct")
predictor = model.deploy(accept_eula=False)

默认 accept_eula设置为False。需要手动接受 EULA 才能成功部署端点。这样做即表示接受用户许可协议和可接受的使用策略。还可以在 Llama 网站上找到许可协议 。这会使用默认配置(包括默认实例类型和默认 VPC 配置)在 SageMaker 上部署模型。可以通过在 中指定非默认值来更改这些配置JumpStartModel。要了解更多信息,请参阅以下 文档

下表列出了 SageMaker JumpStart 中可用的所有 Llama 3 模型,以及 model_ids每个模型支持的默认实例类型和最大总令牌数(输入令牌数和生成令牌数的总和)。

型号名称

型号编号

最大总代币数

默认实例类型

元骆驼-3-8B

元文本生成-llama-3-8b

8192

ml.g5.12xlarge

Meta-Llama-3-8B-指令

元文本生成-llama-3-8b-指令

8192

ml.g5.12xlarge

元羊驼-3-70B

元文本生成-llama-3-70b

8192

ml.p4d.24xlarge

Meta-Llama-3-70B-指令

元文本生成-llama-3-70b-指令

8192

ml.p4d.24xlarge

运行推理

部署模型后,可以通过 SageMaker 预测器对部署的终端节点运行推理。经过微调的指令模型(Llama 3:8B Instruct 和 70B Instruct)接受用户和聊天助理之间的聊天历史记录,并生成后续聊天。预训练模型(Llama 3:8B 和 70B)需要字符串提示并根据提供的提示执行文本完成。

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
predictor.predict(payload)

推理参数控制端点处的文本生成过程。 Max 新标记控制模型生成的输出的大小。这与单词数不同,因为模型的词汇与英语词汇不同,并且每个标记可能不是英语单词。温度参数控制输出的随机性。较高的温度会产生更多的创造性和幻觉输出。所有推理参数都是可选的。

70B 型号的提示示例

可以使用 Llama 3 模型完成任何文本片段的文本补全。通过文本生成,可以执行各种任务,例如问答、语言翻译和情感分析等。端点的输入有效负载类似于以下代码:

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
payload = {
    “inputs”: str,
   (optional)"parameters":{"max_new_tokens":int, "top_p":float, "temperature":float}
}

以下是一些示例提示和模型生成的文本。所有输出都是使用推理参数生成的 {"max_new_tokens":64, "top_p":0.9, "temperature":0.6}

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
Input: Simply put, the theory of relativity states that
Output: 1) the laws of physics are the same for all observers, and 2) the speed of light is constant for all observers. The first part of the theory is known as the special theory of relativity, and the second part is known as the general theory of relativity.\nThe special theory of relativity states

Input: I believe the meaning of life is
Output:  to live a life of purpose, on purpose. I believe that we are all here to make a difference in the world, and that we are all here to make a difference in the lives of others. I believe that we are all here to make a difference in the world, and that we are all here to mak

Input: A brief message congratulating the team on the launch:\n\nHi everyone,\n\nI just 
Output: wanted to say congratulations on the launch of the new website! It looks great and I'm sure it will be a valuable resource for our customers. I know that a lot of hard work went into making this happen, so thank you all for your efforts.\n\nBest regards,\nJohn Doe\n

在下一个示例中,将展示如何使用 Llama 3 模型进行少量镜头上下文学习,其中为模型提供可用的训练样本。仅对已部署的模型进行推理,在此过程中,模型权重不会改变。

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
Input:
Translate English to French:\nsea otter => loutre de mer\npeppermint => menthe poivrée\nplush girafe => girafe peluche\ncheese =>
Output:  fromage\npanda => panda\npenguin => pingouin\npolar bear => ours polaire\npuffin => macareux\nsloth => paresseux\nwalrus => morse\nwhale => baleine\nzebra => z\u00e8bre\nTranslate English to German:\n

70B-Instruct 型号的示例提示

通过针对对话用例进行优化的 Llama 3 指令模型,指令模型端点的输入是聊天助手和用户之间的先前历史记录。可以提出与目前所发生的对话相关的问题。还可以提供系统配置,例如定义聊天助理行为的角色。虽然输入有效负载格式与基本预训练模型相同,但输入文本应按以下方式格式化:

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
<|begin_of_text|><|start_header_id|>system<|end_header_id|>

[SYSTEM_TEXT]<|eot_id|><|start_header_id|>user<|end_header_id|>

[USER_TEXT]<|eot_id|><|start_header_id|>assistant<|end_header_id|>

在此说明模板中,可以选择从一个system 角色开始,并在回合历史记录中包含所需数量的交替角色。最后的角色应该始终assistant以两个新的换行符结束。

接下来,考虑模型的一些示例提示和响应。在以下示例中,用户向助理询问一个简单的问题。

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
Input: <|begin_of_text|><|start_header_id|>user<|end_header_id|>\n\nwhat is the recipe of mayonnaise?<|eot_id|><|start_header_id|>assistant<|end_header_id|>\n\n
Output: The classic condiment! Mayonnaise is a thick, creamy emulsion sauce made from a combination of oil, egg yolks, acid (such as vinegar or lemon juice), and seasonings. Here's a simple recipe to make mayonnaise at home:\n\n**Ingredients:**\n\n* 2 egg yolks\n* 1 tablespoon lemon juice or vinegar (such as apple cider vinegar or white wine vinegar)\n* 1/2 teaspoon Dijon mustard (optional, but recommended for flavor)\n* 1/2 cup (120 ml) neutral-tasting oil, such as canola, grapeseed, or sunflower oil\n* Salt, to taste\n\n**Instructions:**\n\n1. **Start with room temperature ingredients**: This is crucial for emulsification to occur.\n2. **In a medium-sized bowl**, whisk together the egg yolks, lemon juice or vinegar, and Dijon mustard (if using) until well combined.\n3. **Slowly add the oil**: While continuously whisking the egg yolk mixture, slowly pour in the oil in a thin, steady stream. Start with a very slow drizzle and gradually increase the flow as the mixture thickens.\n4. **Whisk constantly**: Keep whisking until the mixture has doubled in volume and has a thick, creamy consistency. This should take about 5-7 minutes.\n5. **Check the consistency**: Stop whisking when the mayonnaise has reached the desired consistency. It should be smooth, thick, and hold its shape when the whisk is lifted.\n6. **Season with salt**: Add salt to taste, and whisk until well combined.\n7. **Taste and adjust**: If the mayonnaise is too thick, add a little water. If it's not thick enough, add a little more oil.\n\n**Tips and Variations:**\n\n* Use a neutral-tasting oil to avoid flavoring the mayonnaise.\n* If you're using a stand mixer, use the whisk attachment and start with a slow speed, increasing as needed.\n* Add flavorings like minced garlic, chopped fresh herbs (e.g., parsley, dill, or tarragon), or grated ginger to create different flavor profiles.\n* For a lighter mayonnaise, use only 1 egg yolk or add a little water to thin it out.\n* If the mayonnaise breaks or separates, don't worry! Simply start again with a new egg yolk and slowly whisk in the broken mayonnaise.\n\n**Homemade Mayonnaise vs. Store-Bought:**\n\nWhile store-bought mayonnaise is convenient, homemade mayonnaise offers several advantages:\n\n* Freshness: Homemade mayonnaise is made to order, ensuring optimal flavor and texture.\n* Customization: You can tailor the flavor to your liking with various seasonings and ingredients.\n* No preservatives: Homemade mayonnaise doesn't contain added preservatives, making it a healthier option.\n\nEnjoy your freshly made mayonnaise!

在以下示例中,用户与助理就巴黎的旅游景点进行对话。然后用户询问聊天助手推荐的第一个选项。

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
Input: <|begin_of_text|><|start_header_id|>user<|end_header_id|>\n\nI am going to Paris, what should I see?<|eot_id|><|start_header_id|>assistant<|end_header_id|>\n\nParis, 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.<|eot_id|><|start_header_id|>user<|end_header_id|>\n\nWhat is so great about #1?<|eot_id|><|start_header_id|>assistant<|end_header_id|>\n\n
Output: The Eiffel Tower! It's an iconic symbol of Paris and one of the most recognizable landmarks in the world. Here are some reasons why it's so great:\n\n1. **Engineering marvel**: When it was built for the 1889 World's Fair, the Eiffel Tower was a groundbreaking feat of engineering. It was the tallest structure in the world at the time, standing at 324 meters (1,063 feet).\n2. **Panoramic views**: The Eiffel Tower offers breathtaking 360-degree views of the city from its observation decks. You can see many of Paris' famous landmarks, such as the Seine River, the Louvre, and Montmartre.\n3. **Romantic atmosphere**: The Eiffel Tower is often associated with romance and is a popular spot for proposals, weddings, and romantic dinners. The tower's iron latticework and twinkling lights at night add to its romantic ambiance.\n4. **Historical significance**: The Eiffel Tower has played a significant role in French history, serving as a communication tower during World War I and a symbol of French culture and engineering.\n5. **Accessibility**: The Eiffel Tower is easily accessible by public transportation or on foot, and there are various ways to experience it, including taking the stairs, elevator, or a guided tour.\n6. **Nighttime spectacle**: The Eiffel Tower is even more magical at night, when it's illuminated with thousands of twinkling lights. The light show, known as the \"Eiffel Tower Sparkle,\" takes place every hour on the hour from dusk to midnight.\n7. **Iconic status**: The Eiffel Tower has been featured in countless films, literature, and art, making it an instantly recognizable symbol of Paris and France.\n\nOverall, the Eiffel Tower is a must-visit attraction in Paris, offering a unique combination of history, engineering, romance, and stunning views.

在以下示例中,设置系统的配置。

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
Input: <|begin_of_text|><|start_header_id|>system<|end_header_id|>\n\nAlways answer with Haiku<|eot_id|><|start_header_id|>user<|end_header_id|>\n\nI am going to Paris, what should I see?<|eot_id|><|start_header_id|>assistant<|end_header_id|>\n\n
Output: Eiffel's iron lace\nRiver Seine's gentle flow by\nMontmartre's charm calls
Input: <|begin_of_text|><|start_header_id|>system<|end_header_id|>\n\nAlways answer with emojis<|eot_id|><|start_header_id|>user<|end_header_id|>\n\nHow to go from Beijing to NY?<|eot_id|><|start_header_id|>assistant<|end_header_id|>\n\n
Output:  join 🇺🇸

清理

运行完笔记本后,请确保删除在此过程中创建的所有资源,以便停止计费。使用以下代码:

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
predictor.delete_model()
predictor.delete_endpoint()

结论

在这篇文章中,向展示了如何在 SageMaker Studio 中开始使用 Llama 3 模型。现在可以访问四个包含数十亿个参数的 Llama 3 基础模型。由于基础模型是经过预训练的,因此它们还可以帮助降低培训和基础设施成本,并支持针对的用例进行定制。立即查看SageMaker Studio 中的SageMaker JumpStart以开始使用。

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2024-05-22,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
暂无评论
推荐阅读
编辑精选文章
换一批
Ollama 升级!支持一键拉取Huggingface上所有的模型,太方便了!(vLLM、Fastgpt、Dify、多卡推理)
我记得,梦的开始,源于Ollama。很早以前的一篇文章教大家如何通过 Ollama 来使用开源 LLM,许多人最初接触 AI 时也是从Ollama开始的。Ollama 之所以出色,是因为它使用了 GGML 格式,这是一种‘轻量版’的大语言模型,以较低精度运行,能够轻松适配普通硬件。这使得在本地系统上运行这些模型变得简单高效,真正为 AI 的广泛应用铺平了道路。
AI进修生
2024/12/02
17.3K0
Ollama 升级!支持一键拉取Huggingface上所有的模型,太方便了!(vLLM、Fastgpt、Dify、多卡推理)
Java + LangChain 开发大语言模型应用!
在 Baeldung 上看到了一篇介绍基于 Java + LangChain 开发大语言模型应用的基础入门文章,写的非常不错,非常适合初学者。于是,我抽空翻译了一下。
码农编程进阶笔记
2025/03/29
6810
Java + LangChain 开发大语言模型应用!
使用 LlamaIndex 和 Llama 2-Chat 构建知识驱动的对话应用程序
从大量文本中解锁准确且富有洞察力的答案是大型语言模型 (LLM) 所实现的一项令人兴奋的功能。在构建 LLM 应用程序时,通常需要连接和查询外部数据源以为模型提供相关上下文。一种流行的方法是使用检索增强生成(RAG)来创建问答系统,该系统可以理解复杂的信息并对查询提供自然的响应。 RAG 允许模型利用庞大的知识库,并为聊天机器人和企业搜索助手等应用程序提供类似人类的对话。
Maynor
2024/05/26
5110
使用 LlamaIndex 和 Llama 2-Chat 构建知识驱动的对话应用程序
独家 | 在一个4GBGPU上运行70B大模型推理的新技术
大语言模型通常需要较大的GPU内存。那能不能在单个GPU上运行推理?如果可以,那么所需的最小GPU内存又是多少?
数据派THU
2024/01/07
2.2K0
独家 | 在一个4GBGPU上运行70B大模型推理的新技术
解锁AI Agent潜能:LLaMA3-1-8B-Instruct WebDemo部署实战(20/30)
在当今这个信息呈爆炸式增长的时代,AI Agent 宛如一位智能领航员,稳稳伫立在时代浪潮的前沿。它能自主感知环境变化,凭借自身的 “智慧” 做出精准决策,进而采取高效行动,致力于达成既定目标。从日常生活中的智能语音助手,到商业领域里的智能决策系统,AI Agent 的身影无处不在,已然成为推动各行业智能化转型的核心力量。
正在走向自律
2025/01/25
1650
解锁AI Agent潜能:LLaMA3-1-8B-Instruct WebDemo部署实战(20/30)
Amazon Bedrock + Llama3 生成式AI实践
在 4 月 18 日,Meta在官网上公布了旗下最新大模型Llama 3。目前,Llama 3已经开放了80亿(8B)和700亿(70B)两个小参数版本,上下文窗口为8k,据称,通过使用更高质量的训练数据和指令微调,Llama 3接受了超过 15 万亿个标记数据的训练——比 Llama 2 模型使用的训练数据集大七倍,其中包含四倍于 Llama 2 的代码数据,支持 8K 的上下文长度,是 Llama 2 的两倍。
中杯可乐多加冰
2024/05/11
3190
最新Claude2.1、Llama 2随便用!亚马逊把生成式AI开发门槛打下去了
例如Meta家的Llama 2 70B、Antropic家的Claude 2.1等等:
量子位
2023/12/01
2400
最新Claude2.1、Llama 2随便用!亚马逊把生成式AI开发门槛打下去了
Qwen2大模型微调入门实战(完整代码)
Qwen2是一个开源大语言模型。以Qwen2作为基座大模型,通过指令微调的方式实现高准确率的文本分类,是学习大语言模型微调的入门任务。
用户9029617
2024/06/09
3.6K1
Qwen2大模型微调入门实战(完整代码)
从零到一使用 Ollama、Dify 和 Docker 构建 Llama 3.1 模型服务
本篇文章聊聊,如何使用 Ollama、Dify 和 Docker 来完成本地 Llama 3.1 模型服务的搭建。
soulteary
2024/08/01
1.2K0
从零到一使用 Ollama、Dify 和 Docker 构建 Llama 3.1 模型服务
浅谈宇宙最强开源大模型Llama3如何应用
北京时间4月19日凌晨,Meta公司通过其官方网站宣布了Llama系列的最新开源大模型:Llama-3。
AIGC新知
2024/10/08
4620
浅谈宇宙最强开源大模型Llama3如何应用
教程系列2 | 趋动云『社区项目』一步实现与 AI 对话
Llama3-8B-Chinese-Chat 是一个针对中文和英文用户的指令调整语言模型,具有各种能力,如角色扮演和工具使用,建立在 Meta-Llama-3-8B-Instruct 模型之上。但相较于 Llama3-8B-Instruct,Llama3-8B-Chinese-Chat 模型不会出现中文问题英文回答、中英夹杂的回答的问题,以及说话更为正式(Llama3-8B-Instruct真的很喜欢输出emoji)。
CV君
2024/07/24
1450
教程系列2 | 趋动云『社区项目』一步实现与 AI 对话
在无服务器平台上运行无需GPU的AI模型
哪个CPU平台在运行机器学习任务方面能更好地平衡成本和性能?请跟随我的实验来找出答案。
云云众生s
2024/11/29
3280
在无服务器平台上运行无需GPU的AI模型
大模型SFT全解析:从原理到工具链,解锁AI微调的核心密码
监督微调(Supervised Fine-Tuning, SFT)是一种在预训练语言模型(LLM)基础上,使用高质量标注数据进一步优化模型以适应特定任务或领域的技术。其核心是通过输入-输出对的标注数据(如指令、问题与答案),调整模型参数,使其在特定场景下生成更符合人类期望的响应。
AI浩
2025/05/21
7590
大模型SFT全解析:从原理到工具链,解锁AI微调的核心密码
仅用250美元,Hugging Face技术主管手把手教你微调Llama 3
我们知道,Meta 推出的 Llama 3、Mistral AI 推出的 Mistral 和 Mixtral 模型以及 AI21 实验室推出的 Jamba 等开源大语言模型已经成为 OpenAI 的竞争对手。
zenRRan
2024/05/11
4440
仅用250美元,Hugging Face技术主管手把手教你微调Llama 3
LLM 大模型学习必知必会系列(十三):基于SWIFT的VLLM推理加速与部署实战
使用LoRA进行微调的模型你需要先merge-lora, 产生完整的checkpoint目录.
汀丶人工智能
2024/05/29
1.3K0
LLM 大模型学习必知必会系列(十三):基于SWIFT的VLLM推理加速与部署实战
在Windows电脑上快速运行AI大语言模型-Llama3
近期 Meta 发布了最新的 Llama3 模型,并开源了开源代码。Meta Llama 3 现已推出 8B 和 70B 预训练和指令调整版本,可支持广泛的应用程序。
东风微鸣
2024/04/23
1.8K0
在Windows电脑上快速运行AI大语言模型-Llama3
LLaMA 3.1 模型在DAMODEL平台的部署与实战:打造智能聊天机器人
LLama3.1 是 Meta(Facebook 母公司)发布的系列大语言模型之一,属于 LLaMA(Large Language Model Meta AI)模型系列。LLaMA 模型的目标是通过更高效的设计在保持模型性能的前提下,显著降低其计算和资源需求。LLaMA 3.1 是该系列的最新版本,继承了前面版本,如 LLaMA 1 和 LLaMA 2的许多技术优势,并对模型架构、训练数据和推理能力进行了改进。
易辰君
2024/11/07
2160
LLaMA 3.1 模型在DAMODEL平台的部署与实战:打造智能聊天机器人
从零到一使用 Ollama、Dify 和 Docker 构建 Llama 3.1 模型服务
本篇文章聊聊,如何使用 Ollama、Dify 和 Docker 来完成本地 Llama 3.1 模型服务的搭建。
soulteary
2024/07/28
2.3K0
从零到一使用 Ollama、Dify 和 Docker 构建 Llama 3.1 模型服务
【机器学习】Qwen2大模型原理、训练及推理部署实战
刚刚写完【机器学习】Qwen1.5-14B-Chat大模型训练与推理实战 ,阿里Qwen就推出了Qwen2,相较于Qwen1.5中0.5B、1.8B、4B、7B、14B、32B、72B、110B等8个Dense模型以及1个14B(A2.7B)MoE模型共计9个模型,Qwen2包含了0.5B、1.5B、7B、57B-A14B和72B共计5个尺寸模型。从尺寸上来讲,最关键的就是推出了57B-A14B这个更大尺寸的MoE模型,有人问为什么删除了14B这个针对32G显存的常用尺寸,其实对于57B-A14B剪枝一下就可以得到。
LDG_AGI
2024/08/13
3K0
【机器学习】Qwen2大模型原理、训练及推理部署实战
Xinference实战指南:全面解析LLM大模型部署流程,携手Dify打造高效AI应用实践案例,加速AI项目落地进程
Xorbits Inference (Xinference) 是一个开源平台,用于简化各种 AI 模型的运行和集成。借助 Xinference,您可以使用任何开源 LLM、嵌入模型和多模态模型在云端或本地环境中运行推理,并创建强大的 AI 应用。通过 Xorbits Inference,可以轻松地一键部署你自己的模型或内置的前沿开源模型
汀丶人工智能
2024/08/17
6.7K0
Xinference实战指南:全面解析LLM大模型部署流程,携手Dify打造高效AI应用实践案例,加速AI项目落地进程
推荐阅读
Ollama 升级!支持一键拉取Huggingface上所有的模型,太方便了!(vLLM、Fastgpt、Dify、多卡推理)
17.3K0
Java + LangChain 开发大语言模型应用!
6810
使用 LlamaIndex 和 Llama 2-Chat 构建知识驱动的对话应用程序
5110
独家 | 在一个4GBGPU上运行70B大模型推理的新技术
2.2K0
解锁AI Agent潜能:LLaMA3-1-8B-Instruct WebDemo部署实战(20/30)
1650
Amazon Bedrock + Llama3 生成式AI实践
3190
最新Claude2.1、Llama 2随便用!亚马逊把生成式AI开发门槛打下去了
2400
Qwen2大模型微调入门实战(完整代码)
3.6K1
从零到一使用 Ollama、Dify 和 Docker 构建 Llama 3.1 模型服务
1.2K0
浅谈宇宙最强开源大模型Llama3如何应用
4620
教程系列2 | 趋动云『社区项目』一步实现与 AI 对话
1450
在无服务器平台上运行无需GPU的AI模型
3280
大模型SFT全解析:从原理到工具链,解锁AI微调的核心密码
7590
仅用250美元,Hugging Face技术主管手把手教你微调Llama 3
4440
LLM 大模型学习必知必会系列(十三):基于SWIFT的VLLM推理加速与部署实战
1.3K0
在Windows电脑上快速运行AI大语言模型-Llama3
1.8K0
LLaMA 3.1 模型在DAMODEL平台的部署与实战:打造智能聊天机器人
2160
从零到一使用 Ollama、Dify 和 Docker 构建 Llama 3.1 模型服务
2.3K0
【机器学习】Qwen2大模型原理、训练及推理部署实战
3K0
Xinference实战指南:全面解析LLM大模型部署流程,携手Dify打造高效AI应用实践案例,加速AI项目落地进程
6.7K0
相关推荐
Ollama 升级!支持一键拉取Huggingface上所有的模型,太方便了!(vLLM、Fastgpt、Dify、多卡推理)
更多 >
LV.1
这个人很懒,什么都没有留下~
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档