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

Issue #74 - python 3.13 pip install now working #90

Merged
merged 3 commits into from
Nov 9, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,24 @@ uv tool install --upgrade mflux

to get the `mflux-generate` and related command line executables. You can skip to the usage guides below.

<details>
<summary>For Python 3.13 dev preview</summary>

The [T5 encoder](https://huggingface.co/docs/transformers/en/model_doc/t5) is dependent on [sentencepiece](https://pypi.org/project/sentencepiece/), which does not have a installable wheel artifact for Python 3.13 as of Nov 2024. Until Google [publishes a 3.13 wheel](https://pypi.org/project/sentencepiece/), you need to build your own wheel with [official build instructions](https://github.com/google/sentencepiece/blob/master/python/README.md#build-and-install-sentencepiece) or for your convenience use a `.whl` pre-built by contributor @anthonywu. The steps below should work for most developers though your system may vary.

```sh
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Think we need a new line here for the block to properly render.

uv venv --python 3.13
python -V # e.g. Python 3.13.0rc2
source .venv/bin/activate

# for your convenience, you can use the contributor wheel
uv pip install https://github.com/anthonywu/sentencepiece/releases/download/0.2.1-py13dev/sentencepiece-0.2.1-cp313-cp313-macosx_11_0_arm64.whl

# enable the pytorch nightly
uv pip install --pre --extra-index-url https://download.pytorch.org/whl/nightly -e .
```
</details>

<details>
<summary>For the classic way to create a user virtual environment:</summary>

Expand Down
15 changes: 11 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,21 @@ license = { file = "LICENSE" }
requires-python = ">=3.10"
dependencies = [
"huggingface-hub>=0.24.5,<1.0",
"mlx>=0.16.0,<1.0",
"mlx>=0.20.0,<1.0",
filipstrand marked this conversation as resolved.
Show resolved Hide resolved
"numpy>=2.0.1,<3.0",
"opencv-python>=4.10.0,<5.0",
"piexif>=1.1.3,<2.0",
"pillow>=10.4.0,<11.0",
"pillow>=10.4.0,<11.0; python_version<'3.13'",
"pillow>=11.0,<12.0; python_version>='3.13'",
filipstrand marked this conversation as resolved.
Show resolved Hide resolved
"safetensors>=0.4.4,<1.0",
"sentencepiece>=0.2.0,<1.0",
"torch>=2.3.1,<3.0",
# python 3.13 workaround for now:
# use temporary community build of py13 wheel, use until official project build
# uv pip install https://github.com/anthonywu/sentencepiece/releases/download/0.2.1-py13dev/sentencepiece-0.2.1-cp313-cp313-macosx_11_0_arm64.whl
"sentencepiece>=0.2.0,<1.0; python_version<'3.13'",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sentencepiece: this did not receive an upgrade, but I notice tokenizers in newer builds got rid of the dep, so only older Pythons will continue to need this. Well, maybe when tokenizers can strictly be >= 0.20.3 we can just remove it.

"tokenizers>=0.20.3; python_version>='3.13'", # transformers -> tokenizers
"torch>=2.3.1,<3.0; python_version<'3.13'",
# torch dev builds: pip install --pre --index-url https://download.pytorch.org/whl/nightly
"torch>=2.6.0.dev20241106; python_version>='3.13'",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💥 solved for devs

"tqdm>=4.66.5,<5.0",
"transformers>=4.44.0,<5.0",
]
Expand Down