您的位置:首页 > 文旅 > 旅游 > 网络架构师工资一般多少_黄山网站建设免费咨询_yahoo搜索引擎入口_构建新发展格局

网络架构师工资一般多少_黄山网站建设免费咨询_yahoo搜索引擎入口_构建新发展格局

2025/5/25 2:43:22 来源:https://blog.csdn.net/zjjaibc/article/details/147542710  浏览:    关键词:网络架构师工资一般多少_黄山网站建设免费咨询_yahoo搜索引擎入口_构建新发展格局
网络架构师工资一般多少_黄山网站建设免费咨询_yahoo搜索引擎入口_构建新发展格局

一、git-lfs工具下载

#初始化git.lfs命令
curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash
sudo apt-get install git-lfs
git lfs install

二、 huggingface-cli工具下载及使用

Linux设置huggingface的镜像:

export HF_ENDPOINT=https://hf-mirror.com
pip install -U huggingface_hub

使用:

// 下载全部文件并保存到指定位置时,添加--local-dir参数,此时将保存至./Llama-2-13b-chat-hf/中
huggingface-cli download --resume-download meta-llama/Llama-2-13b-chat-hf --local-dir Llama-2-13b-chat-hf// 下载多个文件时,再添加具体文件名即可
huggingface-cli download meta-llama/Llama-2-13b-chat-hf config.json model-00001-of-00003.safetensors --local-dir Llama-2-13b-chat-hf// 下载多个文件并排除一些文件可使用--include和--exclude命令
huggingface-cli download meta-llama/Llama-2-13b-chat-hf --include "*.safetensors" --exclude "*.bin"// 需要 huggingface token 时 (Gated Repo),添加--token参数
huggingface-cli download meta-llama/Llama-2-13b-chat-hf --include "*.safetensors" --exclude "*.bin" --token hf_****

        测试下载模型是否正常运行的代码:

import transformers
import torch# 切换为你下载的模型文件目录, 这里的demo是Llama-3-8B-Instruct
# 如果是其他模型,比如qwen,chatglm,请使用其对应的官方demo
model_id = "/media/codingma/LLM/llama3/Meta-Llama-3-8B-Instruct"pipeline = transformers.pipeline("text-generation",model=model_id,model_kwargs={"torch_dtype": torch.bfloat16},device_map="auto",
)messages = [{"role": "system", "content": "You are a pirate chatbot who always responds in pirate speak!"},{"role": "user", "content": "Who are you?"},
]prompt = pipeline.tokenizer.apply_chat_template(messages,tokenize=False,add_generation_prompt=True
)terminators = [pipeline.tokenizer.eos_token_id,pipeline.tokenizer.convert_tokens_to_ids("<|eot_id|>")
]outputs = pipeline(prompt,max_new_tokens=256,eos_token_id=terminators,do_sample=True,temperature=0.6,top_p=0.9,
)
print(outputs[0]["generated_text"][len(prompt):])

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com