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

Upgrade PyTorch to version 2.3.1 #718

Merged
merged 6 commits into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions eland/cli/eland_import_hub_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ def check_cluster_version(es_client, logger):
sem_ver = parse_es_version(es_info["version"]["number"])
major_version = sem_ver[0]
minor_version = sem_ver[1]
patch_version = sem_ver[2]
davidkyle marked this conversation as resolved.
Show resolved Hide resolved

# NLP models added in 8
if major_version < 8:
Expand All @@ -238,13 +239,13 @@ def check_cluster_version(es_client, logger):
)
exit(1)

# PyTorch was upgraded to version 2.1.2 in 8.13
# PyTorch was upgraded to version 2.3.1 in 8.15.1
# and is incompatible with earlier versions
if major_version == 8 and minor_version < 13:
if major_version == 8 and minor_version < 15 and patch_version < 1:
davidkyle marked this conversation as resolved.
Show resolved Hide resolved
import torch

logger.error(
f"Eland uses PyTorch version {torch.__version__} which is incompatible with Elasticsearch versions prior to 8.13. Please upgrade Elasticsearch to at least version 8.13"
f"Eland uses PyTorch version {torch.__version__} which is incompatible with Elasticsearch versions prior to 8.15.1. Please upgrade Elasticsearch to at least version 8.15.1"
)
exit(1)

Expand Down
2 changes: 1 addition & 1 deletion noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def test(session, pandas_version: str):
"--nbval",
)

# PyTorch 2.1.2 doesn't support Python 3.12
# PyTorch 2.3.1 doesn't support Python 3.12
if session.python == "3.12":
pytest_args += ("--ignore=eland/ml/pytorch",)
session.run(
Expand Down
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@
"lightgbm": ["lightgbm>=2,<4"],
"pytorch": [
"requests<3",
"torch==2.1.2",
"torch==2.3.1",
"tqdm",
"sentence-transformers>=2.1.0,<=2.3.1",
"transformers[torch]>=4.31.0,<4.36.0",
"sentence-transformers>=2.1.0,<=2.7.0",
"transformers[torch]>=4.31.0,<4.44.0",
],
}
extras["all"] = list({dep for deps in extras.values() for dep in deps})
Expand Down
5 changes: 2 additions & 3 deletions tests/ml/pytorch/test_pytorch_model_config_pytest.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@

pytestmark = [
pytest.mark.skipif(
ES_VERSION < (8, 13, 0),
reason="Eland uses Pytorch 2.1.2, versions of Elasticsearch prior to 8.13.0 are incompatible with PyTorch 2.1.2",
ES_VERSION < (8, 15, 1),
reason="Eland uses Pytorch 2.3.1, versions of Elasticsearch prior to 8.15.1 are incompatible with PyTorch 2.3.1",
),
pytest.mark.skipif(
not HAS_SKLEARN, reason="This test requires 'scikit-learn' package to run"
Expand Down Expand Up @@ -163,7 +163,6 @@


class TestModelConfguration:
@pytest.mark.skip(reason="https://github.com/elastic/eland/issues/633")
@pytest.mark.parametrize(
"model_id,task_type,config_type,tokenizer_type,max_sequence_len,embedding_size",
MODEL_CONFIGURATIONS,
Expand Down
4 changes: 2 additions & 2 deletions tests/ml/pytorch/test_pytorch_model_upload_pytest.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@

pytestmark = [
pytest.mark.skipif(
ES_VERSION < (8, 13, 0),
reason="Eland uses Pytorch 2.1.2, versions of Elasticsearch prior to 8.13.0 are incompatible with PyTorch 2.1.2",
ES_VERSION < (8, 15, 1),
reason="Eland uses Pytorch 2.3.1, versions of Elasticsearch prior to 8.15.1 are incompatible with PyTorch 2.3.1",
),
pytest.mark.skipif(
not HAS_SKLEARN, reason="This test requires 'scikit-learn' package to run"
Expand Down