-
Notifications
You must be signed in to change notification settings - Fork 36
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 project config via uv while keeping backward compatibility with pip install method #51
Conversation
@FurkanGozukara You can always contribute README sections about how to configure the GUI for best results, etc, etc. If everyone contribute a little something then the progress goes faster. For example, validating that the instructions on how to install the app up to the point where you can run |
I have added a super basic GUI consisting of the accelerate launch parameters and one feild to type the custom parameters... but this will allow you to train ;-) Now that this work, I can focus on the config load and save part so the user inputs can be saved to a config file When that is done, I will start to add individual feilds for the cli options. |
OK, you can now save and load config to toml file. This also allow to start the GUI with a specific toml config file and get all the feilds populated with the values. This should also allow me to run the cli by feeding it the toml with the saved values and everything should run. @kohya-ss is the syntax to pass parameters as toml the same as sd-scripts? |
Thank you for your continuous efforts. I have a few questions. First, it's a PyTorch and CUDA version issue. I think we need to stick sometimes to CUDA <12.4 or 11.x in some environments. Similarly, we may want to change the version of PyTorch (because tuner will work with 2.4.x, and for example, when cloud environment comes with 2.4 pre-installed). How can we address this issue with uv and pyproject.toml? Also, I would like to make this project compatible with Python 3.9 to 3.12 if possible. Is that possible with uv? |
@kohya-ss I tried to pass a toml with the config and it gives an error:
I am calling it with:
And my toml file contain:
Not sure what I am doing wrong ;-( |
@bmaltais Sorry, there was a bug in argument definitions. I fixed it, so it should work now. |
@kohya-ss This fixed the issue. Also, please review this pull request to consider merging the pyproject.toml and other related changes to enable the GUI to use your repo as a module and to enable the use of |
@bmaltais I got it. I will review this ASAP. Assuming that the issues with PyTorch and CUDA with uv will be resolved in the future, will there be any problems with the current pip installation even if this is merged? |
The current pip based method still work as it used to. The uv method is "seperate". It actually should work fine with torch also. I added specific sources that make it work with literally no installation beside uv ;-) It will take cake of installing the right release of python, install all the modules and run stuff. Literally no effort. And super quick. Give it a try.
|
@bmaltais |
Uv can be told to support various releases of python. Specific module version for python versions can also be configured in the project.toml |
@bmaltais Maybe I need to do like this: |
I don’t know enough about uv.lock to know if it should be frozen or not… I notice it will get updated sometime. Especially on 1st run and possibly on module updates upstream. |
If the file is updated in the user's side, the next |
@kohya-ss Indeed, it probably need to be ignored and removed from the repo and dynamically calculated by uv when it run on each users machine. I don't think we need to provide it along with the pyproject.toml... I could remove it and add a gitignore entry for it... Done. I think I need to read a bit more about the uv.lock file and why it is being updated... Apparently the --frozen prevent update... but it also mean users could potentially (and will) to type it when executing... so perhaps it might be best to ignore it for now until a solution can be found... |
@bmaltais Thanks for the update. For now, it might be a good idea to merge this into main as an experimental feature, and to say that we're investigating the right way to configure uv and would welcome community feedback. |
@kohya-ss Indeed. I agree. |
I was on a business trip over the weekend and just saw this. As an early user of UV, I recommend using uv pip compile and uv sync to maintain backward compatibility of PIP. https://docs.astral.sh/uv/reference/cli/#uv-pip-compile uv-pip-compile can compile a complete synchronization dependency environment based on requirements.txt and project.toml. https://docs.astral.sh/uv/reference/cli/#uv-sync uv-sync syncing ensures that all project dependencies are installed and up-to-date with the lockfile. We only need to compile additional GUI using requirements, and then quickly synchronize venv before running |
This is the script installation logic I wrote myself. First, I use uv pip compile locally to compile the requirements-uv.txt that is locked in the current environment. Then use uv pip sync
|
As I started work on the GUI I need to be able to properly use the tuner code as a python module. For this purpose I am proposing to add support to uv as the python environment and module management solution.
It will also retain backward compatibility with the manual way of installing the requirements.
If you want to try uv instead, just install uv as per then installation instructions as found in the README.md and then simply use the
uv run ...
version of the commands. It will install the required python version, create the .venv and install all required modules on 1st run.