elastic / eland

Python Client and Toolkit for DataFrames, Big Data, Machine Learning and ETL in Elasticsearch
https://eland.readthedocs.io
Apache License 2.0
627 stars 98 forks source link

Upgrade torch to 2.1.2 #671

Closed davidkyle closed 3 months ago

davidkyle commented 4 months ago

Elasticsearch is upgraded to PyTorch v2.1.2 for v8.13.0, this change makes Eland use the same version

Due to potential backwards compatibility issues with models traced in PyTorch 2.1.2 running on earlier versions the eland_import_hub_model script will not upload models to a cluster that is earlier than Elasticsearch v8.13.0

The tests caught a problem tracing the valhalla/distilbart-mnli-12-6 model:

ValueError: Attention using SDPA can not be traced with torch.jit.trace when no attention_mask is provided. To solve this issue, please either load your model with the argument `attn_implementation="eager"` or pass an attention_mask input when tracing the model. 

The error comes from the decoder layer, in the transformers code the decoder attention mask is not initialised and appears to be added in this PR.

or pass an attention_mask input when tracing the model.

The error message is misleading as the input included attention_mask.

The change was added in transformers v4.36.0 released in December 2023. Rather than work around the problem by injecting the missing parameters the simplest solution is to pin the transformers version to 4.35.2.

Closes #669