Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
hiyouga committed Jul 20, 2023
1 parent bb2e050 commit d270895
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ CUDA_VISIBLE_DEVICES=0 python src/train_bash.py \
--model_name_or_path path_to_your_chatglm_model \
--do_eval \
--dataset alpaca_gpt4_en \
--finetuning_type lora \
--checkpoint_dir path_to_checkpoint \
--output_dir path_to_eval_result \
--per_device_eval_batch_size 8 \
Expand All @@ -219,34 +220,40 @@ CUDA_VISIBLE_DEVICES=0 python src/train_bash.py \
```

### Predict

```bash
CUDA_VISIBLE_DEVICES=0 python src/train_bash.py \
--stage sft \
--model_name_or_path path_to_your_chatglm_model \
--do_predict \
--dataset alpaca_gpt4_en \
--finetuning_type lora \
--checkpoint_dir path_to_checkpoint \
--output_dir path_to_predict_result \
--per_device_eval_batch_size 8 \
--max_samples 50 \
--max_samples 100 \
--predict_with_generate
```

If you want to predict the samples with empty responses, please kindly fill the `response` column with **dummy tokens** to ensure the sample will not be discarded throughout the preprocessing phase.

### API Demo

```bash
python src/api_demo.py \
--model_name_or_path path_to_your_chatglm_model \
--finetuning_type lora \
--checkpoint_dir path_to_checkpoint
```

See `http://localhost:8000/docs` for API documentation.
Visit `http://localhost:8000/docs` for API documentation.

### CLI Demo

```bash
python src/cli_demo.py \
--model_name_or_path path_to_your_chatglm_model \
--finetuning_type lora \
--checkpoint_dir path_to_checkpoint
```

Expand All @@ -255,6 +262,7 @@ python src/cli_demo.py \
```bash
python src/web_demo.py \
--model_name_or_path path_to_your_chatglm_model \
--finetuning_type lora \
--checkpoint_dir path_to_checkpoint
```

Expand All @@ -263,6 +271,7 @@ python src/web_demo.py \
```bash
python src/export_model.py \
--model_name_or_path path_to_your_chatglm_model \
--finetuning_type lora \
--checkpoint_dir path_to_checkpoint \
--output_dir path_to_export
```
Expand Down
9 changes: 9 additions & 0 deletions README_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ CUDA_VISIBLE_DEVICES=0 python src/train_bash.py \
--model_name_or_path path_to_your_chatglm_model \
--do_eval \
--dataset alpaca_gpt4_zh \
--finetuning_type lora \
--checkpoint_dir path_to_checkpoint \
--output_dir path_to_eval_result \
--per_device_eval_batch_size 8 \
Expand All @@ -224,24 +225,29 @@ CUDA_VISIBLE_DEVICES=0 python src/train_bash.py \
```

### 模型预测

```bash
CUDA_VISIBLE_DEVICES=0 python src/train_bash.py \
--stage sft \
--model_name_or_path path_to_your_chatglm_model \
--do_predict \
--dataset alpaca_gpt4_zh \
--finetuning_type lora \
--checkpoint_dir path_to_checkpoint \
--output_dir path_to_predict_result \
--per_device_eval_batch_size 8 \
--max_samples 50 \
--predict_with_generate
```

注:如果需要预测的样本没有标签,请首先在 `response` 列中填入一些占位符,以免样本在预处理阶段被丢弃。

### API 服务

```bash
python src/api_demo.py \
--model_name_or_path path_to_your_chatglm_model \
--finetuning_type lora \
--checkpoint_dir path_to_checkpoint
```

Expand All @@ -252,6 +258,7 @@ python src/api_demo.py \
```bash
python src/cli_demo.py \
--model_name_or_path path_to_your_chatglm_model \
--finetuning_type lora \
--checkpoint_dir path_to_checkpoint
```

Expand All @@ -260,6 +267,7 @@ python src/cli_demo.py \
```bash
python src/web_demo.py \
--model_name_or_path path_to_your_chatglm_model \
--finetuning_type lora \
--checkpoint_dir path_to_checkpoint
```

Expand All @@ -268,6 +276,7 @@ python src/web_demo.py \
```bash
python src/export_model.py \
--model_name_or_path path_to_your_chatglm_model \
--finetuning_type lora \
--checkpoint_dir path_to_checkpoint \
--output_dir path_to_export
```
Expand Down

0 comments on commit d270895

Please sign in to comment.