Skip to content

Commit

Permalink
v0.5.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Tongjilibo committed Aug 14, 2024
1 parent fa22d82 commit 0b46260
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 7 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,9 @@ bert4torch-llm-server --checkpoint_path /data/pretrain_ckpt/Qwen/Qwen2-0.5B-Inst
### 4.1 版本历史
|更新日期| bert4torch | torch4keras | 版本说明 |
|------| ---------------- | ----------------- |----------- |
|20240814| 0.5.3 | 0.2.6 | 【新功能】增加llama3.1/Yi1.5;自动选择从hfmirror下载;支持命令行参数`bert4torch-llm-server`|
|20240801| 0.5.2 | 0.2.5 | 【新功能】chatglm/qwen系列支持function call调用, 增加internlm2系列;【小优化】简化pipeline中chat demo的调用,generate的终止token元素允许为列表, 统一rope_scaling参数名,增加rope衍生类;【bug】修复flash_attn2的推理bug, 修复bart的tie_word_embedding的bug|
|20240619| 0.5.1 | 0.2.4 | 增加Qwen1.5, Qwen2, glm4; 增加SWA/convert_lm_logits_dtype;调整各个trainer(重点DPOTrainer), generation中segment_ids, repetition_penalty需带query, RMSNorm中转类型bug|
|20240418| 0.5.0 | 0.2.2 | 修复chatglm3的bug, 修复save_pretrained时多文件的bug,增加CausalLMLoss, 修改deepspeed的传参逻辑,修改Text2Vec的bug, 完善openai client, 增加get_weight_decay_optim_groups|

[更多版本](https://github.com/Tongjilibo/bert4torch/blob/master/docs/Update.md)

Expand All @@ -141,16 +141,17 @@ from bert4torch.models import build_transformer_model
model = build_transformer_model('./model/bert4torch_config.json')

# 2. 仅指定checkpoint_path:
## 2.1 文件夹路径: 自动寻找路径下的*.bin/*.safetensors权重文件 + bert4torch_config.json/config.json文件
## 2.1 文件夹路径: 自动寻找路径下的*.bin/*.safetensors权重文件 + 需把bert4torch_config.json下载并放于该目录下
model = build_transformer_model(checkpoint_path='./model')

## 2.2 文件路径/列表: 文件路径即权重路径/列表, config会从同级目录下寻找
## 2.2 文件路径/列表: 文件路径即权重路径/列表, bert4torch_config.json会从同级目录下寻找
model = build_transformer_model(checkpoint_path='./pytorch_model.bin')

## 2.3 model_name: hf上预训练权重名称, 会自动下载hf权重以及bert4torch_config.json文件
model = build_transformer_model(checkpoint_path='bert-base-chinese')

# 3. 同时指定config_path和checkpoint_path(本地路径名或model_name排列组合):
# 本地路径从本地加载,pretrained_model_name会联网下载
config_path = './model/bert4torch_config.json' # 或'bert-base-chinese'
checkpoint_path = './model/pytorch_model.bin' # 或'bert-base-chinese'
model = build_transformer_model(config_path, checkpoint_path)
Expand Down
2 changes: 1 addition & 1 deletion bert4torch/pipelines/chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -2154,7 +2154,7 @@ def get_args_parser() -> ArgumentParser:
parser.add_argument("--config_path", type=str, default=None,
help="bert4torch_config.json file path or pretrained_model_name_or_path, if not set use `checkpoint_path` instead")
parser.add_argument("--mode", type=str, choices=['cli', 'gradio', 'openai'], default='cli',
help="deploy model in cli,gradio,streamlit,openai mode")
help="deploy model in cli / gradio / openai mode")
parser.add_argument("--precision", type=str, choices=['double', 'float', 'half', 'float16', 'bfloat16', None], default=None,
help="modify model precision")

Expand Down
1 change: 1 addition & 0 deletions docs/History.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## 更新历史

- **20240814**:【新功能】增加llama3.1/Yi1.5;自动选择从hfmirror下载;支持命令行参数`bert4torch-llm-server`|
- **20240801**:【新功能】chatglm/qwen系列支持function call调用, 增加internlm2系列;【小优化】简化pipeline中chat demo的调用,generate的终止token元素允许为列表, 统一rope_scaling参数名,增加rope衍生类;【bug】修复flash_attn2的推理bug, 修复bart的tie_word_embedding的bug
- **20240619**:增加Qwen1.5, Qwen2, glm4; 增加SWA/convert_lm_logits_dtype;调整各个trainer(重点DPOTrainer), generation中segment_ids, repetition_penalty需带query
- **20240426**:简化大模型调用demo, generation_config从config读取, 增加Qwen2和SWA, 修复RMSNorm中转类型bug
Expand Down
1 change: 1 addition & 0 deletions docs/Update.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

|更新日期| bert4torch版本 | torch4keras版本 | 版本说明 |
|------| ---------------- | ----------------- |----------- |
|20240814| 0.5.3 | 0.2.6 | 【新功能】增加llama3.1/Yi1.5;自动选择从hfmirror下载;支持命令行参数`bert4torch-llm-server`|
|20240801| 0.5.2 | 0.2.5 | 【新功能】chatglm/qwen系列支持function call调用, 增加internlm2系列;【小优化】简化pipeline中chat demo的调用,generate的终止token元素允许为列表, 统一rope_scaling参数名,增加rope衍生类;【bug】修复flash_attn2的推理bug, 修复bart的tie_word_embedding的bug|
|20240619| 0.5.1 | 0.2.4 | 增加Qwen1.5, Qwen2, glm4; 增加SWA/convert_lm_logits_dtype;调整各个trainer(重点DPOTrainer), generation中segment_ids, repetition_penalty需带query, RMSNorm中转类型bug|
|20240418| 0.5.0 | 0.2.2 | 修复chatglm3的bug, 修复save_pretrained时多文件的bug,增加CausalLMLoss, 修改deepspeed的传参逻辑,修改Text2Vec的bug, 完善openai client, 增加get_weight_decay_optim_groups|
Expand Down
2 changes: 1 addition & 1 deletion examples/basic/Qwen/basic_language_model_Qwen.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def main():
# cli: 命令行聊天
# openai: 启动一个openai的server服务
# gradio: web demo
# streamlit: web demo
# streamlit: web demo [启动命令]: streamlit run app.py --server.address 0.0.0.0 --server.port 8001
choice = 'cli'

generation_config = {'repetition_penalty': 1.1,
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@

setup(
name='bert4torch',
version='v0.5.2',
version='v0.5.3',
description='an elegant bert4torch',
long_description=long_description,
long_description_content_type="text/markdown",
license='MIT Licence',
url='https://github.com/Tongjilibo/bert4torch',
author='Tongjilibo',
install_requires=['numpy', 'tqdm', 'torch>1.6', 'torch4keras==0.2.5', 'six'],
install_requires=['numpy', 'tqdm', 'torch>1.6', 'torch4keras==0.2.6', 'six'],
packages=find_packages(),
entry_points={"console_scripts": ["bert4torch-llm-server = bert4torch.pipelines.chat:main"]},

Expand Down

0 comments on commit 0b46260

Please sign in to comment.