deepspeedai / deepspeedai/DeepSpeed

[BUG] Mixtral + QLoRA + zero3 occured error

Open
#5,049 12 comments 2 reactions 1 assignee View on GitHub

@tohtana is already working on this.

Since Feb 6, 2024.

bug training
Dominant language
Python
Stars
43.1k
Forks
5k
Avg merge
4d 15h
Merged PRs (30d)
112

Description

Hello everyone.

When I trained Mixtral-MOE with QLoRA + Zero3, it occurs error like below.

_TypeErrorwork = group._allgather_base(output_tensor, input_tensor, opts)
TypeError: output tensor must have the same type as input tensor.

It seems odd because after several iterations, about 10 to 20, it works fine, but then suddenly the error occurs.
Also, 'Mixtral-MOE + QLoRA + Zero2' and 'llama-7B + QLoRA + Zero3' works well.

Any solutions?

My environment settings:

  • transformers 4.36.2
  • torch 2.2.0a0+81ea7a4
  • deepspeed 0.13.1
  • accelerate 0.26.1

deepspeed config is

{
  "train_batch_size": "auto",
  "train_micro_batch_size_per_gpu": "auto",
  "bf16": {"enabled": true},
  "optimizer": {
      "type": "AdamW",
      "params": {
          "lr": "auto",
          "betas": "auto",
          "eps": "auto",
          "weight_decay": "auto"
      }
  },
"scheduler": {
  "type": "WarmupDecayLR",
  "params": {
    "last_batch_iteration": -1,
    "total_num_steps": "auto",
    "warmup_min_lr": 5e-7,
    "warmup_max_lr": "auto",
    "warmup_num_steps": "auto"
  }
},
  "zero_optimization": {
      "stage": 3,
      "offload_param": {"device": "cpu", "pin_memory": true},
      "offload_optimizer": {"device": "cpu", "pin_memory": true},
      "allgather_partitions": true,
      "allgather_bucket_size": 5e8,
      "contiguous_gradients": true,
      "overlap_comm": true,
      "reduce_scatter": true,
      "reduce_bucket_size": 5e8,

      "zero_quantized_weights": false,
      "zero_hpz_partition_size": 8,
      "zero_quantized_gradients": false
  },
  "gradient_accumulation_steps": 2
}

Contributor guide

Open the contributing guide

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.