Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update README.md #1288

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ptuning/README.md
Original file line number Diff line number Diff line change
@@ -138,7 +138,7 @@ from transformers import AutoConfig, AutoModel, AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained("THUDM/chatglm-6b", trust_remote_code=True)
```

1. 如果需要加载的是新 Checkpoint(只包含 PrefixEncoder 参数):
1. 如果需要加载的是新 Checkpoint(只需包含 PrefixEncoder 参数):

```python
config = AutoConfig.from_pretrained("THUDM/chatglm-6b", trust_remote_code=True, pre_seq_len=128)
5 changes: 5 additions & 0 deletions ptuning/main.py
Original file line number Diff line number Diff line change
@@ -47,6 +47,11 @@
logger = logging.getLogger(__name__)

def main():

if sys.platform == "win32":
torch.distributed.init_process_group(backend='gloo')
else:
torch.distributed.init_process_group(backend='nccl')

parser = HfArgumentParser((ModelArguments, DataTrainingArguments, Seq2SeqTrainingArguments))
if len(sys.argv) == 2 and sys.argv[1].endswith(".json"):
2 changes: 1 addition & 1 deletion ptuning/train.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PRE_SEQ_LEN=128
LR=2e-2

CUDA_VISIBLE_DEVICES=0 python3 main.py \
CUDA_VISIBLE_DEVICES=0 torchrun main.py \
--do_train \
--train_file AdvertiseGen/train.json \
--validation_file AdvertiseGen/dev.json \