torchchat
torchchat copied to clipboard
Llama 3.2 MM Multiturn Browser: Second message errors out
🐛 Describe the bug
Kick off a server (tested on CPU)
python3 torchchat.py server llama3.2-11B
In a separate terminal open the browser:
streamlit run torchchat/usages/browser.py
First send a message with an image.
When that completes
- remove the image from the LHS bar
- Send a new message
Error when sending the second message:
Traceback (most recent call last):
File "/Users/jackkhuu/Desktop/oss/torchchat/.venv/lib/python3.12/site-packages/werkzeug/serving.py", line 370, in run_wsgi
execute(self.server.app)
File "/Users/jackkhuu/Desktop/oss/torchchat/.venv/lib/python3.12/site-packages/werkzeug/serving.py", line 333, in execute
for data in application_iter:
File "/Users/jackkhuu/Desktop/oss/torchchat/.venv/lib/python3.12/site-packages/werkzeug/wsgi.py", line 256, in __next__
return self._next()
^^^^^^^^^^^^
File "/Users/jackkhuu/Desktop/oss/torchchat/.venv/lib/python3.12/site-packages/werkzeug/wrappers/response.py", line 32, in _iter_encoded
for item in iterable:
File "/Users/jackkhuu/Desktop/oss/torchchat/torchchat/usages/server.py", line 77, in chunk_processor
for chunk in chunked_completion_generator:
File "/Users/jackkhuu/Desktop/oss/torchchat/torchchat/usages/openai_api.py", line 481, in chunked_completion
for y, _ in self.generate(
File "/Users/jackkhuu/Desktop/oss/torchchat/.venv/lib/python3.12/site-packages/torch/utils/_contextlib.py", line 36, in generator_context
response = gen.send(None)
^^^^^^^^^^^^^^
File "/Users/jackkhuu/Desktop/oss/torchchat/torchchat/generate.py", line 633, in generate
next_token = self.prefill(
^^^^^^^^^^^^^
File "/Users/jackkhuu/Desktop/oss/torchchat/torchchat/generate.py", line 373, in prefill
logits = model(tokens=x, mask=mask, encoder_input=encoder_input, input_pos=input_pos, encoder_mask=encoder_mask)[:, -1]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/jackkhuu/Desktop/oss/torchchat/.venv/lib/python3.12/site-packages/torch/nn/modules/module.py", line 1736, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/jackkhuu/Desktop/oss/torchchat/.venv/lib/python3.12/site-packages/torch/nn/modules/module.py", line 1747, in _call_impl
return forward_call(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/jackkhuu/Desktop/oss/torchchat/torchchat/model.py", line 560, in forward
return self.model(
^^^^^^^^^^^
File "/Users/jackkhuu/Desktop/oss/torchchat/.venv/lib/python3.12/site-packages/torch/nn/modules/module.py", line 1736, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/jackkhuu/Desktop/oss/torchchat/.venv/lib/python3.12/site-packages/torch/nn/modules/module.py", line 1747, in _call_impl
return forward_call(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/jackkhuu/Desktop/oss/torchchat/.venv/lib/python3.12/site-packages/torchtune/modules/model_fusion/_fusion.py", line 448, in forward
output = self.decoder(
^^^^^^^^^^^^^
File "/Users/jackkhuu/Desktop/oss/torchchat/.venv/lib/python3.12/site-packages/torch/nn/modules/module.py", line 1736, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/jackkhuu/Desktop/oss/torchchat/.venv/lib/python3.12/site-packages/torch/nn/modules/module.py", line 1747, in _call_impl
return forward_call(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/jackkhuu/Desktop/oss/torchchat/.venv/lib/python3.12/site-packages/torchtune/modules/transformer.py", line 599, in forward
h = layer(
^^^^^^
File "/Users/jackkhuu/Desktop/oss/torchchat/.venv/lib/python3.12/site-packages/torch/nn/modules/module.py", line 1736, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/jackkhuu/Desktop/oss/torchchat/.venv/lib/python3.12/site-packages/torch/nn/modules/module.py", line 1747, in _call_impl
return forward_call(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/jackkhuu/Desktop/oss/torchchat/.venv/lib/python3.12/site-packages/torchtune/modules/transformer.py", line 114, in forward
attn_out = self.attn(h, h, mask=mask, input_pos=input_pos)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/jackkhuu/Desktop/oss/torchchat/.venv/lib/python3.12/site-packages/torch/nn/modules/module.py", line 1736, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/jackkhuu/Desktop/oss/torchchat/.venv/lib/python3.12/site-packages/torch/nn/modules/module.py", line 1747, in _call_impl
return forward_call(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/jackkhuu/Desktop/oss/torchchat/.venv/lib/python3.12/site-packages/torchtune/modules/attention.py", line 297, in forward
output = self._attention_call(
^^^^^^^^^^^^^^^^^^^^^
File "/Users/jackkhuu/Desktop/oss/torchchat/.venv/lib/python3.12/site-packages/torchtune/modules/attention_utils.py", line 236, in _attention_call
return nn.functional.scaled_dot_product_attention(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: The size of tensor a (265) must match the size of tensor b (277) at non-singleton dimension 3
Versions
Collecting environment information... PyTorch version: 2.5.0.dev20240901+cu121 Is debug build: False CUDA used to build PyTorch: 12.1 ROCM used to build PyTorch: N/A
OS: CentOS Stream 9 (x86_64) GCC version: (GCC) 11.5.0 20240719 (Red Hat 11.5.0-2) Clang version: Could not collect CMake version: version 3.30.3 Libc version: glibc-2.34
Python version: 3.10.0 (default, Mar 3 2022, 09:58:08) [GCC 7.5.0] (64-bit runtime) Python platform: Linux-6.4.3-0_fbk12_hardened_2624_g7d95a0297d81-x86_64-with-glibc2.34 Is CUDA available: True CUDA runtime version: 12.2.140 CUDA_MODULE_LOADING set to: LAZY GPU models and configuration: GPU 0: NVIDIA PG509-210 Nvidia driver version: 550.90.07 cuDNN version: Probably one of the following: /usr/lib64/libcudnn.so.8.9.4 /usr/lib64/libcudnn_adv_infer.so.8.9.4 /usr/lib64/libcudnn_adv_train.so.8.9.4 /usr/lib64/libcudnn_cnn_infer.so.8.9.4 /usr/lib64/libcudnn_cnn_train.so.8.9.4 /usr/lib64/libcudnn_ops_infer.so.8.9.4 /usr/lib64/libcudnn_ops_train.so.8.9.4 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: 46 bits physical, 48 bits virtual Byte Order: Little Endian CPU(s): 22 On-line CPU(s) list: 0-21 Vendor ID: GenuineIntel Model name: Intel(R) Xeon(R) Platinum 8339HC CPU @ 1.80GHz CPU family: 6 Model: 85 Thread(s) per core: 1 Core(s) per socket: 22 Socket(s): 1 Stepping: 11 BogoMIPS: 3591.57 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 arch_perfmon rep_good nopl xtopology cpuid tsc_known_freq pni pclmulqdq vmx ssse3 fma cx16 pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch cpuid_fault invpcid_single ssbd ibrs ibpb stibp ibrs_enhanced tpr_shadow flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid mpx avx512f avx512dq rdseed adx smap clflushopt clwb avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves avx512_bf16 arat vnmi umip pku ospke avx512_vnni md_clear flush_l1d arch_capabilities Virtualization: VT-x Hypervisor vendor: KVM Virtualization type: full L1d cache: 704 KiB (22 instances) L1i cache: 704 KiB (22 instances) L2 cache: 88 MiB (22 instances) L3 cache: 16 MiB (1 instance) NUMA node(s): 1 NUMA node0 CPU(s): 0-21 Vulnerability Gather data sampling: Unknown: Dependent on hypervisor status Vulnerability Itlb multihit: Not affected Vulnerability L1tf: Not affected Vulnerability Mds: Not affected Vulnerability Meltdown: Not affected Vulnerability Mmio stale data: Vulnerable Vulnerability Retbleed: Vulnerable Vulnerability Spec store bypass: Vulnerable Vulnerability Spectre v1: Vulnerable: __user pointer sanitization and usercopy barriers only; no swapgs barriers Vulnerability Spectre v2: Vulnerable, IBPB: disabled, STIBP: disabled, PBRSB-eIBRS: Vulnerable Vulnerability Srbds: Not affected Vulnerability Tsx async abort: Mitigation; TSX disabled
Versions of relevant libraries: [pip3] numpy==1.26.4 [pip3] pytorch-triton==3.0.0+dedb7bdf33 [pip3] torch==2.5.0.dev20240901+cu121 [pip3] torchao==0.5.0 [pip3] torchtune==0.0.0 [pip3] torchvision==0.20.0.dev20240901+cu121 [conda] numpy 1.26.4 pypi_0 pypi [conda] pytorch-triton 3.0.0+dedb7bdf33 pypi_0 pypi [conda] torch 2.5.0.dev20240901+cu121 pypi_0 pypi [conda] torchao 0.5.0 pypi_0 pypi [conda] torchtune 0.0.0 pypi_0 pypi [conda] torchvision 0.20.0.dev20240901+cu121 pypi_0 pypi