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

[sharktank] Test failures with torch>=2.4.0 #495

Closed
marbre opened this issue Nov 13, 2024 · 3 comments
Closed

[sharktank] Test failures with torch>=2.4.0 #495

marbre opened this issue Nov 13, 2024 · 3 comments

Comments

@marbre
Copy link
Collaborator

marbre commented Nov 13, 2024

Using Python 3.11.9, sharktank at HEAD fails when using a more recent torch version. In the CI, torch is pinned to 2.3.0:

https://github.com/nod-ai/SHARK-Platform/blob/903d3c1ac63c4e9b8a013a29eeca9a8ed7047e9f/.github/workflows/ci-sharktank.yml#L61
https://github.com/nod-ai/SHARK-Platform/blob/903d3c1ac63c4e9b8a013a29eeca9a8ed7047e9f/pytorch-cpu-requirements.txt#L3

When upgrading to a more recent version, the following tests fail:

torch==2.4.0 and torch==2.4.1

FAILED sharktank/tests/export_test.py::ExportTest::testExportWithArgumentDeviceAffinities - torch._dynamo.exc.UserError: Expecting args to be a tuple of example positional inputs, got <class 'list'>
FAILED sharktank/tests/layers/paged_llama_attention_block_test.py::PagedLlamaAttentionBlockTest::testExportNondecomposed - iree.compiler._mlir_libs._site_initialize..MLIRError: Verification failed:

torch==2.5.0 and torch==2.5.1

FAILED sharktank/tests/export_test.py::ExportTest::testExportWithArgumentDeviceAffinities - torch._dynamo.exc.UserError: Expecting args to be a tuple of example positional inputs, got <class 'list'>
FAILED sharktank/tests/layers/paged_llama_attention_block_test.py::PagedLlamaAttentionBlockTest::testExportNondecomposed - AssertionError: 'torch.aten._scaled_dot_product_flash_attention_for_cpu' not found in 'module @module {\n util.global private @__auto.constant_660_660_torch.float32 = dense_resource<__a...
FAILED sharktank/tests/layers/sharded_conv2d_with_iree_test.py::test_sharded_conv2d_with_iree - ValueError: Node type mismatch; expected <class 'tuple'>, but got <class 'list'>.
FAILED sharktank/tests/models/punet/sharded_resnet_block_with_iree_test.py::test_sharded_resnet_block_with_iree - ValueError: Node type mismatch; expected <class 'tuple'>, but got <class 'list'>.

@marbre
Copy link
Collaborator Author

marbre commented Nov 13, 2024

torch<=2.4 also blocks us from unpinning numpy (we're currently restricted to a version <2.0.0).

@ScottTodd
Copy link
Member

As needed, we can put branches in the code based on the pytorch version, or just warn/error if an incompatible version is installed.

Sample code: https://github.com/huggingface/transformers/blob/a9ccdfd8e3fbaf19ad6f174a99e8d39e706950b3/src/transformers/activations.py#L37-L43

class PytorchGELUTanh(nn.Module):
    def __init__(self):
        super().__init__()
        if version.parse(torch.__version__) < version.parse("1.12.0"):
            raise ImportError(
                f"You are using torch=={torch.__version__}, but torch>=1.12.0 is required to use "
                "PytorchGELUTanh. Please upgrade torch."
            )

@marbre
Copy link
Collaborator Author

marbre commented Dec 12, 2024

Filled #682, #683, #684, #685 instead and send #686 that marks tests xfail.

@marbre marbre closed this as completed Dec 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants