Skip to content

Commit ce6d7be

Browse files
youkaichaoNickLucche
authored andcommitted
[doc] explain common errors around torch.compile (vllm-project#12340)
Signed-off-by: youkaichao <[email protected]>
1 parent 46119ff commit ce6d7be

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

docs/source/getting_started/troubleshooting.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,27 @@ if __name__ == '__main__':
197197
llm = vllm.LLM(...)
198198
```
199199

200+
## `torch.compile` Error
201+
202+
vLLM heavily depends on `torch.compile` to optimize the model for better performance, which introduces the dependency on the `torch.compile` functionality and the `triton` library. By default, we use `torch.compile` to [optimize some functions](https://github.com/vllm-project/vllm/pull/10406) in the model. Before running vLLM, you can check if `torch.compile` is working as expected by running the following script:
203+
204+
```python
205+
import torch
206+
207+
@torch.compile
208+
def f(x):
209+
# a simple function to test torch.compile
210+
x = x + 1
211+
x = x * 2
212+
x = x.sin()
213+
return x
214+
215+
x = torch.randn(4, 4).cuda()
216+
print(f(x))
217+
```
218+
219+
If it raises errors from `torch/_inductor` directory, usually it means you have a custom `triton` library that is not compatible with the version of PyTorch you are using. See [this issue](https://github.com/vllm-project/vllm/issues/12219) for example.
220+
200221
## Known Issues
201222

202223
- In `v0.5.2`, `v0.5.3`, and `v0.5.3.post1`, there is a bug caused by [zmq](https://github.com/zeromq/pyzmq/issues/2000) , which can occasionally cause vLLM to hang depending on the machine configuration. The solution is to upgrade to the latest version of `vllm` to include the [fix](gh-pr:6759).

0 commit comments

Comments
 (0)