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

Add Python 3.10, 3.11, 3.12 compatibility #4041

Draft
wants to merge 32 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
c27d123
Removed torchtext from NGramTokenizer
Oct 25, 2024
8e90e70
Refactored SentencePieceTokenizer
Oct 26, 2024
92a3ec0
removed torchtext
Oct 28, 2024
01f308e
Rewrote tests
Oct 29, 2024
6011fb1
createda about file for hatch versioning and updated pyproject
ethanreidel Oct 30, 2024
fd6d146
moved to hatch build system in .toml file
ethanreidel Nov 1, 2024
7e2574f
added dockerfile for hatch
ethanreidel Nov 8, 2024
8e9d32d
Altered dependencies so it works for hatch env create
Nov 17, 2024
9c79935
Updated pytest workflows python versions
Nov 17, 2024
0a06171
Fixed minimal test python version
Nov 17, 2024
4256075
Fixed small error with versioning naming
Nov 17, 2024
a09ef95
Adding ludwig script to pyproject.toml
Nov 17, 2024
687c8ea
added tifffile to dependencies
Nov 17, 2024
123b678
Bumped Python Version for Minimal Test
Nov 17, 2024
da47379
fixed tifffile dep. and removed tests from pytest.yml
Nov 17, 2024
68fb836
Add combinatorial tests to pytest.yaml
Nov 17, 2024
6a896f9
Refined pyproject toml
Nov 19, 2024
8d0f0c4
Removed importlib from dependencies
Nov 19, 2024
5e48bef
Merge remote-tracking branch 'origin/remove_torchtext' into hatch_dev_mh
Nov 20, 2024
a926588
bump torch version to 2.4.1
Nov 20, 2024
5b288f2
fallback to eager for torch dynamo to prefent error
Nov 20, 2024
26fe135
added flake8 ignore line length error
Nov 20, 2024
551eb40
added pytest suit to jobs
Nov 20, 2024
e4161c6
Refactored Matrix Tests
Nov 20, 2024
01533ef
Remove Neuropod from tests.
Nov 20, 2024
b2a1454
Further removed torchtext
Nov 25, 2024
80dc452
try to fix openblas issue
Nov 25, 2024
f45d046
test pythran 0.9
Nov 26, 2024
802748c
fix version code
Nov 26, 2024
68566b8
second fix version code
Nov 26, 2024
a108bb5
pyhtran via pip
Nov 26, 2024
3607bd2
added prefer binary
Nov 26, 2024
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
316 changes: 124 additions & 192 deletions .github/workflows/pytest.yml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .github/workflows/pytest_slow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
python --version
pip --version
python -m pip install -U pip
pip install torch==2.1.0 torchtext torchvision torchaudio
pip install torch==2.1.0 torchvision torchaudio
pip install ray==2.3.1
pip install '.[test]'
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -140,3 +140,5 @@ examples/*/visualizations/

# benchmarking configs
ludwig/benchmarking/configs/
pytest.xml
ludwig.code-workspace
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ repos:
- id: pyupgrade
args: [--py36-plus]
- repo: https://github.com/PyCQA/docformatter
rev: v1.5.1
rev: 06907d0
hooks:
- id: docformatter
args: [--in-place, --wrap-summaries=115, --wrap-descriptions=120]
Expand Down
2 changes: 1 addition & 1 deletion docker/ludwig-ray-gpu/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ RUN pip install -U pip

WORKDIR /ludwig

RUN pip install --no-cache-dir torch==2.1.0 torchtext torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu118
RUN pip install --no-cache-dir torch==2.1.0 torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu118

COPY . .
RUN pip install --no-cache-dir '.[full]' --extra-index-url https://download.pytorch.org/whl/cu118
2 changes: 1 addition & 1 deletion docker/ludwig-ray/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ RUN pip install -U pip

WORKDIR /ludwig

RUN pip install --no-cache-dir torch==2.1.0 torchtext torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cpu
RUN pip install --no-cache-dir torch==2.1.0 torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cpu

COPY . .
RUN pip install --no-cache-dir '.[full]' --extra-index-url https://download.pytorch.org/whl/cpu
2 changes: 1 addition & 1 deletion docker/ludwig/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ RUN pip install -U pip

WORKDIR /ludwig

RUN pip install --no-cache-dir torch==2.0.0 torchtext torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cpu
RUN pip install --no-cache-dir torch==2.0.0 torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cpu

COPY . .
RUN pip install --no-cache-dir '.[full]'
Expand Down
17 changes: 17 additions & 0 deletions docker/ludwig_hatch/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM python:3.12

ENV PATH="/root/.local/bin:$PATH"
RUN apt-get -y update
RUN apt-get -y install pipx
RUN apt-get -y install git libsndfile1 build-essential g++ cmake ffmpeg sox libsox-dev
RUN pipx ensurepath --force
RUN pipx install hatch
RUN python3 -m pip install --upgrade pipx
WORKDIR /ludwig
#COPY /ludwig/ .
COPY . .

RUN hatch env create
RUN hatch build

ENTRYPOINT ["ludwig"]
1 change: 1 addition & 0 deletions ludwig/__about__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__version__ = '1.13.0'
2 changes: 1 addition & 1 deletion ludwig/decoders/llm_decoders.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# flake8: noqa: E501
import logging
import re
from typing import Any, Dict, List, Union
Expand Down Expand Up @@ -91,7 +92,6 @@ def __init__(
# Transformer Tokenizers
self.tokenizer_vocab_size = self.tokenizer.tokenizer.vocab_size
else:
# TorchText Tokenizers
self.tokenizer_vocab_size = len(self.tokenizer.vocab)

# Maximum number of new tokens that will be generated
Expand Down
5 changes: 5 additions & 0 deletions ludwig/schema/trainer.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# flake8: noqa: E501
import re
from abc import ABC
from typing import Optional, Type, Union

import torch
import torch._dynamo
from packaging.version import parse as parse_version

from ludwig.api_annotations import DeveloperAPI
Expand Down Expand Up @@ -33,6 +35,9 @@

_torch_200 = parse_version(torch.__version__) >= parse_version("2.0")

# this is a workarrpund to avoid an error regarding torch.compile.
# TODO Fix torch.compile and dynamo problems
torch._dynamo.config.suppress_errors = True

trainer_schema_registry = Registry()
_llm_trainer_schema_registry = Registry()
Expand Down
Loading
Loading