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

Unable to read ShardedTensor in torchrec example #135

Open
arashd opened this issue Mar 30, 2023 · 3 comments
Open

Unable to read ShardedTensor in torchrec example #135

arashd opened this issue Mar 30, 2023 · 3 comments

Comments

@arashd
Copy link

arashd commented Mar 30, 2023

🐛 Describe the bug

I'm running the example in examples/torchrec/main.py to produce a checkpoint on a multi-gpu node and to subsequently load it. I'm running on 1 node with world_size=2.

$ torchrun  --rdzv_endpoint 127.0.0.1:29500   --nproc_per_node 2  examples/torchrec/main.py
...
Final loss: 0.6846450567245483
WARNING:torchsnapshot.snapshot:Rank 1 specified a path (/tmp/d4a7ed2e-53cf-40c7-9afd-63f28c290856) different from rank 0 (/tmp/bc5dd416-e7bb-40ff-ad9f-793cc338593e). Using path specified by rank 0.
Snapshot path: /tmp/bc5dd416-e7bb-40ff-ad9f-793cc338593e
...

I then try to restore from this checkpoint with:

$ torchrun --rdzv_endpoint 127.0.0.1:29500  --nproc_per_node 2 examples/torchrec/main.py --snapshot-path /tmp/ddb78914-5a32-4625-82b1-b96f7ee5bc8b
...
RuntimeError: Reading a ShardedTensor without a runtime object is not supported.
...

It appears that on snapshot.py:L646, we expect flattened.get(logical_path) to not be None for all logical_path/entry values in the manifest.

Versions

$ python ~/tml_venv/lib/python3.10/site-packages/torch/utils/collect_env.py
Collecting environment information...
PyTorch version: 2.0.0+cu117
Is debug build: False
CUDA used to build PyTorch: 11.7
ROCM used to build PyTorch: N/A

OS: Nest Enterprise Linux release 7.9.2009 (Core)  (x86_64)
GCC version: (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44)
Clang version: Could not collect
CMake version: version 3.26.1
Libc version: glibc-2.17

Python version: 3.10.0 (default, Nov  9 2021, 20:44:11) [GCC 4.8.5 20150623 (Red Hat 4.8.5-44)] (64-bit runtime)
Python platform: Linux-5.10.113-t1.el7.twitter.x86_64-x86_64-with-glibc2.17
Is CUDA available: True
CUDA runtime version: 11.3.109
CUDA_MODULE_LOADING set to: LAZY
GPU models and configuration:
GPU 0: Tesla V100S-PCIE-32GB
GPU 1: Tesla V100S-PCIE-32GB

Nvidia driver version: 470.94
cuDNN version: Could not collect
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
CPU(s):                104
On-line CPU(s) list:   0-103
Thread(s) per core:    2
Core(s) per socket:    26
Socket(s):             2
NUMA node(s):          2
Vendor ID:             GenuineIntel
CPU family:            6
Model:                 85
Model name:            Intel(R) Xeon(R) Gold 6230R CPU @ 2.10GHz
Stepping:              7
CPU MHz:               2977.709
CPU max MHz:           2101.0000
CPU min MHz:           1000.0000
BogoMIPS:              4200.00
Virtualization:        VT-x
L1d cache:             32K
L1i cache:             32K
L2 cache:              1024K
L3 cache:              36608K
NUMA node0 CPU(s):     0-25,52-77
NUMA node1 CPU(s):     26-51,78-103
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 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 cdp_l3 invpcid_single pti intel_ppin 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 mpx rdt_a avx512f avx512dq rdseed adx smap clflushopt clwb intel_pt avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local dtherm ida arat pln pts pku ospke avx512_vnni md_clear flush_l1d arch_capabilities

Versions of relevant libraries:
[pip3] mypy==1.0.1
[pip3] mypy-extensions==0.4.3
[pip3] numpy==1.22.0
[pip3] pytest-mypy==0.10.3
[pip3] torch==2.0.0
[pip3] torchmetrics==0.11.0
[pip3] torchrec==0.4.0
[pip3] torchsnapshot==0.1.0
[pip3] torchx==0.3.0
[conda] No relevant packages
@Ye-Tian-Zero
Copy link
Contributor

any update? encountered same issue

@juguya
Copy link

juguya commented Feb 2, 2024

encountered same issue with:
torch==2.1.2
torchrec==0.5.0
torchx==0.6.0
torchsnapshot-0.1.0

@juguya
Copy link

juguya commented Feb 4, 2024

encountered same issue with: torch==2.1.2 torchrec==0.5.0 torchx==0.6.0 torchsnapshot-0.1.0

After some digging, I found that it was some bug in restoring multiple app_states。I managed to work around by saving and restoring differenct app_state in different folders, something like this:

┆   snapshots = {}
┆   for k, v in self._app_state.items():
┆   ┆   snapshots[k] = torchsnapshot.Snapshot.take(
┆   ┆   ┆   path=save_path + f"/{k}",
┆   ┆   ┆   app_state={k: v},
┆   ┆   ┆   replicated=["**"],
┆   ┆   )

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

No branches or pull requests

3 participants