Meta Llama 3 正式发布!如何在线体验和本地安装部署?

Meta 宣布推出下一代开源大语言模型Llama 3,标志着AI发展新里程碑。该模型分为80亿和700亿参数两个版本,被誉为”Llama 2的重大飞跃”,为大规模语言模型树立新标杆。

值得一提的是,Llama 3已与Meta AI助手深度集成,未来还将陆续在AWS、Databricks、Google Cloud等多个云平台上线,并获得AMD、Intel、NVIDIA等硬件厂商的支持,进一步扩大应用场景。

该模型的发布彰显了Meta在开源AI领域的决心和影响力。我们有理由期待,Llama 3将为自然语言处理、机器学习等AI前沿技术的发展注入新动力。

在线使用:【链接直达

不仅可以智能对话,也可以在线生成图片

图片[1]-Meta Llama 3 正式发布!如何在线体验和本地安装部署?-零度会员 图片[2]-Meta Llama 3 正式发布!如何在线体验和本地安装部署?-零度会员

 

本地安装部署:

1.从github下载Llama 3 项目文件

点击下载】、【网盘下载

2.申请模型下载链接 (申请秒过)

点击申请

申请后会在邮件里提供一个下载链接

3.安装环境依赖

在Llama3最高级目录执行以下命令(建议在安装了python的conda环境下执行)

pip install -e .

4.下载Llama3模型,执行以下命令:

bash download.sh

 

运行命令后在终端下输入邮件里获取到下载链接,并选择你需要的模型,比如我选择8B-instruct

图片[3]-Meta Llama 3 正式发布!如何在线体验和本地安装部署?-零度会员

 

如果你在下载的时候出现这个错误,那是因为你电脑上没有安装Wget命令的环境,你只需【下载wget】、或【网盘下载

下载以后把wget.exe程序放在C:\Windows\System32 目录下就可以解决!看零度视频里的演示即可

 

图片[4]-Meta Llama 3 正式发布!如何在线体验和本地安装部署?-零度会员

5. 运行示例脚本,执行以下命令:

torchrun --nproc_per_node 1 example_chat_completion.py \
    --ckpt_dir Meta-Llama-3-8B-Instruct/ \
    --tokenizer_path Meta-Llama-3-8B-Instruct/tokenizer.model \
    --max_seq_len 512 --max_batch_size 6

 

6.创建自己的对话脚本,在根目录下创建以下chat.py脚本

# Copyright (c) Meta Platforms, Inc. and affiliates.
# This software may be used and distributed in accordance with the terms of the Llama 3 Community License Agreement.

from typing import List, Optional

import fire

from llama import Dialog, Llama


def main(
    ckpt_dir: str,
    tokenizer_path: str,
    temperature: float = 0.6,
    top_p: float = 0.9,
    max_seq_len: int = 512,
    max_batch_size: int = 4,
    max_gen_len: Optional[int] = None,
):
    """
    Examples to run with the models finetuned for chat. Prompts correspond of chat
    turns between the user and assistant with the final one always being the user.

    An optional system prompt at the beginning to control how the model should respond
    is also supported.

    The context window of llama3 models is 8192 tokens, so `max_seq_len` needs to be <= 8192.

    `max_gen_len` is optional because finetuned models are able to stop generations naturally.
    """
    generator = Llama.build(
        ckpt_dir=ckpt_dir,
        tokenizer_path=tokenizer_path,
        max_seq_len=max_seq_len,
        max_batch_size=max_batch_size,
    )

    # Modify the dialogs list to only include user inputs
    dialogs: List[Dialog] = [
        [{"role": "user", "content": ""}],  # Initialize with an empty user input
    ]

    # Start the conversation loop
    while True:
        # Get user input
        user_input = input("You: ")
        
        # Exit loop if user inputs 'exit'
        if user_input.lower() == 'exit':
            break
        
        # Append user input to the dialogs list
        dialogs[0][0]["content"] = user_input

        # Use the generator to get model response
        result = generator.chat_completion(
            dialogs,
            max_gen_len=max_gen_len,
            temperature=temperature,
            top_p=top_p,
        )[0]

        # Print model response
        print(f"Model: {result['generation']['content']}")

if __name__ == "__main__":
    fire.Fire(main)

