NeuSpeech / EEG-To-Text

72 stars 8 forks source link

Extra \r causes script to fail #2

Open ForeverNightmare opened 3 months ago

ForeverNightmare commented 3 months ago

For the train_decoding.sh, output in rb format in python, the contents are as follows:

b'python3 train_decoding.py --model_name BrainTranslator \\r\n' b' --task_name task1_task2_taskNRv2 \\r\n' b' --one_step \\r\n' b' --pretrained \\r\n' b' --not_load_step1_checkpoint \\r\n' b' --num_epoch_step1 20 \\r\n' b' --num_epoch_step2 30 \\r\n' b' -lr1 0.00005 \\r\n' b' -lr2 0.0000005 \\r\n' b' -b 32 \\r\n' b' -s ./checkpoints/decoding \\r\n' b' -cuda cuda:0\r\n' b'\r\n' b'\r\n'

which will lead to this error when running the script:

usage: train_decoding.py [-h] -m MODEL_NAME -t TASK_NAME [-1step] [-2step] [-pre] [-rand] [-load1] [-no-load1] -ne1 NUM_EPOCH_STEP1 -ne2 NUM_EPOCH_STEP2 -lr1 LEARNING_RATE_STEP1 -lr2 LEARNING_RATE_STEP2 -b BATCH_SIZE -s SAVE_PATH [-subj SUBJECTS] [-eeg EEG_TYPE] [-band EEG_BANDS [EEG_BANDS ...]] [-cuda CUDA] train_decoding.py: error: the following arguments are required: -t/--task_name, -ne1/--num_epoch_step1, -ne2/--num_epoch_step2, -lr1/--learning_rate_step1, -lr2/--learning_rate_step2, -b/--batch_size, -s/--save_path ./scripts/train_decoding.sh: line 2: --task_name: command not found ./scripts/train_decoding.sh: line 3: --one_step: command not found ./scripts/train_decoding.sh: line 4: --pretrained: command not found ./scripts/train_decoding.sh: line 5: --not_load_step1_checkpoint: command not found ./scripts/train_decoding.sh: line 6: --num_epoch_step1: command not found ./scripts/train_decoding.sh: line 7: --num_epoch_step2: command not found ./scripts/train_decoding.sh: line 8: -lr1: command not found ./scripts/train_decoding.sh: line 9: -lr2: command not found ./scripts/train_decoding.sh: line 10: -b: command not found ./scripts/train_decoding.sh: line 11: -s: command not found ./scripts/train_decoding.sh: line 12: -cuda: command not found ./scripts/train_decoding.sh: line 13: $'\r': command not found ./scripts/train_decoding.sh: line 14: $'\r': command not found

while the original train_decoding.sh from MikeWangWZHL doesn't have this issue: b'python3 train_decoding.py --model_name BrainTranslator \\n' b' --task_name task1_task2_taskNRv2 \\n' b' --one_step \\n' b' --pretrained \\n' b' --not_load_step1_checkpoint \\n' b' --num_epoch_step1 20 \\n' b' --num_epoch_step2 30 \\n' b' -lr1 0.00005 \\n' b' -lr2 0.0000005 \\n' b' -b 32 \\n' b' -s ./checkpoints/decoding \\n' b' -cuda cuda:0\n' b'\n' b'\n'

It would be better to use the original .sh file from MikeWang to replace this one with \r