Open xiaoshizijiayou opened 2 months ago
python3 -m ftllm.server -t 16 -p /root/autodl-tmp/Qwen2-7B-Instruct --port 8000 --model_name Qwen2-7B-Instruct --dtype int8 --atype float16 --device cuda --cuda_embedding ,不好意思,上面发错指令了
--lora xxx(peft完save的路径,目前只支持transformer格式的)
我加载了自己的adapter,提示lora需要F32的报错,不知道如何解决? FastLLM Error: Lora error: lora's dtype should be F32.
我加载了自己的adapter,提示lora需要F32的报错,不知道如何解决?
是我的问题.. 你的lora是什么dtype的,目前只写了加载Float32的lora, 稍后我改一下
2024-09-26 17:08:51,142 1106 server.py[line:72] INFO: Namespace(path='/root/autodl-tmp/Qwen2-7B-Instruct', threads=16, low=False, dtype='float32', atype='float16', cuda_embedding=True, kv_cache_limit='auto', max_batch=-1, device='cuda', custom='', lora='/root/autodl-tmp/qwen_out/checkpoints/checkpoint-900', model_name='Qwen2-7B-Instruct', host='0.0.0.0', port=8000)
FastLLM Error: Lora error: lora's dtype should be F32.
terminate called after throwing an instance of 'std::__cxx11::basic_string<char, std::char_traits
2024-09-26 17:08:51,142 1106 server.py[line:72] INFO: Namespace(path='/root/autodl-tmp/Qwen2-7B-Instruct', threads=16, low=False, dtype='float32', atype='float16', cuda_embedding=True, kv_cache_limit='auto', max_batch=-1, device='cuda', custom='', lora='/root/autodl-tmp/qwen_out/checkpoints/checkpoint-900', model_name='Qwen2-7B-Instruct', host='0.0.0.0', port=8000) FastLLM Error: Lora error: lora's dtype should be F32. terminate called after throwing an instance of 'std::__cxx11::basic_string<char, std::char_traits, std::allocator >' Aborted (core dumped) ,我dtype改成'float32,也是报这个错
噢不是,我意思是我代码里没支持读非F32的lora权重,不过这个好改的,稍等我改一下
你那修改后,我这怎么就可以直接用了?
在验证lora的效果,比较着急使用。请给提供下方法
你那修改后,我这怎么就可以直接用了?
已经支持了,重新pull一下,install一下就可以
重新拉取git代码,用c++编译下就行吧,install指的是python的安装方式吧
我拉取代码了,重新编译了,还是报F32的错,是哪里操作不对吗
我拉取代码了,重新编译了,还是报F32的错,是哪里操作不对吗
啊,和之前一样的报错吗? 现在类型检查改成Lora error: lora's dtype should be F32 or F16 or BF16.了
用ftllm.server的话要编译python的,就是根目录下bash install.sh应该就可以
代码更新了,也运行install了,还是报错,需要清理下编译缓存吗?
python3 -m ftllm.server -t 16 -p /root/autodl-tmp/Qwen2-7B-Instruct --port 8000 --model_name Qwen2-7B-Instruct --dtype float16 --atype float16 --device cuda --cuda_embedding --lora /root/autodl-tmp/qwen_out/checkpoints/checkpoint-900
CUDA_ARCH: 860
USE_TENSOR_CORE: 1
2024-09-26 18:11:37,869 2797 server.py[line:72] INFO: Namespace(path='/root/autodl-tmp/Qwen2-7B-Instruct', threads=16, low=False, dtype='float16', atype='float16', cuda_embedding=True, kv_cache_limit='auto', max_batch=-1, device='cuda', custom='', lora='/root/autodl-tmp/qwen_out/checkpoints/checkpoint-900', model_name='Qwen2-7B-Instruct', host='0.0.0.0', port=8000)
FastLLM Error: Lora error: lora's dtype should be F32.
FastLLM Error: Lora error: lora's dtype should be F32.
FastLLM Error: Lora error: lora's dtype should be F32.
terminate called after throwing an instance of 'std::__cxx11::basic_string<char, std::char_traits
不清楚是不是环境里有缓存,这个输出看起来库没更新的,现在代码里没有这句打印了
代码更新了,也运行install了,还是报错,需要清理下编译缓存吗? python3 -m ftllm.server -t 16 -p /root/autodl-tmp/Qwen2-7B-Instruct --port 8000 --model_name Qwen2-7B-Instruct --dtype float16 --atype float16 --device cuda --cuda_embedding --lora /root/autodl-tmp/qwen_out/checkpoints/checkpoint-900 CUDA_ARCH: 860 USE_TENSOR_CORE: 1 2024-09-26 18:11:37,869 2797 server.py[line:72] INFO: Namespace(path='/root/autodl-tmp/Qwen2-7B-Instruct', threads=16, low=False, dtype='float16', atype='float16', cuda_embedding=True, kv_cache_limit='auto', max_batch=-1, device='cuda', custom='', lora='/root/autodl-tmp/qwen_out/checkpoints/checkpoint-900', model_name='Qwen2-7B-Instruct', host='0.0.0.0', port=8000) FastLLM Error: Lora error: lora's dtype should be F32. FastLLM Error: Lora error: lora's dtype should be F32. FastLLM Error: Lora error: lora's dtype should be F32. terminate called after throwing an instance of 'std::__cxx11::basic_string<char, std::char_traits, std::allocator >' terminate called recursively terminate called recursively Aborted (core dumped)
不清楚是不是环境里有缓存,这个输出看起来库没更新的,现在代码里没有这句打印了
是从主干拉就行吧?
是的,要不卸了重装吧
我换了台机器,不报上面错误,报这个错误:
python3 -m ftllm.server -t 16 -p /root/autodl-tmp/Qwen2-7B-Instruct --port 8000 --model_name Qwen2-7B-Instruct --dtype int8 --atype float16 --device cuda --cuda_embedding --lora /root/autodl-tmp/qwen_out/checkpoints/checkpoint-900
Traceback (most recent call last):
File "/root/miniconda3/envs/qwen2/lib/python3.10/runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/root/miniconda3/envs/qwen2/lib/python3.10/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/root/miniconda3/envs/qwen2/lib/python3.10/site-packages/ftllm-0.0.0.1-py3.10.egg/ftllm/server.py", line 10, in
我换了台机器,不报上面错误,报这个错误: python3 -m ftllm.server -t 16 -p /root/autodl-tmp/Qwen2-7B-Instruct --port 8000 --model_name Qwen2-7B-Instruct --dtype int8 --atype float16 --device cuda --cuda_embedding --lora /root/autodl-tmp/qwen_out/checkpoints/checkpoint-900 Traceback (most recent call last): File "/root/miniconda3/envs/qwen2/lib/python3.10/runpy.py", line 196, in _run_module_as_main return _run_code(code, main_globals, None, File "/root/miniconda3/envs/qwen2/lib/python3.10/runpy.py", line 86, in _run_code exec(code, run_globals) File "/root/miniconda3/envs/qwen2/lib/python3.10/site-packages/ftllm-0.0.0.1-py3.10.egg/ftllm/server.py", line 10, in from .openai_server.protocal.openai_protocol import * File "/root/miniconda3/envs/qwen2/lib/python3.10/site-packages/ftllm-0.0.0.1-py3.10.egg/ftllm/openai_server/protocal/openai_protocol.py", line 7, in import shortuuid ModuleNotFoundError: No module named 'shortuuid'
server要装下依赖pip install -r requirements-server.txt
好的,谢谢,可以了
我换了台机器,不报上面错误,报这个错误: python3 -m ftllm.server -t 16 -p /root/autodl-tmp/Qwen2-7B-Instruct --port 8000 --model_name Qwen2-7B-Instruct --dtype int8 --atype float16 --device cuda --cuda_embedding --lora /root/autodl-tmp/qwen_out/checkpoints/checkpoint-900 Traceback (most recent call last): File "/root/miniconda3/envs/qwen2/lib/python3.10/runpy.py", line 196, in _run_module_as_main return _run_code(code, main_globals, None, File "/root/miniconda3/envs/qwen2/lib/python3.10/runpy.py", line 86, in _run_code exec(code, run_globals) File "/root/miniconda3/envs/qwen2/lib/python3.10/site-packages/ftllm-0.0.0.1-py3.10.egg/ftllm/server.py", line 10, in from .openai_server.protocal.openai_protocol import * File "/root/miniconda3/envs/qwen2/lib/python3.10/site-packages/ftllm-0.0.0.1-py3.10.egg/ftllm/openai_server/protocal/openai_protocol.py", line 7, in import shortuuid ModuleNotFoundError: No module named 'shortuuid'
server要装下依赖pip install -r requirements-server.txt
服务运行起来后报这个错,为什么呢,和输入输出有关系吗?
我换了台机器,不报上面错误,报这个错误: python3 -m ftllm.server -t 16 -p /root/autodl-tmp/Qwen2-7B-Instruct --port 8000 --model_name Qwen2-7B-Instruct --dtype int8 --atype float16 --device cuda --cuda_embedding --lora /root/autodl-tmp/qwen_out/checkpoints/checkpoint-900 Traceback (most recent call last): File "/root/miniconda3/envs/qwen2/lib/python3.10/runpy.py", line 196, in _run_module_as_main return _run_code(code, main_globals, None, File "/root/miniconda3/envs/qwen2/lib/python3.10/runpy.py", line 86, in _run_code exec(code, run_globals) File "/root/miniconda3/envs/qwen2/lib/python3.10/site-packages/ftllm-0.0.0.1-py3.10.egg/ftllm/server.py", line 10, in from .openai_server.protocal.openai_protocol import * File "/root/miniconda3/envs/qwen2/lib/python3.10/site-packages/ftllm-0.0.0.1-py3.10.egg/ftllm/openai_server/protocal/openai_protocol.py", line 7, in import shortuuid ModuleNotFoundError: No module named 'shortuuid'
server要装下依赖pip install -r requirements-server.txt
服务运行起来后报这个错,为什么呢,和输入输出有关系吗?
我又试了下,同样参数加载qwen2-7b模型就正常,但是qwen2-0.5b模型就报上面的错误
我换了台机器,不报上面错误,报这个错误: python3 -m ftllm.server -t 16 -p /root/autodl-tmp/Qwen2-7B-Instruct --port 8000 --model_name Qwen2-7B-Instruct --dtype int8 --atype float16 --device cuda --cuda_embedding --lora /root/autodl-tmp/qwen_out/checkpoints/checkpoint-900 Traceback (most recent call last): File "/root/miniconda3/envs/qwen2/lib/python3.10/runpy.py", line 196, in _run_module_as_main return _run_code(code, main_globals, None, File "/root/miniconda3/envs/qwen2/lib/python3.10/runpy.py", line 86, in _run_code exec(code, run_globals) File "/root/miniconda3/envs/qwen2/lib/python3.10/site-packages/ftllm-0.0.0.1-py3.10.egg/ftllm/server.py", line 10, in from .openai_server.protocal.openai_protocol import * File "/root/miniconda3/envs/qwen2/lib/python3.10/site-packages/ftllm-0.0.0.1-py3.10.egg/ftllm/openai_server/protocal/openai_protocol.py", line 7, in import shortuuid ModuleNotFoundError: No module named 'shortuuid'
server要装下依赖pip install -r requirements-server.txt
服务运行起来后报这个错,为什么呢,和输入输出有关系吗?
我又试了下,同样参数加载qwen2-7b模型就正常,但是qwen2-0.5b模型就报上面的错误
把atype和dtype参数去掉后运行不错了,但是返回结果不对,而且响应很慢。 {"id":"fastllm-Qwen2-0.5B-Instruct-84e4bd2d92bc435c9cecff0c8d6e59a1","object":"chat.completion","created":1727517938,"model":"Qwen2-0.5B-Instruct","choices":[{"index":0,"message":{"role":"assistant","content":"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!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!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"},"finish_reason":"stop"}],"usage":{"prompt_tokens":160,"total_tokens":8352,"completion_tokens":8192}}
0.5B这个问题我这边我没有复现出来... 不过这个模型比较小,可以直接把lora合掉
from transformers import AutoModelForCausalLM, AutoTokenizer import torch from peft import PeftModel
import argparse def parse_args(): parser = argparse.ArgumentParser(description = "main") parser.add_argument("--base", type = str, required = True) parser.add_argument("--lora", type = str, required = True) parser.add_argument("--output", type = str, required = True) return parser.parse_args()
if name == "main": args = parse_args()
# 加载tokenizer
tokenizer = AutoTokenizer.from_pretrained(args.base, trust_remote_code=True)
# 加载模型
model = AutoModelForCausalLM.from_pretrained(args.base, device_map="cpu",torch_dtype=torch.bfloat16, trust_remote_code=True).eval()
# 加载lora权重
model = PeftModel.from_pretrained(model, model_id = args.lora)
model = model.merge_and_unload()
model.save_pretrained(args.output, max_shard_size="2048MB", safe_serialization=True)
tokenizer.save_pretrained(args.output, max_shard_size="2048MB", safe_serialization=True)
已经编译安装好的fastllm,如何完全卸载,想重装下环境
pip uninstall ftllm
0.5B这个问题我这边我没有复现出来... 不过这个模型比较小,可以直接把lora合掉
from transformers import AutoModelForCausalLM, AutoTokenizer import torch from peft import PeftModel
import argparse def parse_args(): parser = argparse.ArgumentParser(description = "main") parser.add_argument("--base", type = str, required = True) parser.add_argument("--lora", type = str, required = True) parser.add_argument("--output", type = str, required = True) return parser.parse_args()
if name == "main": args = parse_args()
# 加载tokenizer tokenizer = AutoTokenizer.from_pretrained(args.base, trust_remote_code=True) # 加载模型 model = AutoModelForCausalLM.from_pretrained(args.base, device_map="cpu",torch_dtype=torch.bfloat16, trust_remote_code=True).eval() # 加载lora权重 model = PeftModel.from_pretrained(model, model_id = args.lora) model = model.merge_and_unload() model.save_pretrained(args.output, max_shard_size="2048MB", safe_serialization=True) tokenizer.save_pretrained(args.output, max_shard_size="2048MB", safe_serialization=True)
我换了台机器试,用加载lora方式和合并模型方式,都是报一样的错误。带上dtype和atype参数,接收请求后直接退出;
去掉dtype和atype参数,接收请求后不报错退出,但是返回一大堆感叹号“!!!!”。 {"id":"fastllm-Qwen2-0.5B-Instruct-84e4bd2d92bc435c9cecff0c8d6e59a1","object":"chat.completion","created":1727517938,"model":"Qwen2-0.5B-Instruct","choices":[{"index":0,"message":{"role":"assistant","content":"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!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!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"},"finish_reason":"stop"}],"usage":{"prompt_tokens":160,"total_tokens":8352,"completion_tokens":8192}}
0.5B这个问题我这边我没有复现出来... 不过这个模型比较小,可以直接把lora合掉 from transformers import AutoModelForCausalLM, AutoTokenizer import torch from peft import PeftModel import argparse def parse_args(): parser = argparse.ArgumentParser(description = "main") parser.add_argument("--base", type = str, required = True) parser.add_argument("--lora", type = str, required = True) parser.add_argument("--output", type = str, required = True) return parser.parse_args() if name == "main": args = parse_args()
# 加载tokenizer tokenizer = AutoTokenizer.from_pretrained(args.base, trust_remote_code=True) # 加载模型 model = AutoModelForCausalLM.from_pretrained(args.base, device_map="cpu",torch_dtype=torch.bfloat16, trust_remote_code=True).eval() # 加载lora权重 model = PeftModel.from_pretrained(model, model_id = args.lora) model = model.merge_and_unload() model.save_pretrained(args.output, max_shard_size="2048MB", safe_serialization=True) tokenizer.save_pretrained(args.output, max_shard_size="2048MB", safe_serialization=True)
我换了台机器试,用加载lora方式和合并模型方式,都是报一样的错误。带上dtype和atype参数,接收请求后直接退出;
去掉dtype和atype参数,接收请求后不报错退出,但是返回一大堆感叹号“!!!!”。 {"id":"fastllm-Qwen2-0.5B-Instruct-84e4bd2d92bc435c9cecff0c8d6e59a1","object":"chat.completion","created":1727517938,"model":"Qwen2-0.5B-Instruct","choices":[{"index":0,"message":{"role":"assistant","content":"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!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!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"},"finish_reason":"stop"}],"usage":{"prompt_tokens":160,"total_tokens":8352,"completion_tokens":8192}}
这个报错的机器是centos系统,我换了一个ubuntu的云服务器就是正常的,难道和系统有关系吗?
0.5B这个问题我这边我没有复现出来... 不过这个模型比较小,可以直接把lora合掉 from transformers import AutoModelForCausalLM, AutoTokenizer import torch from peft import PeftModel import argparse def parse_args(): parser = argparse.ArgumentParser(description = "main") parser.add_argument("--base", type = str, required = True) parser.add_argument("--lora", type = str, required = True) parser.add_argument("--output", type = str, required = True) return parser.parse_args() if name == "main": args = parse_args()
# 加载tokenizer tokenizer = AutoTokenizer.from_pretrained(args.base, trust_remote_code=True) # 加载模型 model = AutoModelForCausalLM.from_pretrained(args.base, device_map="cpu",torch_dtype=torch.bfloat16, trust_remote_code=True).eval() # 加载lora权重 model = PeftModel.from_pretrained(model, model_id = args.lora) model = model.merge_and_unload() model.save_pretrained(args.output, max_shard_size="2048MB", safe_serialization=True) tokenizer.save_pretrained(args.output, max_shard_size="2048MB", safe_serialization=True)
我换了台机器试,用加载lora方式和合并模型方式,都是报一样的错误。带上dtype和atype参数,接收请求后直接退出; 去掉dtype和atype参数,接收请求后不报错退出,但是返回一大堆感叹号“!!!!”。 {"id":"fastllm-Qwen2-0.5B-Instruct-84e4bd2d92bc435c9cecff0c8d6e59a1","object":"chat.completion","created":1727517938,"model":"Qwen2-0.5B-Instruct","choices":[{"index":0,"message":{"role":"assistant","content":"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!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!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"},"finish_reason":"stop"}],"usage":{"prompt_tokens":160,"total_tokens":8352,"completion_tokens":8192}}
这个报错的机器是centos系统,我换了一个ubuntu的云服务器就是正常的,难道和系统有关系吗?
加载qwen2-0.5b的基座模型也是报上面这种!!!错误
python -m lightllm.server.api_server --model_dir /root/autodl-tmp/Qwen2-7B-Instruct --host 0.0.0.0 --port 8000 --trust_remote_code --model_name Qwen2-7B-Instruct --data_type=bfloat16 --eos_id 151643 --tokenizer_mode fast。这是常用的部署方式,可以用这种参数的方式直接加载adapter吗,试了一些参数都报错,不能使用。只能用代码peft的方式吗?