Comments (4)
你这个加载方式不对,查看一下我的这个文件https://github.com/yuanzhoulvpi2017/zero_nlp/blob/main/chatglm_v2_6b_lora/infer_lora.ipynb
from zero_nlp.
用这种方式加载,也是一样的问题:
model = AutoModel.from_pretrained(model_name_or_path, trust_remote_code=True, device_map='auto', torch_dtype=torch.bfloat16)
model = PeftModel.from_pretrained(model, peft_model_id)
model = model.eval()
from zero_nlp.
如果这样加载(先做一次 eval):
tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, trust_remote_code=True)
model = AutoModel.from_pretrained(model_name_or_path, trust_remote_code=True, device_map='auto', torch_dtype=torch.bfloat16)
model = model.eval()
model = PeftModel.from_pretrained(model, peft_model_id)
在这一步会出现如下问题:
ValueError: We need an `offload_dir` to dispatch this model according to this `device_map`, the following submodules need to be offloaded: base_model.model.transformer.encoder.layers.1,
base_model.model.transformer.encoder.layers.2, base_model.model.transformer.encoder.layers.3, base_model.model.transformer.encoder.layers.4
错误位置:
/home/beeservice/.conda/envs/pt/lib/python3.10/site-packages/peft/peft_model.py:177 in │
│ from_pretrained │
│ │
│ 174 │ │ │ │ device_map = infer_auto_device_map( │
│ 175 │ │ │ │ │ model, max_memory=max_memory, no_split_module_classes=no_split_modul │
│ 176 │ │ │ │ ) │
│ ❱ 177 │ │ │ model = dispatch_model(model, device_map=device_map) │
│ 178 │ │ │ hook = AlignDevicesHook(io_same_device=True) │
│ 179 │ │ │ if model.peft_config.peft_type == PeftType.LORA: │
│ 180 │ │ │ │ add_hook_to_module(model.base_model.model, hook) │
from zero_nlp.
不知道你是不是用我的代码训练的。也有可能是transformers和peft包的版本问题。建议更新一下试一试。
from zero_nlp.
Related Issues (20)
- 博主您好
- chatGLMv2-6b p-tuning 和 LoRA数据预处理的方法是一样的吗 ?
- 4张3080ti跑chatglm2-6b-lora报oom HOT 5
- 求助:chatglm2 lora训练error:RuntimeError: Expected is_sm80 to be true, but got false. HOT 2
- 训练的时候报错ValueError: The current `device_map` had weights offloaded to the disk. HOT 11
- 训练出错
- 两张4090单机多卡跑,咋感觉越跑越慢了,比单卡慢 HOT 2
- 请问有部署或者运行的文档吗?在哪里可以看?
- 实时微调可以通过加入传统RL实现吗
- 请问如果单纯使用zeroth-order向前优化少量batch(只要体现出一定的优化效果)的话要怎么实现 HOT 2
- lora推理中只能指定一个输入吗?有办法实现batch_size的推理吗
- 救命!!ChatGlm-v2-6b_Lora该怎么设置epoch?? HOT 1
- 大佬,可以多个多个lora叠加使用吗?
- chatglm_v2_6b_lora多卡如何设置,没有找到 HOT 2
- 能出一个ChatGLM
- 能出一个ChatGLM的教程吗
- Segment Fault 是哪的问题?
- 大佬 chinese_llama 还可以用吗 HOT 1
- 出个chatglm3的吧 微调后 推理老是出问题 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from zero_nlp.