I am running this code from the official repository of the book.
And it is giving the following errors on my system. can anyone have a look into this and point me to the right direction .
This same error is coming while running the nlp_example.py file from the accelerate examples repository .
Steps to reproduce the behavior:
git clone https://huggingface.co/transformersbook/codeparrot
cd codeparrot
pip install -r requirements.txt
wandb login
accelerate config
accelerate launch codeparrot_training.py
โฆ ๐ 11:41:06 โฏ accelerate launch codeparrot_training.py
2023-05-10 11:45:58.950271: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcudart.so.10.1
[I socket.cpp:566] [c10d] The server socket has started to listen on [::]:29500.
[I socket.cpp:787] [c10d] The client socket has connected to [::ffff:127.0.0.1]:29500 on[::ffff:127.0.0.1]:44970.
[I socket.cpp:787] [c10d] The client socket has connected to [::ffff:127.0.0.1]:29500 on[::ffff:127.0.0.1]:44986.
2023-05-10 11:46:03.976884: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcudart.so.10.1
2023-05-10 11:46:03.993856: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcudart.so.10.1
โญโโโโโโโโโโโโโโโโโโโโโโโโโโ Traceback (most recent call last) โโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ /mnt/ssd2/tf_gpu_docker/ground0/git_repo/codeparrot/codeparrot_training.py:115 in โ
โ <module> โ
โ โ
โ 112 โ return loss.item(), perplexity.item() โ
โ 113 โ
โ 114 # Accelerator โ
โ โฑ 115 accelerator = Accelerator(dispatch_batches=True) โ
โ 116 acc_state = {str(k): str(v) for k, v in accelerator.state.__dict__.items()} โ
โ 117 # Hyperparameters โ
โ 118 project_name = 'transformersbook/codeparrot' โ
โ โ
โ /home/anaconda3/envs/lab/lib/python3.9/site-packages/accelerate/accelerator. โ
โ py:358 in __init__ โ
โ โ
โ 355 โ โ โ โ โ โ self.fp8_recipe_handler = handler โ
โ 356 โ โ โ
โ 357 โ โ kwargs = self.init_handler.to_kwargs() if self.init_handler is not Non โ
โ โฑ 358 โ โ self.state = AcceleratorState( โ
โ 359 โ โ โ mixed_precision=mixed_precision, โ
โ 360 โ โ โ cpu=cpu, โ
โ 361 โ โ โ dynamo_plugin=dynamo_plugin, โ
โ โ
โ /home/anaconda3/envs/lab/lib/python3.9/site-packages/accelerate/state.py:535 โ
โ in __init__ โ
โ โ
โ 532 โ โ if parse_flag_from_env("ACCELERATE_USE_CPU"): โ
โ 533 โ โ โ cpu = True โ
โ 534 โ โ if PartialState._shared_state == {}: โ
โ โฑ 535 โ โ โ PartialState(cpu, **kwargs) โ
โ 536 โ โ self.__dict__.update(PartialState._shared_state) โ
โ 537 โ โ self._check_initialized(mixed_precision, cpu) โ
โ 538 โ โ if not self.initialized: โ
โ โ
โ /home/anaconda3/envs/lab/lib/python3.9/site-packages/accelerate/state.py:130 โ
โ in __init__ โ
โ โ
โ 127 โ โ โ elif int(os.environ.get("LOCAL_RANK", -1)) != -1 and not cpu: โ
โ 128 โ โ โ โ self.distributed_type = DistributedType.MULTI_GPU โ
โ 129 โ โ โ โ if not torch.distributed.is_initialized(): โ
โ โฑ 130 โ โ โ โ โ self.backend = kwargs.pop("backend") โ
โ 131 โ โ โ โ โ torch.distributed.init_process_group(backend=self.backend, โ
โ 132 โ โ โ โ self.num_processes = torch.distributed.get_world_size() โ
โ 133 โ โ โ โ self.process_index = torch.distributed.get_rank() โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
KeyError: 'backend'
โญโโโโโโโโโโโโโโโโโโโโโโโโโโ Traceback (most recent call last) โโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ /mnt/ssd2/tf_gpu_docker/ground0/git_repo/codeparrot/codeparrot_training.py:115 in โ
โ <module> โ
โ โ
โ 112 โ return loss.item(), perplexity.item() โ
โ 113 โ
โ 114 # Accelerator โ
โ โฑ 115 accelerator = Accelerator(dispatch_batches=True) โ
โ 116 acc_state = {str(k): str(v) for k, v in accelerator.state.__dict__.items()} โ
โ 117 # Hyperparameters โ
โ 118 project_name = 'transformersbook/codeparrot' โ
โ โ
โ /home/anaconda3/envs/lab/lib/python3.9/site-packages/accelerate/accelerator. โ
โ py:358 in __init__ โ
โ โ
โ 355 โ โ โ โ โ โ self.fp8_recipe_handler = handler โ
โ 356 โ โ โ
โ 357 โ โ kwargs = self.init_handler.to_kwargs() if self.init_handler is not Non โ
โ โฑ 358 โ โ self.state = AcceleratorState( โ
โ 359 โ โ โ mixed_precision=mixed_precision, โ
โ 360 โ โ โ cpu=cpu, โ
โ 361 โ โ โ dynamo_plugin=dynamo_plugin, โ
โ โ
โ /home/anaconda3/envs/lab/lib/python3.9/site-packages/accelerate/state.py:535 โ
โ in __init__ โ
โ โ
โ 532 โ โ if parse_flag_from_env("ACCELERATE_USE_CPU"): โ
โ 533 โ โ โ cpu = True โ
โ 534 โ โ if PartialState._shared_state == {}: โ
โ โฑ 535 โ โ โ PartialState(cpu, **kwargs) โ
โ 536 โ โ self.__dict__.update(PartialState._shared_state) โ
โ 537 โ โ self._check_initialized(mixed_precision, cpu) โ
โ 538 โ โ if not self.initialized: โ
โ โ
โ /home/anaconda3/envs/lab/lib/python3.9/site-packages/accelerate/state.py:130 โ
โ in __init__ โ
โ โ
โ 127 โ โ โ elif int(os.environ.get("LOCAL_RANK", -1)) != -1 and not cpu: โ
โ 128 โ โ โ โ self.distributed_type = DistributedType.MULTI_GPU โ
โ 129 โ โ โ โ if not torch.distributed.is_initialized(): โ
โ โฑ 130 โ โ โ โ โ self.backend = kwargs.pop("backend") โ
โ 131 โ โ โ โ โ torch.distributed.init_process_group(backend=self.backend, โ
โ 132 โ โ โ โ self.num_processes = torch.distributed.get_world_size() โ
โ 133 โ โ โ โ self.process_index = torch.distributed.get_rank() โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
KeyError: 'backend'
[11:46:07] ERROR failed (exitcode: 1) local_rank: 0 (pid: 103878) of api.py:672
binary: /home/anaconda3/envs/lab/bin/python
โญโโโโโโโโโโโโโโโโโโโโโโโโโโ Traceback (most recent call last) โโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ /home/anaconda3/envs/lab/bin/accelerate:8 in <module> โ
โ โ
โ 5 from accelerate.commands.accelerate_cli import main โ
โ 6 if __name__ == '__main__': โ
โ 7 โ sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) โ
โ โฑ 8 โ sys.exit(main()) โ
โ 9 โ
โ โ
โ /home/anaconda3/envs/lab/lib/python3.9/site-packages/accelerate/commands/acc โ
โ elerate_cli.py:45 in main โ
โ โ
โ 42 โ โ exit(1) โ
โ 43 โ โ
โ 44 โ # Run โ
โ โฑ 45 โ args.func(args) โ
โ 46 โ
โ 47 โ
โ 48 if __name__ == "__main__": โ
โ โ
โ /home/anaconda3/envs/lab/lib/python3.9/site-packages/accelerate/commands/lau โ
โ nch.py:909 in launch_command โ
โ โ
โ 906 โ elif args.use_megatron_lm and not args.cpu: โ
โ 907 โ โ multi_gpu_launcher(args) โ
โ 908 โ elif args.multi_gpu and not args.cpu: โ
โ โฑ 909 โ โ multi_gpu_launcher(args) โ
โ 910 โ elif args.tpu and not args.cpu: โ
โ 911 โ โ if args.tpu_use_cluster: โ
โ 912 โ โ โ tpu_pod_launcher(args) โ
โ โ
โ /home/anaconda3/envs/lab/lib/python3.9/site-packages/accelerate/commands/lau โ
โ nch.py:604 in multi_gpu_launcher โ
โ โ
โ 601 โ ) โ
โ 602 โ with patch_environment(**current_env): โ
โ 603 โ โ try: โ
โ โฑ 604 โ โ โ distrib_run.run(args) โ
โ 605 โ โ except Exception: โ
โ 606 โ โ โ if is_rich_available() and debug: โ
โ 607 โ โ โ โ console = get_console() โ
โ โ
โ /home/anaconda3/envs/lab/lib/python3.9/site-packages/torch/distributed/run.p โ
โ y:785 in run โ
โ โ
โ 782 โ โ ) โ
โ 783 โ โ
โ 784 โ config, cmd, cmd_args = config_from_args(args) โ
โ โฑ 785 โ elastic_launch( โ
โ 786 โ โ config=config, โ
โ 787 โ โ entrypoint=cmd, โ
โ 788 โ )(*cmd_args) โ
โ โ
โ /home/anaconda3/envs/lab/lib/python3.9/site-packages/torch/distributed/launc โ
โ her/api.py:134 in __call__ โ
โ โ
โ 131 โ โ self._entrypoint = entrypoint โ
โ 132 โ โ
โ 133 โ def __call__(self, *args): โ
โ โฑ 134 โ โ return launch_agent(self._config, self._entrypoint, list(args)) โ
โ 135 โ
โ 136 โ
โ 137 def _get_entrypoint_name( โ
โ โ
โ /home/anaconda3/envs/lab/lib/python3.9/site-packages/torch/distributed/launc โ
โ her/api.py:250 in launch_agent โ
โ โ
โ 247 โ โ โ # if the error files for the failed children exist โ
โ 248 โ โ โ # @record will copy the first error (root cause) โ
โ 249 โ โ โ # to the error file of the launcher process. โ
โ โฑ 250 โ โ โ raise ChildFailedError( โ
โ 251 โ โ โ โ name=entrypoint_name, โ
โ 252 โ โ โ โ failures=result.failures, โ
โ 253 โ โ โ ) โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
ChildFailedError:
============================================================
codeparrot_training.py FAILED
------------------------------------------------------------
Failures:
[1]:
time : 2023-05-10_11:46:07
host : YODA
rank : 1 (local_rank: 1)
exitcode : 1 (pid: 103879)
error_file: <N/A>
traceback : To enable traceback see:
https://pytorch.org/docs/stable/elastic/errors.html
------------------------------------------------------------
Root Cause (first observed failure):
[0]:
time : 2023-05-10_11:46:07
host : YODA
rank : 0 (local_rank: 0)
exitcode : 1 (pid: 103878)
error_file: <N/A>
traceback : To enable traceback see:
https://pytorch.org/docs/stable/elastic/errors.html
============================================================
My accelerate config file :
โฆ ๐ 12:13:56 โ cat /home/.cache/huggingface/accelerate/default_config.yaml
compute_environment: LOCAL_MACHINE
distributed_type: MULTI_GPU
downcast_bf16: 'no'
gpu_ids: '[0,1]'
machine_rank: 0
main_training_function: main
mixed_precision: fp16
num_machines: 1
num_processes: 2
rdzv_backend: static
same_network: true
tpu_env: []
tpu_use_cluster: false
tpu_use_sudo: false
use_cpu: false
My GPU details:
โฆ ๐ 12:14:05 โฏ nvidia-smi
Wed May 10 12:15:24 2023
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 510.108.03 Driver Version: 510.108.03 CUDA Version: 11.6 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|===============================+======================+======================|
| 0 NVIDIA GeForce ... Off | 00000000:09:00.0 Off | N/A |
| 36% 32C P8 1W / 250W | 10MiB / 11264MiB | 0% Default |
| | | N/A |
+-------------------------------+----------------------+----------------------+
| 1 NVIDIA GeForce ... Off | 00000000:42:00.0 On | N/A |
| 36% 36C P8 17W / 250W | 418MiB / 11264MiB | 9% Default |
| | | N/A |
+-------------------------------+----------------------+----------------------+
My CPU Details:
โฆ2 ๐ 11:11:09 โฏ lscpu
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
Address sizes: 43 bits physical, 48 bits virtual
CPU(s): 48
On-line CPU(s) list: 0-47
Thread(s) per core: 2
Core(s) per socket: 24
Socket(s): 1
NUMA node(s): 4
Vendor ID: AuthenticAMD
CPU family: 23
Model: 8
Model name: AMD Ryzen Threadripper 2970WX 24-Core Processor
Stepping: 2
Frequency boost: enabled
CPU MHz: 2514.475
CPU max MHz: 3000.0000
CPU min MHz: 2200.0000
BogoMIPS: 5988.41
Virtualization: AMD-V
L1d cache: 768 KiB
L1i cache: 1.5 MiB
L2 cache: 12 MiB
L3 cache: 64 MiB
NUMA node0 CPU(s): 0-5,24-29
NUMA node1 CPU(s): 12-17,36-41
NUMA node2 CPU(s): 6-11,30-35
NUMA node3 CPU(s): 18-23,42-47
Vulnerability Itlb multihit: Not affected
Vulnerability L1tf: Not affected
Vulnerability Mds: Not affected
Vulnerability Meltdown: Not affected
Vulnerability Mmio stale data: Not affected
Vulnerability Retbleed: Mitigation; untrained return thunk; SMT vulnera
ble
Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled v
ia prctl and seccomp
Vulnerability Spectre v1: Mitigation; usercopy/swapgs barriers and __user
pointer sanitization
Vulnerability Spectre v2: Mitigation; Retpolines, IBPB conditional, STIBP
disabled, RSB filling, PBRSB-eIBRS Not affecte
d
Vulnerability Srbds: Not affected
Vulnerability Tsx async abort: Not affected
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtr
r pge mca cmov pat pse36 clflush mmx fxsr sse s
se2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtsc
p lm constant_tsc rep_good nopl nonstop_tsc cpu
id extd_apicid amd_dcm aperfmperf rapl pni pclm
ulqdq monitor ssse3 fma cx16 sse4_1 sse4_2 movb
e popcnt aes xsave avx f16c rdrand lahf_lm cmp_
legacy svm extapic cr8_legacy abm sse4a misalig
nsse 3dnowprefetch osvw skinit wdt tce topoext
perfctr_core perfctr_nb bpext perfctr_llc mwait
x cpb hw_pstate ssbd ibpb vmmcall fsgsbase bmi1
avx2 smep bmi2 rdseed adx smap clflushopt sha_
ni xsaveopt xsavec xgetbv1 xsaves clzero irperf
xsaveerptr arat npt lbrv svm_lock nrip_save ts
c_scale vmcb_clean flushbyasid decodeassists pa
usefilter pfthreshold avic v_vmsave_vmload vgif
overflow_recov succor smca sme sev sev_es