运行以下命令就可以开始对话:

torchrun --nproc_per_node 1 chat.py     --ckpt_dir Meta-Llama-3-8B-Instruct/     --tokenizer_path Meta-Llama-3-8B-Instruct/tokenizer.model     --max_seq_len 512 --max_batch_size 6

 

THE END
点赞2176 分享
相关推荐
Inpaint(图片修复、放大)神器!纯浏览器端实现,完全免费开源-零度会员

Inpaint(图片修复、放大)神器!纯浏览器端实现,完全免费开源

Inpaint 是一个免费的开源修复和图像放大工具,由浏览器上的 webgpu 和 wasm 提供支持。 基于Webgpu技术和wasm技术的开源免费图像修复工具,纯浏览器端实现。 在线体验:【点击前往】 开源项目...
admin的头像-零度会员admin
2.3W+2176
爆火的AI一键换装软件! 只需2步,效果杠杠的!!完全免费开源,IDM-VTON :更衣更强、更容易! | 零度解说-零度会员

爆火的AI一键换装软件! 只需2步,效果杠杠的!!完全免费开源,IDM-VTON :更衣更强、更容易! | 零度解说

https://www.youtube.com/watch?v=ByAxQ11nWTg ================ AI 换装软件下载:https://www.lingdu80.com/12310.html A I视频换脸软件:https://www.lingdu80.com/10691.html
惨!200个比特币瞬间被盗走,损失超1000多万美金!只因一个小小的疏忽 | 零度解说-零度会员
Windows 11 必装的五款神器!完全免费开源,你一定不能错过 | 零度解说-零度会员

Windows 11 必装的五款神器!完全免费开源,你一定不能错过 | 零度解说

https://youtu.be/qdGDpsoCBN8   1、UniGetUI 批量管理软件:https://www.lingdu80.com/13166.html 2、深度精简 Windows 11 :https://youtu.be/qdGDpsoCBN8?si=R6xznG7WLQv3kcMI&t=20...
【终身限免】WinToHDD Professional 终身密钥及下载!-零度会员

【终身限免】WinToHDD Professional 终身密钥及下载!

WinToHDD 旨在简化 Windows(Vista/2008 及更高版本)的安装或重装流程,无需 CD/DVD/USB 驱动器。这款一体化 Windows 部署工具允许用户轻松重装 Windows、将其安装到其他磁盘或将现有 Windows ...
admin的头像-零度会员admin
2.4W+1035
全网爆火的AI角色唱歌视频!小白也能做,最强保姆级教程!(免费开源工具)-零度会员

全网爆火的AI角色唱歌视频!小白也能做,最强保姆级教程!(免费开源工具)

在短短几个月里,AI 歌手视频已经从小众玩法,变成全网刷屏的新风口。无论是角色翻唱、虚拟偶像唱歌,还是把动漫人物做成歌手,都能轻松获得超高播放量。更重要的是——就算你完全没有音乐基础...
admin的头像-零度会员admin
7.7W+741
有了它,电脑瞬间跑的飞快!内置 Google Play 应用商店,支持安卓APP,老旧笔记本焕发第二春!FydeOS18 最新安装教程!| 零度解说-零度会员
赶紧下载!5款“限时免费”软件,得到就是赚到,立马帮你省下好几百刀!| 零度解说-零度会员

赶紧下载!5款“限时免费”软件,得到就是赚到,立马帮你省下好几百刀!| 零度解说

https://youtu.be/u6NWyeQG9ik?si=ldLdFqdqbMICSxQ-   1、旧电脑转移到新电脑的神器: https://www.lingdu80.com/21214.html 2、重复照片查找工具: https://www.lingdu80.com/21198.html ...
admin的头像-零度会员admin
1.1W+1314
DarkSushi:模型非常适合绘制复杂场景,模型推荐NO.5-零度会员

DarkSushi:模型非常适合绘制复杂场景,模型推荐NO.5

DarkSushi:模型非常适合绘制复杂场景的二次元插画,并能够呈现出正常亮度和出色的光影效果。 【点击下载】Dark Sushi 2.5D 大颗寿司2.5D 模型,注意:部分地区用户如果无法下载,可以使用VPN进...
admin的头像-零度会员admin
1.8W+1682