Repository navigation
Fix docker, cmake and imports after torch export support - #358
Conversation
Greptile SummaryThis PR fixes Docker build infrastructure, CMake library paths, and Python import guards to support HSTU Torch export in inference/Triton-server environments. The most notable change is that
Confidence Score: 5/5Safe to merge; all remaining findings are P2 style/cleanup suggestions that do not block correctness. The functional changes (unconditional Megatron-LM install, HSTU_INFERENCE_ONLY guard, pynve torch bindings, json include path) are straightforward and align with the PR intent. The two open comments are both P2: a dead ARG and a note about the inverted build condition semantics. Neither causes a runtime error in the changed paths. docker/Dockerfile — stale INFERENCEBUILD ARG and inverted build-condition semantics worth a second look. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[docker build] --> B{TRITONSERVER_BUILD=1?}
B -- Yes --> C[Install minimal Python pkgs\ncmake, patchelf\ntorch from pytorch.org]
B -- No --> D[Install Megatron-LM\nalways installed now]
C --> D
D --> E[pip install torchx, torchmetrics,\ntriton, fbgemm, torchrec, etc.]
E --> F{TRITONSERVER_BUILD=1?}
F -- Yes --> G[Skip libcuda symlink\nSkip dynamicemb build]
F -- No --> H[Replace libcuda.so.1 symlink\nBuild dynamicemb torch_binding]
G --> I[Image ready]
H --> I
subgraph Runtime: Triton Server
J[launch_triton_server.sh] --> K[HSTU_INFERENCE_ONLY=1 tritonserver start]
K --> L{os.getenv HSTU_INFERENCE_ONLY}
L -- 1 --> M[HSTUBlock = None, skip training imports]
L -- 0 --> N[from modules.hstu_block import HSTUBlock]
end
Reviews (2): Last reviewed commit: "Fix upon reviews" | Re-trigger Greptile |
There was a problem hiding this comment.
Pull request overview
This PR updates the HSTU inference/export tooling and container build so Torch export + TritonServer execution work without import/path issues.
Changes:
- Add an inference-only mode (
HSTU_INFERENCE_ONLY) to avoid importing export-only components at runtime and propagate it into Triton launch. - Adjust CMake configuration for the HSTU C++ inference example (include paths + library lookup paths).
- Update Docker builds to ensure Megatron-LM is installed and adjust build conditionals for TritonServer-related images.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| examples/hstu/modules/inference_dense_module.py | Conditional import/stub of HSTUBlock based on HSTU_INFERENCE_ONLY. |
| examples/hstu/inference/launch_triton_server.sh | Sets HSTU_INFERENCE_ONLY=1 when launching tritonserver. |
| examples/hstu/inference/cpp_inference/CMakeLists.txt | Updates library search paths and adds a JSON include dir. |
| docker/Dockerfile.nve | Sets build env vars for pip install (Torch bindings, AVX512 disable). |
| docker/Dockerfile | Always installs Megatron-LM; refactors build steps gated by TRITONSERVER_BUILD. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Fix docker file for HSTU Torch export support
Fix inc & lib path for HSTU C++ inference example
Fix (indirect) import (of Megatron) for TritonServer tests