Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warn users when using un-validated torch version #1088

Open
stbaione opened this issue Mar 14, 2025 · 1 comment
Open

Warn users when using un-validated torch version #1088

stbaione opened this issue Mar 14, 2025 · 1 comment
Labels
enhancement New feature or request

Comments

@stbaione
Copy link
Contributor

There was a recent discord discussion, where a user was hitting a compiler error when attempting to follow the llama_serving docs.

The issue was root caused to the use of torch>=2.6.0.

Two improvements we could make out of this:

  • Improve llama_serving doc wording to make it clear that you might run into issues with non-validated torch versions
  • Provide a warning to user when using a non-validated torch version (recommended by user who hit the bug)

Llama_serving doc

We do specify torch>=2.3.0,<2.6.0 in the Install Python Packages, but that's prefixed by:

so install a torch version that fulfills your needs by following either https://pytorch.org/get-started/locally/ or our recommendation:

We may want to reword this to make it less optional what torch version they use. Maybe we should have a supported torch table and say something along the lines of:

We recommended that you use one of the torch versions listed above. You can use your own version, but may run into undefined behavior.

We may not even need a table, just somewhere where they can easily view the validated versions.

Torch Warning

We should provide users with a warning message, when they use non-validated versions of torch. Something along the lines of:

WARNING: You are using an unvalidated version of `torch` and may run into undefined behavior. For validated versions, see <link_to_validated_versions>

There were warnings thrown in the export script, after upgrading to torch >= 2.6.0:

/home/stbaione/repos/temp/.venv/lib/python3.11/site-packages/torch/export/_unlift.py:75: UserWarning: Attempted to insert a get_attr Node with no underlying reference in the owning GraphModule! Call GraphModule.add_submodule to add the necessary submodule, GraphModule.add_parameter to add the necessary Parameter, or nn.Module.register_buffer to add the necessary buffer
  getattr_node = gm.graph.get_attr(lifted_node)
/home/stbaione/repos/temp/.venv/lib/python3.11/site-packages/torch/fx/graph.py:1801: UserWarning: Node root_token_embedding_lifted_tensor_0 target root.token_embedding.lifted_tensor_0 lifted_tensor_0 of root.token_embedding does not reference an nn.Module, nn.Parameter, or buffer, which is what 'get_attr' Nodes typically target

Which then lead to errors in the compiler:

/home/stbaione/repos/temp/export/model.mlir:1020:12: error: failed to legalize operation 'torch.aten.outer'
    %347 = torch.aten.outer %338, %346 : !torch.vtensor<[131072],si64>, !torch.vtensor<[128],f32> -> !torch.vtensor<[131072,128],f32>
           ^

But, it probably would have made the troubleshooting process faster (and potentially given the user enough info to fix on their own), if there was a clear warning.

@stbaione stbaione added the enhancement New feature or request label Mar 14, 2025
@ScottTodd
Copy link
Member

In this case I would rather we support the latest stable torch version. Pinning to old versions was an emergency fix following the torch update that started blocking developer CI that we can't carry forward forever.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants