optimize=True crashes on the first generate() when no C compiler is installed (fallback in optimize() never triggers)
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 74/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Domain
- backend, machine-learning
Research direction
Read src/voxcpm/model/voxcpm.py and src/voxcpm/model/voxcpm2.py, focusing on optimize() and its existing Triton check and eager fallback. The reproduction in the issue shows the failure on the first compiled function call when no C compiler is available. Confirm the fallback handles that environment and emits a warning; both model paths should run in eager mode without the compiler error.
Written by the indexing model from the issue text.
Description
What happens
With the default optimize=True, on a machine that has Triton but no C compiler (for example a pytorch/pytorch:2.9.1-cuda12.8-cudnn9-runtime based image), optimize() returns without any warning and the first generation fails:
torch._inductor.exc.InductorError: RuntimeError: Failed to find C compiler. Please specify via CC environment variable or set triton.knobs.build.impl.
With VoxCPM.from_pretrained(...) this happens during the warm-up generate() in __init__.
Why
optimize() in src/voxcpm/model/voxcpm.py and voxcpm2.py wraps torch.compile(...) in try/except and falls back to eager mode on error. torch.compile does not compile at that point, though; Triton builds its launcher (and looks for $CC / gcc / clang) on the first call of the compiled function, which is outside the try block, so the fallback never runs.
Reproduction (torch 2.9.1+cu128, triton 3.5.1, voxcpm 2.0.3, PATH without gcc/clang and no CC):
import types, torch, torch.nn as nn
from voxcpm.model.voxcpm2 import VoxCPM2Model
class Lm(nn.Module):
def __init__(self):
super().__init__(); self.l = nn.Linear(16, 16)
def forward_step(self, x):
return torch.relu(self.l(x))
m = types.SimpleNamespace(device="cuda", base_lm=Lm().cuda(), residual_lm=Lm().cuda(),
feat_encoder=nn.Linear(16, 16).cuda(),
feat_decoder=types.SimpleNamespace(estimator=nn.Linear(16, 16).cuda()))
VoxCPM2Model.optimize(m) # no warning printed
m.feat_encoder(torch.randn(4, 16, device="cuda"))
# InductorError: RuntimeError: Failed to find C compiler. ...
With gcc on PATH the same code runs. Workarounds today are installing a compiler or passing optimize=False; neither is mentioned in the FAQ's torch.compile section.
Suggested fix
Check for a compiler next to the existing import triton check in optimize(), so the existing fallback path prints a warning and runs eager. I have a small PR ready for this.
Environment: Linux, Python 3.11, torch 2.9.1+cu128, triton 3.5.1, voxcpm 2.0.3 (the optimize() code is the same on main).
This report was drafted with AI assistance and reviewed by me.
- Dominant language
- Python
- Stars
- 39.8k
- Forks
- 4.5k
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from OpenBMB/VoxCPM
-
[BUG] LoRA WebUI 的 seed 没有传入 `generate()`,导致推理结果无法可靠复现Possibly taken @Arthur031221 claimed this 24 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
fix: Incorrect type annotations — use Optional[T] instead of T for nullable defaultsPossibly taken @kuishou68 claimed this 146 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 5/5 Over a week Newbie friendliness 18/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 48/100
-
Difficulty 1/5 1-3 hours Newbie friendliness 25/100
Similar issues
-
Project submission:Open
Difficulty 1/5 Under an hour Newbie friendliness 72/100
slavakurilyak/awesome-ai-agents#845 ·
Maintainers usually reply within 1 day
-
tests: pin that the atomic writers in utils/paths.py stage the temporary file in the target's directoryPossibly taken A pull request linked to this issue is open or already merged. Opendifficulty:2 enhancement good first issue
Difficulty 1/5 1-3 hours Newbie friendliness 92/100
MakazhanAlpamys/Soup#2178 ·
Maintainers usually reply within 1 day
-
[BUG] dcg.waggr permutation p-values are folded twice, so near-zero scores get the smallest p-valuesOpen
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
scverse/rapids-singlecell#854 ·
Maintainers usually reply within 1 day
-
Slang input: int8_t4_packed and uint8_t4_packed are copied into CrossGLPossibly taken @ninglinLiu claimed this today. Openarea:frontend backend:slang bug direction:input
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Maintainers usually reply within 1 day
-
random_elements(unique=True) on an OrderedDict: ZeroDivisionError once only zero weights remain, AssertionError with use_weighting=FalsePossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Maintainers usually reply within 13 days