Open mathmax12 opened 2 months ago
cc @wukaixingxp
Hi! Can you share your commend that gets this error? Can you share the output of python -m torch.utils.collect_env
? I tested with the following and did not get any error
~/work/llama-recipes ]$ torchrun --nnodes 1 --nproc_per_node 2 recipes/quickstart/finetuning/finetuning.py --flop_counter --flop_counter_start 4 --max_train_step 6 --max_eval_step 2 --use_peft --peft_method lora --model_name meta-llama/Meta-Llama-3.1-8B-Instruct --enable_fsdp --output_dir /home/kaiwu/work/finetune-output --samsum_dataset.trust_remote_code=True
W0823 11:20:46.745000 140011296576512 torch/distributed/run.py:757]
W0823 11:20:46.745000 140011296576512 torch/distributed/run.py:757] *****************************************
W0823 11:20:46.745000 140011296576512 torch/distributed/run.py:757] Setting OMP_NUM_THREADS environment variable for each process to be 1 in default, to avoid your system being overloaded, please further tune the variable for optimal performance in your application as needed.
W0823 11:20:46.745000 140011296576512 torch/distributed/run.py:757] *****************************************
Clearing GPU cache for all ranks
--> Running with torch dist debug set to detail
Loading checkpoint shards: 100%|ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ| 4/4 [00:00<00:00, 5.34it/s]
Loading checkpoint shards: 50%|βββββββββββββββββββββββββββββββββββββββββββββββββββββββ | 2/4 [00:00<00:00, 5.66it/s]--> Model meta-llama/Meta-Llama-3.1-8B-Instruct
--> meta-llama/Meta-Llama-3.1-8B-Instruct has 8030.261248 Million params
trainable params: 3,407,872 || all params: 8,033,669,120 || trainable%: 0.04241987003816259
bFloat16 enabled for mixed precision - using bfSixteen policy
Loading checkpoint shards: 100%|ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ| 4/4 [00:00<00:00, 5.66it/s]
trainable params: 3,407,872 || all params: 8,033,669,120 || trainable%: 0.04241987003816259
--> applying fsdp activation checkpointing...
--> applying fsdp activation checkpointing...
Map: 100%|βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ| 14732/14732 [00:04<00:00, 3021.11 examples/s]
--> Training Set Length = 14732
Map: 100%|βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ| 14732/14732 [00:04<00:00, 2972.50 examples/s]
Map: 100%|βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ| 818/818 [00:00<00:00, 2828.87 examples/s]
--> Validation Set Length = 818
Map: 100%|βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ| 818/818 [00:00<00:00, 3013.63 examples/s]
Preprocessing dataset: 100%|ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ| 14732/14732 [00:02<00:00, 6887.25it/s]
Preprocessing dataset: 100%|ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ| 14732/14732 [00:02<00:00, 7050.97it/s]
Preprocessing dataset: 100%|ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ| 818/818 [00:00<00:00, 7308.68it/s]
--> Num of Validation Set Batches loaded = 17
Preprocessing dataset: 100%|ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ| 818/818 [00:00<00:00, 7265.97it/s]
--> Num of Validation Set Batches loaded = 17
/home/kaiwu/miniconda3/envs/llama/lib/python3.10/site-packages/torch/cuda/memory.py:330: FutureWarning: torch.cuda.reset_max_memory_allocated now calls torch.cuda.reset_peak_memory_stats, which resets /all/ peak memory stats.
warnings.warn(
Training Epoch: 1: 0%| | 0/79 [00:00<?, ?it/s]huggingface/tokenizers: The current process just got forked, after parallelism has already been used. Disabling parallelism to avoid deadlocks...
To disable this warning, you can either:
- Avoid using `tokenizers` before the fork if possible
- Explicitly set the environment variable TOKENIZERS_PARALLELISM=(true | false)
/home/kaiwu/miniconda3/envs/llama/lib/python3.10/site-packages/torch/cuda/memory.py:330: FutureWarning: torch.cuda.reset_max_memory_allocated now calls torch.cuda.reset_peak_memory_stats, which resets /all/ peak memory stats.
warnings.warn(
Training Epoch: 1: 0%| | 0/79 [00:00<?, ?it/s]huggingface/tokenizers: The current process just got forked, after parallelism has already been used. Disabling parallelism to avoid deadlocks...
To disable this warning, you can either:
- Avoid using `tokenizers` before the fork if possible
- Explicitly set the environment variable TOKENIZERS_PARALLELISM=(true | false)
NCCL version 2.20.5+cuda12.4
Training Epoch: 1/3, step 5/79 completed (loss: 1.3690743446350098): 8%|βββββ | 6/79 [00:23<04:20, 3.57s/it]max training steps reached, stopping training, total train steps finished: 6
Training Epoch: 1/3, step 5/79 completed (loss: 1.3915694952011108): 8%|βββββ | 6/79 [00:23<04:45, 3.91s/it]
Training Epoch: 1/3, step 5/79 completed (loss: 1.3690743446350098): 8%|βββββ | 6/79 [00:23<04:46, 3.93s/it]
Total time used in this flop counting step is: 3.39812970161438
The total TFlop per second is: 318.32860094962024
The tflop_count table is below:
Module FLOP % Total
---------------------------------------------------- --------- ---------
Global 1081.722T 100.00%
- aten.bmm 0.000T 0.00%
- aten.mm 888.208T 82.11%
- aten._scaled_dot_product_flash_attention 105.553T 9.76%
- aten._scaled_dot_product_flash_attention_backward 87.961T 8.13%
Max CUDA memory allocated was 37 GB
Max CUDA memory reserved was 44 GB
Peak active CUDA memory was 38 GB
CUDA Malloc retries : 0
CPU Total Peak Memory consumed during the train (max): 9 GB
evaluating Epoch: 0%| | 0/17 [00:00<?, ?it/s]huggingface/tokenizers: The current process just got forked, after parallelism has already been used. Disabling parallelism to avoid deadlocks...
To disable this warning, you can either:
- Avoid using `tokenizers` before the fork if possible
- Explicitly set the environment variable TOKENIZERS_PARALLELISM=(true | false)
huggingface/tokenizers: The current process just got forked, after parallelism has already been used. Disabling parallelism to avoid deadlocks...
To disable this warning, you can either:
- Avoid using `tokenizers` before the fork if possible
- Explicitly set the environment variable TOKENIZERS_PARALLELISM=(true | false)
evaluating Epoch: 12%|ββββββββββββββ | 2/17 [00:00<00:04, 3.52it/s]max eval steps reached, stopping evaluation, total_eval_steps: 2
evaluating Epoch: 12%|ββββββββββββββ | 2/17 [00:00<00:05, 2.94it/s]
evaluating Epoch: 12%|ββββββββββββββ | 2/17 [00:00<00:05, 2.98it/s]
eval_ppl=tensor(1.1639, device='cuda:0') eval_epoch_loss=tensor(0.1518, device='cuda:0')
we are about to save the PEFT modules
PEFT modules are saved in /home/kaiwu/work/finetune-output directory
best eval loss on epoch 1 is 0.1518038660287857
Epoch 1: train_perplexity=1.1131, train_epoch_loss=0.1072, epoch time 24.080209309002385s
Key: avg_train_prep, Value: 1.1131309270858765
Key: avg_train_loss, Value: 0.1071767508983612
Key: avg_eval_prep, Value: 1.163931965827942
Key: avg_eval_loss, Value: 0.1518038660287857
Key: avg_epoch_time, Value: 24.080209309002385
Key: avg_checkpoint_time, Value: 10.366551257902756
Key: model_tflops, Value: 318.32860094962024
@wukaixingxp Thanks for the prompt reply. here is the command I used: I used slurm.
srun -l docker exec -w /root/ fsdp torchrun --nnodes 1 --nproc_per_node 8 --rdzv_id 1599 --rdzv_backend c10d --rdzv_endpoint 10.158.215.85:29500 ./recipes/quickstart/finetuning/finetuning.py --model_name ./Meta-Llama-3.1-models/Meta-Llama-3.1-8B --output_dir ./finetune_checkpoints/fsdp_fine_tune_results/output_model_1_8_8B --dist_checkpoint_root_folder ./finetune_checkpoints/fsdp_fine_tune_results/fsdp_model_finetuned_1_8_8B --enable_fsdp --num_epochs 2 --batch_size_training 16 --batching_strategy packing --dataset alpaca_dataset --flop_counter
Please see the output of python -m torch.utils.collect_env
as below
0: /opt/conda/envs/py_3.8/lib/python3.8/runpy.py:127: RuntimeWarning: 'torch.utils.collect_env' found in sys.modules after import of package 'torch.utils', but prior to execution of 'torch.utils.collect_env'; this may result in unpredictable behaviour 0: warn(RuntimeWarning(msg)) 0: Collecting environment information... 0: PyTorch version: 2.5.0a0+git10344d7 0: Is debug build: False 0: CUDA used to build PyTorch: N/A 0: ROCM used to build PyTorch: 6.1.40091-a8dbc0c19 0: 0: OS: Ubuntu 20.04.6 LTS (x86_64) 0: GCC version: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0 0: Clang version: 17.0.0 (https://github.com/RadeonOpenCompute/llvm-project roc-6.1.0 24103 7db7f5e49612030319346f900c08f474b1f9023a) 0: CMake version: version 3.26.4 0: Libc version: glibc-2.31 0: 0: Python version: 3.8.19 (default, Mar 20 2024, 19:58:24) [GCC 11.2.0] (64-bit runtime) 0: Python platform: Linux-5.15.0-91-generic-x86_64-with-glibc2.17 0: Is CUDA available: True 0: CUDA runtime version: Could not collect 0: CUDA_MODULE_LOADING set to: LAZY 0: GPU models and configuration: AMD Instinct MI300X (gfx942:sramecc+:xnack-) 0: Nvidia driver version: Could not collect 0: cuDNN version: Could not collect 0: HIP runtime version: 6.1.40091 0: MIOpen runtime version: 3.1.0 0: Is XNNPACK available: True 0: 0: CPU: 0: Architecture: x86_64 0: CPU op-mode(s): 32-bit, 64-bit 0: Byte Order: Little Endian 0: Address sizes: 46 bits physical, 57 bits virtual 0: CPU(s): 224 0: On-line CPU(s) list: 0-223 0: Thread(s) per core: 2 0: Core(s) per socket: 56 0: Socket(s): 2 0: NUMA node(s): 2 0: Vendor ID: GenuineIntel 0: CPU family: 6 0: Model: 143 0: Model name: Intel(R) Xeon(R) Platinum 8480+ 0: Stepping: 8 0: CPU MHz: 2000.000 0: CPU max MHz: 3800.0000 0: CPU min MHz: 800.0000 0: BogoMIPS: 4000.00 0: Virtualization: VT-x 0: L1d cache: 5.3 MiB 0: L1i cache: 3.5 MiB 0: L2 cache: 224 MiB 0: L3 cache: 210 MiB 0: NUMA node0 CPU(s): 0-55,112-167 0: NUMA node1 CPU(s): 56-111,168-223 0: Vulnerability Gather data sampling: Not affected 0: Vulnerability Itlb multihit: Not affected 0: Vulnerability L1tf: Not affected 0: Vulnerability Mds: Not affected 0: Vulnerability Meltdown: Not affected 0: Vulnerability Mmio stale data: Not affected 0: Vulnerability Retbleed: Not affected 0: Vulnerability Spec rstack overflow: Not affected 0: Vulnerability Spec store bypass: Vulnerable 0: Vulnerability Spectre v1: Vulnerable: __user pointer sanitization and usercopy barriers only; no swapgs barriers 0: Vulnerability Spectre v2: Vulnerable, IBPB: disabled, STIBP: disabled, PBRSB-eIBRS: Vulnerable 0: Vulnerability Srbds: Not affected 0: Vulnerability Tsx async abort: Not affected 0: Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb cat_l3 cat_l2 cdp_l3 invpcid_single intel_ppin cdp_l2 ssbd mba ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid cqm rdt_a avx512f avx512dq rdseed adx smap avx512ifma clflushopt clwb intel_pt avx512cd sha_ni avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local split_lock_detect avx_vnni avx512_bf16 wbnoinvd dtherm ida arat pln pts hwp hwp_act_window hwp_epp hwp_pkg_req avx512vbmi umip pku ospk 0: e waitpkg avx512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx512_bitalg tme avx512_vpopcntdq la57 rdpid bus_lock_detect cldemote movdiri movdir64b enqcmd fsrm md_clear serialize tsxldtrk pconfig arch_lbr amx_bf16 avx512_fp16 amx_tile amx_int8 flush_l1d arch_capabilities 0: 0: Versions of relevant libraries: 0: [pip3] mypy==1.10.0 0: [pip3] mypy-extensions==1.0.0 0: [pip3] numpy==1.24.4 0: [pip3] onnx==1.16.2 0: [pip3] onnxruntime==1.15.1 0: [pip3] optree==0.12.1 0: [pip3] torch==2.5.0a0+git10344d7 0: [pip3] torchvision==0.20.0a0+61bd547 0: [pip3] triton==3.0.0 0: [conda] No relevant packages
Also, Is there a way to get the token per second during training on each GPU ? Thanks
Hi! I noticed that you are using AMD Instinct MI300X which unfortunately we have not yet have a chance to test and support, so I have to guess the possible solutions: (1) Can you run the official FlopTensorDispatchMode example to test if ROCM actually support this feature? (2) I noticed that your PyTorch version is 2.5.0a0+git10344d7, while the current stable version is 2.4.0. may be try to install the 2.4.0 will help? pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/rocm6.1
@wukaixingxp I was able to run the official FlopTensorDispatchMode example. However, I encountered the same issue when using pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/rocm6.1. Interestingly, everything works fine without FSDP, but when I add the --enable_fsdp flag, it fails as mentioned earlier. Do you have any further insights on this?
Unfortunately, we do not have a way to test and support ROCM at the moment. Will keep you updated once that has been changed.
Hi, I had a similar flop counter problem while using multiple GPUs to finetune LLama 70B. But everything works fine when I use a single GPU to finetune LLama 8B.
llama-recipes
revision: 3e39ed05bdd6426bd0c41253d1b18e478e2cb670
Training Epoch: 1: 0%| | 0/807 [00:00<?, ?it/s]Warning: did not record any flops this time. Skipping the flop report
Module FLOP % Total
-------- ------ ---------
Global 0 0%
Warning: did not record any flops this time. Skipping the flop report
Module FLOP % Total
-------- ------ ---------
Global 0 0%
Warning: did not record any flops this time. Skipping the flop report
Module FLOP % Total
-------- ------ ---------
Global 0 0%
[rank1]: Traceback (most recent call last):
[rank1]: File "~/workspace/repo/llama-recipes/recipes/quickstart/finetuning/finetuning.py", line 8, in <module>
[rank1]: fire.Fire(main)
[rank1]: File "~/miniconda3/envs/llama-recipes/lib/python3.10/site-packages/fire/core.py", line 143, in Fire
[rank1]: component_trace = _Fire(component, args, parsed_flag_args, context, name)
[rank1]: File "~/miniconda3/envs/llama-recipes/lib/python3.10/site-packages/fire/core.py", line 477, in _Fire
[rank1]: component, remaining_args = _CallAndUpdateTrace(
[rank1]: File "~/miniconda3/envs/llama-recipes/lib/python3.10/site-packages/fire/core.py", line 693, in _CallAndUpdateTrace
[rank1]: component = fn(*varargs, **kwargs)
[rank1]: File "~/workspace/repo/llama-recipes/src/llama_recipes/finetuning.py", line 270, in main
[rank1]: results = train(
[rank1]: File "~/workspace/repo/llama-recipes/src/llama_recipes/utils/train_utils.py", line 152, in train
[rank1]: loss = model(**batch).loss
[rank1]: File "~/miniconda3/envs/llama-recipes/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1553, in _wrapped_call_impl
[rank1]: return self._call_impl(*args, **kwargs)
[rank1]: File "~/miniconda3/envs/llama-recipes/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1603, in _call_impl
[rank1]: result = forward_call(*args, **kwargs)
[rank1]: File "~/miniconda3/envs/llama-recipes/lib/python3.10/site-packages/torch/distributed/fsdp/fully_sharded_data_parallel.py", line 863, in forward
[rank1]: output = self._fsdp_wrapped_module(*args, **kwargs)
[rank1]: File "~/miniconda3/envs/llama-recipes/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1553, in _wrapped_call_impl
[rank1]: return self._call_impl(*args, **kwargs)
[rank1]: File "~/miniconda3/envs/llama-recipes/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1603, in _call_impl
[rank1]: result = forward_call(*args, **kwargs)
[rank1]: File "~/miniconda3/envs/llama-recipes/lib/python3.10/site-packages/peft/peft_model.py", line 1577, in forward
[rank1]: return self.base_model(
[rank1]: File "~/miniconda3/envs/llama-recipes/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1553, in _wrapped_call_impl
[rank1]: return self._call_impl(*args, **kwargs)
[rank1]: File "~/miniconda3/envs/llama-recipes/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1603, in _call_impl
[rank1]: result = forward_call(*args, **kwargs)
[rank1]: File "~/miniconda3/envs/llama-recipes/lib/python3.10/site-packages/peft/tuners/tuners_utils.py", line 188, in forward
[rank1]: return self.model.forward(*args, **kwargs)
[rank1]: File "~/miniconda3/envs/llama-recipes/lib/python3.10/site-packages/transformers/models/llama/modeling_llama.py", line 1141, in forward
[rank1]: outputs = self.model(
[rank1]: File "~/miniconda3/envs/llama-recipes/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1553, in _wrapped_call_impl
[rank1]: return self._call_impl(*args, **kwargs)
[rank1]: File "~/miniconda3/envs/llama-recipes/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1603, in _call_impl
[rank1]: result = forward_call(*args, **kwargs)
[rank1]: File "~/miniconda3/envs/llama-recipes/lib/python3.10/site-packages/transformers/models/llama/modeling_llama.py", line 932, in forward
[rank1]: layer_outputs = self._gradient_checkpointing_func(
[rank1]: File "~/miniconda3/envs/llama-recipes/lib/python3.10/site-packages/torch/_compile.py", line 31, in inner
[rank1]: return disable_fn(*args, **kwargs)
[rank1]: File "~/miniconda3/envs/llama-recipes/lib/python3.10/site-packages/torch/_dynamo/eval_frame.py", line 600, in _fn
[rank1]: return fn(*args, **kwargs)
[rank1]: File "~/miniconda3/envs/llama-recipes/lib/python3.10/site-packages/torch/utils/checkpoint.py", line 481, in checkpoint
[rank1]: return CheckpointFunction.apply(function, preserve, *args)
[rank1]: File "~/miniconda3/envs/llama-recipes/lib/python3.10/site-packages/torch/autograd/function.py", line 574, in apply
[rank1]: return super().apply(*args, **kwargs) # type: ignore[misc]
[rank1]: File "~/miniconda3/envs/llama-recipes/lib/python3.10/site-packages/torch/utils/checkpoint.py", line 255, in forward
[rank1]: outputs = run_function(*args)
[rank1]: File "~/miniconda3/envs/llama-recipes/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1553, in _wrapped_call_impl
[rank1]: return self._call_impl(*args, **kwargs)
[rank1]: File "~/miniconda3/envs/llama-recipes/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1592, in _call_impl
[rank1]: args_result = hook(self, args)
[rank1]: File "~/miniconda3/envs/llama-recipes/lib/python3.10/site-packages/torch/utils/module_tracker.py", line 124, in _fw_pre_hook
[rank1]: register_multi_grad_hook(tensors, self._get_pop_fn(name, True))
[rank1]: File "~/miniconda3/envs/llama-recipes/lib/python3.10/site-packages/torch/autograd/graph.py", line 468, in register_multi_grad_hook
[rank1]: grad_fns = list(map(_get_grad_fn_or_grad_acc, tensors))
[rank1]: File "~/miniconda3/envs/llama-recipes/lib/python3.10/site-packages/torch/autograd/graph.py", line 161, in _get_grad_fn_or_grad_acc
[rank1]: return t.view_as(t).grad_fn.next_functions[0][0]
[rank1]: AttributeError: 'NoneType' object has no attribute 'next_functions'
[rank2]: Traceback (most recent call last):
[rank2]: File "~/workspace/repo/llama-recipes/recipes/quickstart/finetuning/finetuning.py", line 8, in <module>
[rank2]: fire.Fire(main)
[rank2]: File "~/miniconda3/envs/llama-recipes/lib/python3.10/site-packages/fire/core.py", line 143, in Fire
[rank2]: component_trace = _Fire(component, args, parsed_flag_args, context, name)
[rank2]: File "~/miniconda3/envs/llama-recipes/lib/python3.10/site-packages/fire/core.py", line 477, in _Fire
[rank2]: component, remaining_args = _CallAndUpdateTrace(
[rank2]: File "~/miniconda3/envs/llama-recipes/lib/python3.10/site-packages/fire/core.py", line 693, in _CallAndUpdateTrace
[rank2]: component = fn(*varargs, **kwargs)
[rank2]: File "~/workspace/repo/llama-recipes/src/llama_recipes/finetuning.py", line 270, in main
[rank2]: results = train(
[rank2]: File "~/workspace/repo/llama-recipes/src/llama_recipes/utils/train_utils.py", line 152, in train
[rank2]: loss = model(**batch).loss
[rank2]: File "~/miniconda3/envs/llama-recipes/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1553, in _wrapped_call_impl
[rank2]: return self._call_impl(*args, **kwargs)
[rank2]: File "~/miniconda3/envs/llama-recipes/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1603, in _call_impl
[rank2]: result = forward_call(*args, **kwargs)
[rank2]: File "~/miniconda3/envs/llama-recipes/lib/python3.10/site-packages/torch/distributed/fsdp/fully_sharded_data_parallel.py", line 863, in forward
[rank2]: output = self._fsdp_wrapped_module(*args, **kwargs)
[rank2]: File "~/miniconda3/envs/llama-recipes/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1553, in _wrapped_call_impl
[rank2]: return self._call_impl(*args, **kwargs)
[rank2]: File "~/miniconda3/envs/llama-recipes/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1603, in _call_impl
[rank2]: result = forward_call(*args, **kwargs)
[rank2]: File "~/miniconda3/envs/llama-recipes/lib/python3.10/site-packages/peft/peft_model.py", line 1577, in forward
[rank2]: return self.base_model(
[rank2]: File "~/miniconda3/envs/llama-recipes/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1553, in _wrapped_call_impl
[rank2]: return self._call_impl(*args, **kwargs)
[rank2]: File "~/miniconda3/envs/llama-recipes/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1603, in _call_impl
[rank2]: result = forward_call(*args, **kwargs)
[rank2]: File "~/miniconda3/envs/llama-recipes/lib/python3.10/site-packages/peft/tuners/tuners_utils.py", line 188, in forward
[rank2]: return self.model.forward(*args, **kwargs)
[rank2]: File "~/miniconda3/envs/llama-recipes/lib/python3.10/site-packages/transformers/models/llama/modeling_llama.py", line 1141, in forward
[rank2]: outputs = self.model(
[rank2]: File "~/miniconda3/envs/llama-recipes/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1553, in _wrapped_call_impl
[rank2]: return self._call_impl(*args, **kwargs)
[rank2]: File "~/miniconda3/envs/llama-recipes/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1603, in _call_impl
[rank2]: result = forward_call(*args, **kwargs)
[rank2]: File "~/miniconda3/envs/llama-recipes/lib/python3.10/site-packages/transformers/models/llama/modeling_llama.py", line 932, in forward
[rank2]: layer_outputs = self._gradient_checkpointing_func(
[rank2]: File "~/miniconda3/envs/llama-recipes/lib/python3.10/site-packages/torch/_compile.py", line 31, in inner
[rank2]: return disable_fn(*args, **kwargs)
[rank2]: File "~/miniconda3/envs/llama-recipes/lib/python3.10/site-packages/torch/_dynamo/eval_frame.py", line 600, in _fn
[rank2]: return fn(*args, **kwargs)
[rank2]: File "~/miniconda3/envs/llama-recipes/lib/python3.10/site-packages/torch/utils/checkpoint.py", line 481, in checkpoint
[rank2]: return CheckpointFunction.apply(function, preserve, *args)
[rank2]: File "~/miniconda3/envs/llama-recipes/lib/python3.10/site-packages/torch/autograd/function.py", line 574, in apply
[rank2]: return super().apply(*args, **kwargs) # type: ignore[misc]
[rank2]: File "~/miniconda3/envs/llama-recipes/lib/python3.10/site-packages/torch/utils/checkpoint.py", line 255, in forward
[rank2]: outputs = run_function(*args)
[rank2]: File "~/miniconda3/envs/llama-recipes/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1553, in _wrapped_call_impl
[rank2]: return self._call_impl(*args, **kwargs)
[rank2]: File "~/miniconda3/envs/llama-recipes/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1592, in _call_impl
[rank2]: args_result = hook(self, args)
[rank2]: File "~/miniconda3/envs/llama-recipes/lib/python3.10/site-packages/torch/utils/module_tracker.py", line 124, in _fw_pre_hook
[rank2]: register_multi_grad_hook(tensors, self._get_pop_fn(name, True))
[rank2]: File "~/miniconda3/envs/llama-recipes/lib/python3.10/site-packages/torch/autograd/graph.py", line 468, in register_multi_grad_hook
[rank2]: grad_fns = list(map(_get_grad_fn_or_grad_acc, tensors))
[rank2]: File "~/miniconda3/envs/llama-recipes/lib/python3.10/site-packages/torch/autograd/graph.py", line 161, in _get_grad_fn_or_grad_acc
[rank2]: return t.view_as(t).grad_fn.next_functions[0][0]
[rank2]: AttributeError: 'NoneType' object has no attribute 'next_functions'
Traceback (most recent call last):
File "~/workspace/repo/llama-recipes/recipes/quickstart/finetuning/finetuning.py", line 8, in <module>
fire.Fire(main)
File "~/miniconda3/envs/llama-recipes/lib/python3.10/site-packages/fire/core.py", line 143, in Fire
component_trace = _Fire(component, args, parsed_flag_args, context, name)
File "~/miniconda3/envs/llama-recipes/lib/python3.10/site-packages/fire/core.py", line 477, in _Fire
component, remaining_args = _CallAndUpdateTrace(
File "~/miniconda3/envs/llama-recipes/lib/python3.10/site-packages/fire/core.py", line 693, in _CallAndUpdateTrace
component = fn(*varargs, **kwargs)
File "~/workspace/repo/llama-recipes/src/llama_recipes/finetuning.py", line 270, in main
results = train(
File "~/workspace/repo/llama-recipes/src/llama_recipes/utils/train_utils.py", line 152, in train
loss = model(**batch).loss
File "~/miniconda3/envs/llama-recipes/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1553, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "~/miniconda3/envs/llama-recipes/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1603, in _call_impl
result = forward_call(*args, **kwargs)
File "~/miniconda3/envs/llama-recipes/lib/python3.10/site-packages/torch/distributed/fsdp/fully_sharded_data_parallel.py", line 863, in forward
output = self._fsdp_wrapped_module(*args, **kwargs)
File "~/miniconda3/envs/llama-recipes/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1553, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "~/miniconda3/envs/llama-recipes/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1603, in _call_impl
result = forward_call(*args, **kwargs)
File "~/miniconda3/envs/llama-recipes/lib/python3.10/site-packages/peft/peft_model.py", line 1577, in forward
return self.base_model(
File "~/miniconda3/envs/llama-recipes/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1553, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "~/miniconda3/envs/llama-recipes/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1603, in _call_impl
result = forward_call(*args, **kwargs)
File "~/miniconda3/envs/llama-recipes/lib/python3.10/site-packages/peft/tuners/tuners_utils.py", line 188, in forward
return self.model.forward(*args, **kwargs)
File "~/miniconda3/envs/llama-recipes/lib/python3.10/site-packages/transformers/models/llama/modeling_llama.py", line 1141, in forward
outputs = self.model(
File "~/miniconda3/envs/llama-recipes/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1553, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "~/miniconda3/envs/llama-recipes/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1603, in _call_impl
result = forward_call(*args, **kwargs)
File "~/miniconda3/envs/llama-recipes/lib/python3.10/site-packages/transformers/models/llama/modeling_llama.py", line 932, in forward
layer_outputs = self._gradient_checkpointing_func(
File "~/miniconda3/envs/llama-recipes/lib/python3.10/site-packages/torch/_compile.py", line 31, in inner
return disable_fn(*args, **kwargs)
File "~/miniconda3/envs/llama-recipes/lib/python3.10/site-packages/torch/_dynamo/eval_frame.py", line 600, in _fn
return fn(*args, **kwargs)
File "~/miniconda3/envs/llama-recipes/lib/python3.10/site-packages/torch/utils/checkpoint.py", line 481, in checkpoint
return CheckpointFunction.apply(function, preserve, *args)
File "~/miniconda3/envs/llama-recipes/lib/python3.10/site-packages/torch/autograd/function.py", line 574, in apply
return super().apply(*args, **kwargs) # type: ignore[misc]
File "~/miniconda3/envs/llama-recipes/lib/python3.10/site-packages/torch/utils/checkpoint.py", line 255, in forward
outputs = run_function(*args)
File "~/miniconda3/envs/llama-recipes/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1553, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "~/miniconda3/envs/llama-recipes/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1592, in _call_impl
args_result = hook(self, args)
File "~/miniconda3/envs/llama-recipes/lib/python3.10/site-packages/torch/utils/module_tracker.py", line 124, in _fw_pre_hook
register_multi_grad_hook(tensors, self._get_pop_fn(name, True))
File "~/miniconda3/envs/llama-recipes/lib/python3.10/site-packages/torch/autograd/graph.py", line 468, in register_multi_grad_hook
grad_fns = list(map(_get_grad_fn_or_grad_acc, tensors))
File "~/miniconda3/envs/llama-recipes/lib/python3.10/site-packages/torch/autograd/graph.py", line 161, in _get_grad_fn_or_grad_acc
return t.view_as(t).grad_fn.next_functions[0][0]
AttributeError: 'NoneType' object has no attribute 'next_functions'
Here is the cmd python -m torch.utils.collect_env
output:
Collecting environment information...
PyTorch version: 2.4.0+cu121
Is debug build: False
CUDA used to build PyTorch: 12.1
ROCM used to build PyTorch: N/A
OS: Ubuntu 20.04.6 LTS (x86_64)
GCC version: (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0
Clang version: Could not collect
CMake version: version 3.30.2
Libc version: glibc-2.31
Python version: 3.10.14 (main, May 6 2024, 19:42:50) [GCC 11.2.0] (64-bit runtime)
Python platform: Linux-5.4.0-144-generic-x86_64-with-glibc2.31
Is CUDA available: True
CUDA runtime version: 12.0.76
CUDA_MODULE_LOADING set to: LAZY
GPU models and configuration:
GPU 0: NVIDIA A800-SXM4-80GB
GPU 1: NVIDIA A800-SXM4-80GB
GPU 2: NVIDIA A800-SXM4-80GB
GPU 3: NVIDIA A800-SXM4-80GB
GPU 4: NVIDIA A800-SXM4-80GB
GPU 5: NVIDIA A800-SXM4-80GB
GPU 6: NVIDIA A800-SXM4-80GB
GPU 7: NVIDIA A800-SXM4-80GB
Nvidia driver version: 525.105.17
cuDNN version: Probably one of the following:
/usr/lib/x86_64-linux-gnu/libcudnn.so.8.9.2
/usr/lib/x86_64-linux-gnu/libcudnn_adv_infer.so.8.9.2
/usr/lib/x86_64-linux-gnu/libcudnn_adv_train.so.8.9.2
/usr/lib/x86_64-linux-gnu/libcudnn_cnn_infer.so.8.9.2
/usr/lib/x86_64-linux-gnu/libcudnn_cnn_train.so.8.9.2
/usr/lib/x86_64-linux-gnu/libcudnn_ops_infer.so.8.9.2
/usr/lib/x86_64-linux-gnu/libcudnn_ops_train.so.8.9.2
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True
CPU:
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
Address sizes: 46 bits physical, 57 bits virtual
CPU(s): 128
On-line CPU(s) list: 0-127
Thread(s) per core: 2
Core(s) per socket: 32
Socket(s): 2
NUMA node(s): 2
Vendor ID: GenuineIntel
CPU family: 6
Model: 106
Model name: Intel(R) Xeon(R) Platinum 8358 CPU @ 2.60GHz
Stepping: 6
CPU MHz: 3300.000
BogoMIPS: 5200.00
Virtualization: VT-x
L1d cache: 3 MiB
L1i cache: 2 MiB
L2 cache: 80 MiB
L3 cache: 96 MiB
NUMA node0 CPU(s): 0-31,64-95
NUMA node1 CPU(s): 32-63,96-127
Vulnerability Itlb multihit: Not affected
Vulnerability L1tf: Not affected
Vulnerability Mds: Not affected
Vulnerability Meltdown: Not affected
Vulnerability Mmio stale data: Mitigation; Clear CPU buffers; SMT vulnerable
Vulnerability Retbleed: Not affected
Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl and seccomp
Vulnerability Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2: Mitigation; Enhanced IBRS, IBPB conditional, RSB filling, PBRSB-eIBRS SW sequence
Vulnerability Srbds: Not affected
Vulnerability Tsx async abort: Not affected
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb cat_l3 invpcid_single ssbd mba ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid cqm rdt_a avx512f avx512dq rdseed adx smap avx512ifma clflushopt clwb intel_pt avx512cd sha_ni avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local wbnoinvd dtherm ida arat pln pts avx512vbmi umip pku ospke avx512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx512_bitalg tme avx512_vpopcntdq rdpid md_clear pconfig flush_l1d arch_capabilities
Versions of relevant libraries:
[pip3] flake8==7.1.1
[pip3] flake8-bugbear==24.8.19
[pip3] mypy-extensions==1.0.0
[pip3] numpy==1.26.4
[pip3] onnx==1.16.2
[pip3] onnxruntime==1.19.0
[pip3] pytorch-triton==3.0.0+dedb7bdf33
[pip3] torch==2.4.0
[pip3] torchaudio==2.5.0.dev20240903+cu121
[pip3] torchtext==0.18.0
[pip3] torchtnt==0.2.4
[pip3] torchvision==0.19.0
[pip3] triton==3.0.0
[conda] numpy 1.26.4 pypi_0 pypi
[conda] pytorch-triton 3.0.0+dedb7bdf33 pypi_0 pypi
[conda] torch 2.4.0 pypi_0 pypi
[conda] torchaudio 2.5.0.dev20240903+cu121 pypi_0 pypi
[conda] torchtext 0.18.0 pypi_0 pypi
[conda] torchtnt 0.2.4 pypi_0 pypi
[conda] torchvision 0.19.0 pypi_0 pypi
[conda] triton 3.0.0 pypi_0 pypi
π The feature, motivation and pitch
I am able to run the training with the FSDP. But then add the "--flop_counter" flag. It gives the following issue. Could someone take a look at this issue? Is that possible to make the report flop count as default? Thanks
1: The module hierarchy tracking seems to be messed up.Please file a bug to PyTorch. 1: The module hierarchy tracking seems to be messed up.Please file a bug to PyTorch. 1: The module hierarchy tracking seems to be messed up.Please file a bug to PyTorch. 1: The module hierarchy tracking seems to be messed up.Please file a bug to PyTorch. 1: The module hierarchy tracking seems to be messed up.Please file a bug to PyTorch. 1: The module hierarchy tracking seems to be messed up.Please file a bug to PyTorch. 1: The module hierarchy tracking seems to be messed up.Please file a bug to PyTorch. 0: :0:rocdevice.cpp :2875: 1456647898545 us: [pid:3202 tid:0x7f2309bff700] Callback: Queue 0x7ee2fba00000 Aborting with error : HSA_STATUS_ERROR_OUT_OF_RESOURCES: The runtime failed to allocate the necessary resources. This error may also occur when the core runtime library needs to spawn threads or create internal OS-specific events. Code: 0x1008 Available Free mem : 234 MB 0: :0:rocdevice.cpp :2875: 1456647904587 us: [pid:3198 tid:0x7f020bbff700] Callback: Queue 0x7f0208200000 Aborting with error : HSA_STATUS_ERROR_OUT_OF_RESOURCES: The runtime failed to allocate the necessary resources. This error may also occur when the core runtime library needs to spawn threads or create internal OS-specific events. Code: 0x1008 Available Free mem : 226 MB 1: :0:rocdevice.cpp :2875: 2157204836001 us: [pid:208 tid:0x7fb03b1ff700] Callback: Queue 0x7f7031a00000 Aborting with error : HSA_STATUS_ERROR_OUT_OF_RESOURCES: The runtime failed to allocate the necessary resources. This error may also occur when the core runtime library needs to spawn threads or create internal OS-specific events. Code: 0x1008 Available Free mem : 242 MB 1: :0:rocdevice.cpp :2875: 2157204836358 us: [pid:207 tid:0x7f0c92fff700] Callback: Queue 0x7ecc89800000 Aborting with error : HSA_STATUS_ERROR_OUT_OF_RESOURCES: The runtime failed to allocate the necessary resources. This error may also occur when the core runtime library needs to spawn threads or create internal OS-specific events. Code: 0x1008 Available Free mem : 246 MB 1: :0:rocdevice.cpp :2875: 2157204838420 us: [pid:203 tid:0x7f59a81ff700] Callback: Queue 0x7f199ea00000 Aborting with error : HSA_STATUS_ERROR_OUT_OF_RESOURCES: The runtime failed to allocate the necessary resources. This error may also occur when the core runtime library needs to spawn threads or create internal OS-specific events. Code: 0x1008 Available Free mem : 242 MB 0: :0:rocdevice.cpp :2875: 1456647929027 us: [pid:3201 tid:0x7f2e33bff700] Callback: Queue 0x7f2e30200000 Aborting with error : HSA_STATUS_ERROR_OUT_OF_RESOURCES: The runtime failed to allocate the necessary resources. This error may also occur when the core runtime library needs to spawn threads or create internal OS-specific events. Code: 0x1008 Available Free mem : 226 MB 0: :0:rocdevice.cpp :2875: 1456648084561 us: [pid:3203 tid:0x7fac6c1ff700] Callback: Queue 0x7f6c62a00000 Aborting with error : HSA_STATUS_ERROR_OUT_OF_RESOURCES: The runtime failed to allocate the necessary resources. This error may also occur when the core runtime library needs to spawn threads or create internal OS-specific events. Code: 0x1008 Available Free mem : 246 MB 1: W0823 17:42:51.540936 131 torch/distributed/elastic/multiprocessing/api.py:891] Sending process 202 closing signal SIGTERM 1: W0823 17:42:51.543727 131 torch/distributed/elastic/multiprocessing/api.py:891] Sending process 203 closing signal SIGTERM 1: W0823 17:42:51.544753 131 torch/distributed/elastic/multiprocessing/api.py:891] Sending process 204 closing signal SIGTERM 1: W0823 17:42:51.547995 131 torch/distributed/elastic/multiprocessing/api.py:891] Sending process 205 closing signal SIGTERM 1: W0823 17:42:51.549960 131 torch/distributed/elastic/multiprocessing/api.py:891] Sending process 206 closing signal SIGTERM 1: W0823 17:42:51.552839 131 torch/distributed/elastic/multiprocessing/api.py:891] Sending process 208 closing signal SIGTERM 1: W0823 17:42:51.553608 131 torch/distributed/elastic/multiprocessing/api.py:891] Sending process 209 closing signal SIGTERM 0: :0:rocdevice.cpp :2875: 1456648361779 us: [pid:3204 tid:0x7f04efdff700] Callback: Queue 0x7ec4e6600000 Aborting with error : HSA_STATUS_ERROR_OUT_OF_RESOURCES: The runtime failed to allocate the necessary resources. This error may also occur when the core runtime library needs to spawn threads or create internal OS-specific events. Code: 0x1008 Available Free mem : 242 MB 0: W0823 17:42:51.587928 3126 torch/distributed/elastic/multiprocessing/api.py:891] Sending process 3198 closing signal SIGTERM 0: W0823 17:42:51.588275 3126 torch/distributed/elastic/multiprocessing/api.py:891] Sending process 3199 closing signal SIGTERM 0: W0823 17:42:51.591612 3126 torch/distributed/elastic/multiprocessing/api.py:891] Sending process 3200 closing signal SIGTERM 0: W0823 17:42:51.592847 3126 torch/distributed/elastic/multiprocessing/api.py:891] Sending process 3203 closing signal SIGTERM 0: W0823 17:42:51.595798 3126 torch/distributed/elastic/multiprocessing/api.py:891] Sending process 3204 closing signal SIGTERM 0: W0823 17:42:51.597895 3126 torch/distributed/elastic/multiprocessing/api.py:891] Sending process 3205 closing signal SIGTERM 0: E0823 17:42:52.329508 3126 torch/distributed/elastic/multiprocessing/api.py:863] failed (exitcode: -6) local_rank: 3 (pid: 3201) of binary: /opt/conda/envs/py_3.8/bin/python 0: Traceback (most recent call last): 0: File "/opt/conda/envs/py_3.8/bin/torchrun", line 33, in
0: sys.exit(load_entry_point('torch==2.5.0a0+git10344d7', 'console_scripts', 'torchrun')())
0: File "/opt/conda/envs/py_3.8/lib/python3.8/site-packages/torch/distributed/elastic/multiprocessing/errors/init.py", line 355, in wrapper
0: return f(*args, **kwargs)
0: File "/opt/conda/envs/py_3.8/lib/python3.8/site-packages/torch/distributed/run.py", line 919, in main
0: run(args)
0: File "/opt/conda/envs/py_3.8/lib/python3.8/site-packages/torch/distributed/run.py", line 910, in run
0: elastic_launch(
0: File "/opt/conda/envs/py_3.8/lib/python3.8/site-packages/torch/distributed/launcher/api.py", line 138, in call
0: return launch_agent(self._config, self._entrypoint, list(args))
0: File "/opt/conda/envs/py_3.8/lib/python3.8/site-packages/torch/distributed/launcher/api.py", line 269, in launch_agent
0: raise ChildFailedError(
0: torch.distributed.elastic.multiprocessing.errors.ChildFailedError:
Alternatives
No response
Additional context
No response