mirror of https://github.com/THUDM/ChatGLM-6B
Merge 5ec5f04515
into 401bf3a8a7
commit
0e8edb133f
|
@ -8,7 +8,7 @@
|
||||||
## 软件依赖
|
## 软件依赖
|
||||||
运行微调需要4.27.1版本的`transformers`。除 ChatGLM-6B 的依赖之外,还需要安装以下依赖
|
运行微调需要4.27.1版本的`transformers`。除 ChatGLM-6B 的依赖之外,还需要安装以下依赖
|
||||||
```
|
```
|
||||||
pip install rouge_chinese nltk jieba datasets
|
pip install rouge_chinese nltk jieba datasets filelock
|
||||||
```
|
```
|
||||||
## 使用方法
|
## 使用方法
|
||||||
|
|
||||||
|
|
|
@ -44,6 +44,8 @@ from trainer_seq2seq import Seq2SeqTrainer
|
||||||
|
|
||||||
from arguments import ModelArguments, DataTrainingArguments
|
from arguments import ModelArguments, DataTrainingArguments
|
||||||
|
|
||||||
|
from filelock import FileLock
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
@ -121,7 +123,8 @@ def main():
|
||||||
new_prefix_state_dict[k[len("transformer.prefix_encoder."):]] = v
|
new_prefix_state_dict[k[len("transformer.prefix_encoder."):]] = v
|
||||||
model.transformer.prefix_encoder.load_state_dict(new_prefix_state_dict)
|
model.transformer.prefix_encoder.load_state_dict(new_prefix_state_dict)
|
||||||
else:
|
else:
|
||||||
model = AutoModel.from_pretrained(model_args.model_name_or_path, config=config, trust_remote_code=True)
|
with FileLock("model.lock"):
|
||||||
|
model = AutoModel.from_pretrained(model_args.model_name_or_path, config=config, trust_remote_code=True)
|
||||||
|
|
||||||
if model_args.quantization_bit is not None:
|
if model_args.quantization_bit is not None:
|
||||||
print(f"Quantized to {model_args.quantization_bit} bit")
|
print(f"Quantized to {model_args.quantization_bit} bit")
|
||||||
|
|
Loading…
Reference in New Issue