shibing624 / chatglm-6b-csc-zh-lora

huggingface.co
Total runs: 0
24-hour runs: 0
7-day runs: 0
30-day runs: 0
Model's Last Updated: December 15 2023

Introduction of chatglm-6b-csc-zh-lora

Model Details of chatglm-6b-csc-zh-lora

Chinese Spelling Correction LoRA Model

ChatGLM中文纠错LoRA模型

chatglm-6b-csc-zh-lora evaluate test data:

The overall performance of chatglm-6b-csc-zh-lora on CSC test :

prefix input_text target_text pred
对下面中文拼写纠错: 少先队员因该为老人让坐。 少先队员应该为老人让座。 少先队员应该为老人让座。\n错误字:因,坐

在CSC测试集上生成结果纠错准确率高,由于是基于大模型,结果常常能带给人惊喜,不仅能纠错,还带有句子润色和改写功能。

Usage

本项目开源在textgen项目: textgen ,可支持ChatGLM原生模型和LoRA微调后的模型,通过如下命令调用:

Install package:

pip install -U textgen
from textgen import GptModel
model = GptModel("chatglm", "THUDM/chatglm-6b", peft_name="shibing624/chatglm-6b-csc-zh-lora")
r = model.predict(["对下面中文拼写纠错:\n少先队员因该为老人让坐。\n答:"])
print(r) # ['少先队员应该为老人让座。\n错误字:因,坐']
Usage (HuggingFace Transformers)

Without textgen , you can use the model like this:

First, you pass your input through the transformer model, then you get the generated sentence.

Install package:

pip install transformers 
import sys
from peft import PeftModel
from transformers import AutoModel, AutoTokenizer

sys.path.append('..')

model = AutoModel.from_pretrained("THUDM/chatglm-6b", trust_remote_code=True, device_map='auto')
model = PeftModel.from_pretrained(model, "shibing624/chatglm-6b-csc-zh-lora")
model = model.half().cuda()  # fp16
tokenizer = AutoTokenizer.from_pretrained("THUDM/chatglm-6b", trust_remote_code=True)

sents = ['对下面中文拼写纠错:\n少先队员因该为老人让坐。\n答:',
         '对下面中文拼写纠错:\n下个星期,我跟我朋唷打算去法国玩儿。\n答:']
for s in sents:
    response = model.chat(tokenizer, s, max_length=128, eos_token_id=tokenizer.eos_token_id)
    print(response)

output:

('少先队员应该为老人让座。\n错误字:因,坐', [('对下面中文拼写纠错:\n少先队员因该为老人让坐。\n答:', '少先队员应该为老人让座。\n错误字:因,坐')])
('下个星期,我跟我朋友打算去法国玩儿。\n错误字:唷', [('对下面中文拼写纠错:\n下个星期,我跟我朋唷打算去法国玩儿。\n答:', '下个星期,我跟我朋友打算去法国玩儿。\n错误字:唷')])

模型文件组成:

chatglm-6b-csc-zh-lora
    ├── adapter_config.json
    └── adapter_model.bin
训练参数:
  • num_epochs: 2
  • batch_size: 4
  • steps: 125600
  • train_loss: 0.1055
  • base model: THUDM/chatglm-6b
  • train data: shibing624/CSC
训练数据集
中文纠错数据集

如果需要训练ChatGLM模型,请参考 https://github.com/shibing624/textgen

Citation
@software{textgen,
  author = {Xu Ming},
  title = {textgen: Implementation of language model finetune},
  year = {2021},
  url = {https://github.com/shibing624/textgen},
}

Runs of shibing624 chatglm-6b-csc-zh-lora on huggingface.co

0
Total runs
0
24-hour runs
0
3-day runs
0
7-day runs
0
30-day runs

More Information About chatglm-6b-csc-zh-lora huggingface.co Model

More chatglm-6b-csc-zh-lora license Visit here:

https://choosealicense.com/licenses/apache-2.0

chatglm-6b-csc-zh-lora huggingface.co

chatglm-6b-csc-zh-lora huggingface.co is an AI model on huggingface.co that provides chatglm-6b-csc-zh-lora's model effect (), which can be used instantly with this shibing624 chatglm-6b-csc-zh-lora model. huggingface.co supports a free trial of the chatglm-6b-csc-zh-lora model, and also provides paid use of the chatglm-6b-csc-zh-lora. Support call chatglm-6b-csc-zh-lora model through api, including Node.js, Python, http.

chatglm-6b-csc-zh-lora huggingface.co Url

https://huggingface.co/shibing624/chatglm-6b-csc-zh-lora

shibing624 chatglm-6b-csc-zh-lora online free

chatglm-6b-csc-zh-lora huggingface.co is an online trial and call api platform, which integrates chatglm-6b-csc-zh-lora's modeling effects, including api services, and provides a free online trial of chatglm-6b-csc-zh-lora, you can try chatglm-6b-csc-zh-lora online for free by clicking the link below.

shibing624 chatglm-6b-csc-zh-lora online free url in huggingface.co:

https://huggingface.co/shibing624/chatglm-6b-csc-zh-lora

chatglm-6b-csc-zh-lora install

chatglm-6b-csc-zh-lora is an open source model from GitHub that offers a free installation service, and any user can find chatglm-6b-csc-zh-lora on GitHub to install. At the same time, huggingface.co provides the effect of chatglm-6b-csc-zh-lora install, users can directly use chatglm-6b-csc-zh-lora installed effect in huggingface.co for debugging and trial. It also supports api for free installation.

chatglm-6b-csc-zh-lora install url in huggingface.co:

https://huggingface.co/shibing624/chatglm-6b-csc-zh-lora

Url of chatglm-6b-csc-zh-lora

chatglm-6b-csc-zh-lora huggingface.co Url

Provider of chatglm-6b-csc-zh-lora huggingface.co

shibing624
ORGANIZATIONS

Other API from shibing624