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

tensor parallel training bug #36296

Closed
2 of 4 tasks
iMountTai opened this issue Feb 20, 2025 · 4 comments · May be fixed by #36132
Closed
2 of 4 tasks

tensor parallel training bug #36296

iMountTai opened this issue Feb 20, 2025 · 4 comments · May be fixed by #36132
Labels

Comments

@iMountTai
Copy link

System Info

transformers:4.45.dev0
python:3.11
linux

Who can help?

#34194

Information

  • The official example scripts
  • My own modified scripts

Tasks

  • An officially supported task in the examples folder (such as GLUE/SQuAD, ...)
  • My own task or dataset (give details below)

Reproduction

torchrun --nnodes 1 --nproc_per_node 2 --master_port 27654 run_clm.py
--model_name_or_path TinyLlama/TinyLlama-1.1B-Chat-v1.0
--dataset_name wikitext
--dataset_config_name wikitext-2-raw-v1
--per_device_train_batch_size 1
--per_device_eval_batch_size 1
--do_train
--do_eval
--tp_size 2
--output_dir /tmp/test-clm

unexpected behavior:
runtimeerror: aten._foreach_norm_Scalar: got mixed torch.tensor and DTensor, need to convert all torch.tensor to DTensor before calling distributed operators.

Expected behavior

autoTP training

@iMountTai iMountTai added the bug label Feb 20, 2025
@Rocketknight1
Copy link
Member

cc @kmehant @SunMarc @muellerzr

@bursteratom
Copy link
Contributor

@iMountTai for now we will need to set max_grad_norm=-1

@iMountTai
Copy link
Author

Thank you very much for your prompt reply. The issue was resolved after setting max_grad_norm to -1. However, when using TP + DDP, the following error occurs.

torchrun --nnodes 1 --nproc_per_node 4 --master_port 27654 run_clm.py \
--model_name_or_path TinyLlama/TinyLlama-1.1B-Chat-v1.0 \
--dataset_name wikitext \
--dataset_config_name wikitext-2-raw-v1 \
--per_device_train_batch_size 1 \
--per_device_eval_batch_size 1 \
--do_train \
--do_eval \
--tp_size 2 \
--max_grad_norm -1 \
--output_dir /tmp/test-clm

in torch/distributed/device_mesh.py,line 721,in get_group_find_pg_by_ranks_and_tag(*self._dim_group_infos[mesh_dim][:2]) # type: ignore[index]
indexerror: list index out of range

Additionally, does the current TP training support the following traning:

  • TP + DDP
  • Loading LoRA training on unquantized models
  • Loading LoRA training on GPTQ models

Copy link

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the contributing guidelines are likely to be ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants