pytorch / torchchat

Run PyTorch LLMs locally on servers, desktop and mobile
BSD 3-Clause "New" or "Revised" License
3.39k stars 224 forks source link

AssertionError: Found multiple weight mapping files #1360

Closed DemonODG closed 3 days ago

DemonODG commented 2 weeks ago

🐛 Describe the bug

python3 torchchat.py download mistralai/mistral-7b-instruct-v0.2 ..... ..... File "/home/dimanodg/myproject/torchchat/torchchat/cli/convert_hf_checkpoint.py", line 46, in convert_hf_checkpoint assert len(model_map_json_matches) <= 1, "Found multiple weight mapping files" AssertionError: Found multiple weight mapping files

Versions

Collecting environment information... PyTorch version: 2.6.0.dev20241002+cu121 Is debug build: False CUDA used to build PyTorch: 12.1 ROCM used to build PyTorch: N/A

OS: Ubuntu 22.04.5 LTS (x86_64) GCC version: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0 Clang version: Could not collect CMake version: version 3.30.5 Libc version: glibc-2.35

Python version: 3.10.12 (main, Sep 11 2024, 15:47:36) [GCC 11.4.0] (64-bit runtime) Python platform: Linux-5.15.153.1-microsoft-standard-WSL2-x86_64-with-glibc2.35 Is CUDA available: True CUDA runtime version: 12.3.52 CUDA_MODULE_LOADING set to: LAZY GPU models and configuration: GPU 0: NVIDIA GeForce RTX 2080 Ti Nvidia driver version: 560.94 cuDNN version: Probably one of the following: /usr/lib/x86_64-linux-gnu/libcudnn.so.8.9.7 /usr/lib/x86_64-linux-gnu/libcudnn.so.9.2.0 /usr/lib/x86_64-linux-gnu/libcudnn_adv.so.9.2.0 /usr/lib/x86_64-linux-gnu/libcudnn_adv_infer.so.8.9.7 /usr/lib/x86_64-linux-gnu/libcudnn_adv_train.so.8.9.7 /usr/lib/x86_64-linux-gnu/libcudnn_cnn.so.9.2.0 /usr/lib/x86_64-linux-gnu/libcudnn_cnn_infer.so.8.9.7 /usr/lib/x86_64-linux-gnu/libcudnn_cnn_train.so.8.9.7 /usr/lib/x86_64-linux-gnu/libcudnn_engines_precompiled.so.9.2.0 /usr/lib/x86_64-linux-gnu/libcudnn_engines_runtime_compiled.so.9.2.0 /usr/lib/x86_64-linux-gnu/libcudnn_graph.so.9.2.0 /usr/lib/x86_64-linux-gnu/libcudnn_heuristic.so.9.2.0 /usr/lib/x86_64-linux-gnu/libcudnn_ops.so.9.2.0 /usr/lib/x86_64-linux-gnu/libcudnn_ops_infer.so.8.9.7 /usr/lib/x86_64-linux-gnu/libcudnn_ops_train.so.8.9.7 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 Address sizes: 39 bits physical, 48 bits virtual Byte Order: Little Endian CPU(s): 20 On-line CPU(s) list: 0-19 Vendor ID: GenuineIntel Model name: 12th Gen Intel(R) Core(TM) i7-12700H CPU family: 6 Model: 154 Thread(s) per core: 2 Core(s) per socket: 10 Socket(s): 1 Stepping: 3 BogoMIPS: 5376.02 Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc rep_good nopl xtopology tsc_reliable nonstop_tsc cpuid pni pclmulqdq vmx ssse3 fma cx16 sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch ssbd ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid rdseed adx smap clflushopt clwb sha_ni xsaveopt xsavec xgetbv1 xsaves avx_vnni umip waitpkg gfni vaes vpclmulqdq rdpid movdiri movdir64b fsrm md_clear serialize flush_l1d arch_capabilities Virtualization: VT-x Hypervisor vendor: Microsoft Virtualization type: full L1d cache: 480 KiB (10 instances) L1i cache: 320 KiB (10 instances) L2 cache: 12.5 MiB (10 instances) L3 cache: 24 MiB (1 instance) Vulnerability Gather data sampling: Not affected 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; Enhanced IBRS Vulnerability Spec rstack overflow: 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

Versions of relevant libraries: [pip3] numpy==1.26.4 [pip3] nvidia-cublas-cu12==12.1.3.1 [pip3] nvidia-cuda-cupti-cu12==12.1.105 [pip3] nvidia-cuda-nvrtc-cu12==12.1.105 [pip3] nvidia-cuda-runtime-cu12==12.1.105 [pip3] nvidia-cudnn-cu12==9.1.0.70 [pip3] nvidia-cufft-cu12==11.0.2.54 [pip3] nvidia-curand-cu12==10.3.2.106 [pip3] nvidia-cusolver-cu12==11.4.5.107 [pip3] nvidia-cusparse-cu12==12.1.0.106 [pip3] nvidia-nccl-cu12==2.21.5 [pip3] nvidia-nvjitlink-cu12==12.4.127 [pip3] nvidia-nvtx-cu12==12.1.105 [pip3] pytorch-triton==3.1.0+cf34004b8a [pip3] torch==2.6.0.dev20241002+cu121 [pip3] torchao==0.5.0 [pip3] torchtune==0.4.0.dev20241010+cu121 [pip3] torchvision==0.20.0.dev20241002+cu121 [conda] No relevant packages

Jack-Khuu commented 1 week ago

Thanks for the flag, there's a discussion over here: https://github.com/pytorch/torchchat/pull/1346 about how to fix

@gabe-l-hart, @leseb Y'all have an appetite to push it through? Or we/I can spin up a RFC for someone to follow up

gabe-l-hart commented 1 week ago

Shoot! I meant to open the PR from my branch, but was on my phone and got distracted by the time I got to the keys. I'll open it first thing tomorrow, or you're welcome to open it from my fork tonight.

gabe-l-hart commented 1 week ago

PR is up: https://github.com/pytorch/torchchat/pull/1366

DemonODG commented 1 week ago

I installed it #1366 but when I run python3 torchchat.py download mistralai/mistral-7b-instruct-v0.2 it again I get the following error: Traceback (most recent call last): File "/home/dimanodg/myproject/torchchat/torchchat.py", line 102, in download_main(args) File "/home/dimanodg/myproject/torchchat/torchchat/cli/download.py", line 238, in download_main download_and_convert(args.model, args.model_directory, args.hf_token) File "/home/dimanodg/myproject/torchchat/torchchat/cli/download.py", line 131, in download_and_convert _download_hf_snapshot(model_config, temp_dir, hf_token) File "/home/dimanodg/myproject/torchchat/torchchat/cli/download.py", line 95, in _download_hf_snapshot convert_hf_checkpoint( File "/home/dimanodg/myproject/torchchat/torchchat/cli/convert_hf_checkpoint.py", line 149, in convert_hf_checkpoint assert state_dict is not None, f"Unable to load tensors from {file}" AssertionError: Unable to load tensors from lm_head.weight

gabe-l-hart commented 1 week ago

Ah, yep, definitely still a bug in there. Good catch (I never made it this far in testing since my home wifi chopped the connection right before the download finished).

gabe-l-hart commented 1 week ago

I think I have the fix pushed now. Will start the download myself and see if I can get through it. Feel free to test with the updated branch and let me know if anything else crops up!

gabe-l-hart commented 1 week ago

My download made it through and with the latest fix, I was able to verify that the model can load and runs as expected