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

Conversation

anthonywu
Copy link
Collaborator

@anthonywu anthonywu commented Nov 7, 2024

This moves forward Issue #74. For devs or early adopters who want to use Python 3.13 to install mflux from repo, this unblocks.

test

$ uv tool install --python 3.13 git+https://github.com/anthonywu/mflux.git@py13-dev-working
 Updated https://github.com/anthonywu/mflux.git (391d29f)
Resolved 29 packages in 79ms
   Built mflux @ git+https://github.com/anthonywu/mflux.git@391d29fe4fc06b89d7caf690d37a47a2fc17b08e
Prepared 1 package in 819ms
Installed 1 package in 3ms
 + mflux==0.4.1 (from git+https://github.com/anthonywu/mflux.git@391d29fe4fc06b89d7caf690d37a47a2fc17b08e)
Installed 3 executables: mflux-generate, mflux-generate-controlnet, mflux-save

Copy link
Collaborator Author

@anthonywu anthonywu left a comment

Choose a reason for hiding this comment

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

if you really have to early adopt (I do), here is the transitional unblocker until we can safely get rid of the python_version markers.

pyproject.toml Show resolved Hide resolved
pyproject.toml Show resolved Hide resolved
"safetensors>=0.4.4,<1.0",
"sentencepiece>=0.2.0,<1.0",
"torch>=2.3.1,<3.0",
"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

@anthonywu
Copy link
Collaborator Author

anthonywu commented Nov 8, 2024

I had celebrated too soon, the blocker on sentencepiece is still there. I'm going to try to solve it creatively, stay tuned.

this is where the ImportError trips:

# src/mflux/flux/flux.py
tokenizers = TokenizerHandler(model_config.model_name, self.model_config.max_sequence_length, local_path)

@@ -55,6 +55,16 @@ 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>
```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.

@filipstrand
Copy link
Owner

Thanks for taking the time to address this. I have not moved to 3.13 personally yet, but great that you had the need :).
I followed your instructions in the README, plus installing your 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

and after that it ran fine for me! Should this part also be added to the README installation instructions for Python 3.13 dev, or should it only be kept as a comment for now?

In terms of the state of this PR, would you say that it is ready to be merged or are we waiting on other things to be updated/resolved first (like the official sentencepiece build etc) and just keeping this PR open for anyone interested in the meantime?

@anthonywu
Copy link
Collaborator Author

anthonywu commented Nov 9, 2024

and after that it ran fine for me!

🏆

Should this part also be added to the README installation instructions for Python 3.13 dev

added as README snippet in that detail section

in terms of the state of this PR, would you say that it is ready to be merged

I think it's ready to be merged if you feel good about this - my goal is to deflect support issues preemptively. Anytime the upstream libraries are updated we can delete the section. BTW something like this will be relevant every time we transition to a new Python version, can bring the snippet back every year or so.

@filipstrand
Copy link
Owner

Great! I'll go ahead and merge this

@filipstrand filipstrand merged commit f781440 into filipstrand:main Nov 9, 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

Successfully merging this pull request may close these issues.

2 participants