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环境下执行)

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
pip install -e .
pip install -e .
pip install -e .

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

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
bash download.sh
bash download.sh
bash download.sh

 

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

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

 

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

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

 

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

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

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
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
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
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脚本

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# 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)
# 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)
# 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)

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

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
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
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
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 分享
这些奇奇怪怪的网站,你可曾都用过?-零度博客

这些奇奇怪怪的网站,你可曾都用过?

1.  (超燃 炫酷的网站):【链接】 2. (盲盒 刺激的网站):【链接】 3. (AI生成人脸照片):【链接】 4. (鼠标指向 手指指向):【链接】 5. (人脸卡通形象生成器):【链接】 6. (国际空...
一键删除 Windows 自带的臃肿软件!只需这行代码,让你的电脑更高效运行!| 零度解说-零度博客
如何更改 iTunes 和 App Store 国家/地区以及您首先需要了解的内容-零度博客

如何更改 iTunes 和 App Store 国家/地区以及您首先需要了解的内容

考虑更改您的 iTunes 和 App Store 国家/地区?在继续执行此操作之前,您需要了解以下内容。 我们可能生活在一个相互关联的世界中,但国际法律和政策无法始终跟上我们的喷气式飞机方式。如果您...
admin的头像-零度博客admin
1.6W+2251
如何在电脑上挖比特币?2024 最新 CPU/GPU挖矿教程!-零度博客

如何在电脑上挖比特币?2024 最新 CPU/GPU挖矿教程!

今天是视频主要是为了好玩,不构成任何的投资建议,大家凑个热闹就行了,因为零度用的是太阳能,白天电费是免费的,而且有数百张的闲置显卡,所以可以放心玩..... 1.挖矿收益计算平台【点击前往...
admin的头像-零度博客admin
2.1W+4057
美国硅谷银行倒闭后,USDC 稳定币和加密货币市场失控-零度博客

美国硅谷银行倒闭后,USDC 稳定币和加密货币市场失控

USDC 通常稳定的价格从 1 美元跌至 0.89 美元,而以太坊汽油费在这家加密银行倒闭数小时后飙升。 周六早些时候,由于硅谷银行 (SVB) 的倒闭导致该行业的一些核心管道失灵,加密货币危机进入高潮...
admin的头像-零度博客admin
1.2W+6539
推荐8款非常实用的 “限时免费” 软件!切勿错过-零度博客

推荐8款非常实用的 “限时免费” 软件!切勿错过

  1.FOCUS Projects 4 Pro – 图像特效处理软件[Windows、macOS] [$99→零元购] 这是一款图片锐度调节工具,能够将照片拍摄时不够清晰的部位更加清晰。同时软件中还有功能强大的图片编辑器...
admin的头像-零度博客admin
1.7W+1682
这是有关 诺顿360防毒软件 附带的加密挖矿的真相!-零度博客

这是有关 诺顿360防毒软件 附带的加密挖矿的真相!

这是有关 Norton Antivirus 附带的加密挖矿的真相! 诺顿因在其 Norton 360 安全软件中包含加密矿工而面临批评。像 Cory Doctorow这样的活动家声称该公司“偷偷地在你的计算机上安装加密软件”...
admin的头像-零度博客admin
1.5W+2251
微软正式发布Windows 11 (23H2)最新版本,附官方下载链接-零度博客

微软正式发布Windows 11 (23H2)最新版本,附官方下载链接

    1.Windows 11 (23H2)下载:【中文简体】、【中文繁体】、【英文版】 2.Rufus U盘制作工具:【点击下载】 可绕过硬件限制要求    
admin的头像-零度博客admin
2.2W+1682
Deep Live Cam:AI 实时换脸直播,效果炸裂!堪称DeepFake杀手锏!-零度博客

Deep Live Cam:AI 实时换脸直播,效果炸裂!堪称DeepFake杀手锏!

https://youtu.be/f9bbSqKae9E   Deep Live Cam 换脸工具下载:https://www.freedidi.com/14586.html      
admin的头像-零度博客admin
2.2W+3252