ChatGLM2-6B icon indicating copy to clipboard operation
ChatGLM2-6B copied to clipboard

[BUG/Help] <title>ValueError: expected sequence of length 613 at dim 1 (got 612)

Open Smilefish1 opened this issue 1 year ago • 2 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Current Behavior

代码拉的是最新的 用pt的方式微调出现这种bug,数据格式是alpaca格式, [ { "instruction": "用JavaScript实现队列;", "input": "这是关于JavaScript的问题", "output": "javascript\nclass Queue {\n constructor() {\n this.items = [];\n }\n\n enqueue(element) {\n this.items.push(element);\n }\n\n dequeue() {\n return this.items.shift();\n }\n\n front() {\n return this.items[0];\n }\n\n isEmpty() {\n return this.items.length === 0;\n }\n\n size() {\n return this.items.length;\n }\n}\n" } ],

Expected Behavior

No response

Steps To Reproduce

参数如下: PRE_SEQ_LEN=128 LR=2e-2 NUM_GPUS=2

torchrun --standalone --nnodes=1 --nproc-per-node=$NUM_GPUS main.py
--do_train
--train_file /home/cyq/source/data/data3/train.json
--validation_file /home/cyq/source/data/data3/dev.json
--preprocessing_num_workers 4
--prompt_column instruction
--response_column output
--overwrite_cache
--model_name_or_path /home/cyq/source/model/chatglm2-6b
--output_dir output/adgen-chatglm2-6b-pt-4-$PRE_SEQ_LEN-$LR
--overwrite_output_dir
--max_source_length 100
--max_target_length 512
--per_device_train_batch_size 4
--per_device_eval_batch_size 1
--gradient_accumulation_steps 4
--predict_with_generate
--max_steps 3000
--logging_steps 10
--save_steps 1000
--learning_rate $LR
--pre_seq_len $PRE_SEQ_LEN
#--quantization_bit 4 , 程序运行时报ValueError: expected sequence of length 613 at dim 1 (got 612)

救救孩子吧,求大神解惑啊,我要咋修改啊

Environment

- OS:
- Python:
- Transformers:
- PyTorch: 
- CUDA Support (`python -c "import torch; print(torch.cuda.is_available())"`) :
环境按照要求安装的

Anything else?

No response

Smilefish1 avatar Jul 05 '23 04:07 Smilefish1

出门左转看一下 #179

MaHuanAAA avatar Jul 05 '23 05:07 MaHuanAAA

出门左转看一下 #179

好的好的,感谢感谢

Smilefish1 avatar Jul 05 '23 06:07 Smilefish1