lm-sys / lm-sys/FastChat

Error after many steps of Training (IndexError: list index out of range)

Open
#1,054 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
39.5k
Forks
4.8k
PR merge metrics
No merged PRs in 30d

Description

I'm trying to train a model using train_mem.py and I get the following error after many steps of training (1269 steps). The error is shown below:

```
IndexError: list index out of range
WARNING:torch.distributed.elastic.multiprocessing.api:Sending process 129493 closing signal SIGTERM
WARNING:torch.distributed.elastic.multiprocessing.api:Sending process 129495 closing signal SIGTERM
WARNING:torch.distributed.elastic.multiprocessing.api:Sending process 129496 closing signal SIGTERM
ERROR:torch.distributed.elastic.multiprocessing.api:failed (exitcode: 1) local_rank: 1 (pid: 129494)
```

Did anyone face a similar issue during training? If so how did you address this issue?

_More information about my bash script:_

```
#!/bin/bash --login
#SBATCH --job-name FastChat
#SBATCH --time=48:00:00
#SBATCH --gres=gpu:a100:4
#SBATCH --cpus-per-gpu=12
#SBATCH --mem=500G
#SBATCH -o Output/gpu.%A.out
#SBATCH -e Error/gpu.%A.err
#SBATCH --reservation=A100

source activate chatbot

module load gcc/11.1.0
module load cuda/11.7.0

torchrun --nnodes=1 --nproc_per_node=4 --master_port=4141 \
fastchat/train/train_mem.py \
--model_name_or_path "./LLaMA_13B" \
--data_path "my_data.json" \
--bf16 True \
--output_dir output_13b_x \
--num_train_epochs 3 \
--per_device_train_batch_size 3 \
--per_device_eval_batch_size 16 \
--gradient_accumulation_steps 4 \
--evaluation_strategy "steps" \
--eval_steps 1500 \
--save_strategy "steps" \
--save_steps 100 \
--save_total_limit 1 \
--learning_rate 2e-5 \
--weight_decay 0. \
--warmup_ratio 0.04 \
--lr_scheduler_type "cosine" \
--logging_steps 1 \
--fsdp "full_shard auto_wrap offload" \
--fsdp_transformer_layer_cls_to_wrap 'LlamaDecoderLayer' \
--tf32 True \
--model_max_length 2048 \
--gradient_checkpointing True \
--lazy_preprocess True

```

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The failure occurs while running fastchat/train/train_mem.py via torchrun with four processes and FSDP; start by capturing the complete traceback rather than only the final IndexError, then inspect the training step around 1269 and the data in my_data.json. Done means identifying the failing list access and confirming the same command completes training without the exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
distributed-systems, machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.