We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
我挨个尝试了你们提供的代码,全部都不是这错就是那错,不是这缺失就是那缺失,我严重怀疑你们的东西真的有没有人用得了的,哪怕 1 个人.
最后我尝试只有这个代码能跑,于是并改写了它,结果最后还是掉链子,连问AI,AI都回答不了. 你们能先裸机安装看看确定真的能用能安装好,然后才信心放出来行吗??能靠谱一点,真的让人可用行吗?
1.py.json
import requests from transformers import AutoTokenizer, AutoModelForCausalLM import torch import time MAX_RETRIES = 500 retry_count = 0
while retry_count < MAX_RETRIES: try: device = torch.device("cpu") #device = torch.device("cuda:0") model_info = "BAAI/AquilaChat2-7B" tokenizer = AutoTokenizer.from_pretrained(model_info, trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained(model_info, trust_remote_code=True, torch_dtype=torch.bfloat16) model.eval() model.to(device) text = "请给出10个要到北京旅游的理由。" from predict import predict out = predict(model, text, tokenizer=tokenizer, max_gen_len=5200, top_p=0.95, seed=1234, topk=100, temperature=0.9, sft=True, device=device, model_name="AquilaChat2-7B") print(out) break # 如果成功加载并运行到这一步,说明没有问题了,跳出循环 except requests.exceptions.ChunkedEncodingError as e: print(f"下载模型文件时出现错误: {e}") print(f"正在进行第 {retry_count + 1} 次重试...") # 可以在这里添加一些等待时间,避免过于频繁地重试导致问题持续存在 time.sleep(5) # 等待5秒后再重试,可根据实际情况调整等待时间 retry_count += 1 except Exception as other_e: print(f"出现其他未知错误: {other_e}") break # 对于其他未知错误,直接跳出循环,避免无限重试
if retry_count == MAX_RETRIES: print("已达到最大重试次数,仍然无法成功下载模型文件,请检查网络连接或手动下载模型文件后配置本地加载。")
The text was updated successfully, but these errors were encountered:
感谢使用和反馈。
看你给的使用方式是加载huggingface上的模型,需要确认模型和配置文件是否全部下载完成。 提示缺失的文件huggingface上是有的,怀疑是不是没有下载完全。
模型需要在cuda上运行,cpu上没有试过,cpu上使用的话我们一般用其他推理框架比如llama.cpp这些
Sorry, something went wrong.
假设模型下载目录为A,“from predict import predict”不存在的报错,可以试试 PYTHONPATH=A python main.py
No branches or pull requests
我挨个尝试了你们提供的代码,全部都不是这错就是那错,不是这缺失就是那缺失,我严重怀疑你们的东西真的有没有人用得了的,哪怕 1 个人.
最后我尝试只有这个代码能跑,于是并改写了它,结果最后还是掉链子,连问AI,AI都回答不了.
你们能先裸机安装看看确定真的能用能安装好,然后才信心放出来行吗??能靠谱一点,真的让人可用行吗?
1.py.json
import requests
from transformers import AutoTokenizer, AutoModelForCausalLM
import torch
import time
MAX_RETRIES = 500
retry_count = 0
while retry_count < MAX_RETRIES:
try:
device = torch.device("cpu")
#device = torch.device("cuda:0")
model_info = "BAAI/AquilaChat2-7B"
tokenizer = AutoTokenizer.from_pretrained(model_info, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(model_info, trust_remote_code=True, torch_dtype=torch.bfloat16)
model.eval()
model.to(device)
text = "请给出10个要到北京旅游的理由。"
from predict import predict
out = predict(model, text, tokenizer=tokenizer, max_gen_len=5200, top_p=0.95,
seed=1234, topk=100, temperature=0.9, sft=True, device=device,
model_name="AquilaChat2-7B")
print(out)
break # 如果成功加载并运行到这一步,说明没有问题了,跳出循环
except requests.exceptions.ChunkedEncodingError as e:
print(f"下载模型文件时出现错误: {e}")
print(f"正在进行第 {retry_count + 1} 次重试...")
# 可以在这里添加一些等待时间,避免过于频繁地重试导致问题持续存在
time.sleep(5) # 等待5秒后再重试,可根据实际情况调整等待时间
retry_count += 1
except Exception as other_e:
print(f"出现其他未知错误: {other_e}")
break # 对于其他未知错误,直接跳出循环,避免无限重试
if retry_count == MAX_RETRIES:
print("已达到最大重试次数,仍然无法成功下载模型文件,请检查网络连接或手动下载模型文件后配置本地加载。")
The text was updated successfully, but these errors were encountered: