text-generation-webui icon indicating copy to clipboard operation
text-generation-webui copied to clipboard

package with poetry to enable easy packaging for linux distribution

Open happysalada opened this issue 1 year ago • 4 comments

Description

Using poetry for packaging would make builds reproducible and create a lockfile. This would enable easy packaging for linux distros. Particularly, I came here wanting to package this for nixos. If you used poetry it would be relatively easy to do. If you are open to the idea, I would be happy to have a look at how to make the switch. It shouldn't be too hard.

Additional Context

If applicable, please provide any extra information, external links, or screenshots that could be useful.

happysalada avatar Apr 16 '23 22:04 happysalada

Isn't the docker-compose method perfectly reproducible?

Reezlaw avatar Apr 16 '23 23:04 Reezlaw

Package resolution with normal python is not deterministic. Depending on when you install the requirements you would have different versions of the subpackages. Poetry has a lock file that defines exactly which subpackages version it's using. To make sure that any two installs are exactly the same. Docker is just an abstraction on top of that, so if you build a docker image let's say 2 weeks from now, you'll probably get different sha256 for each layer because they will be different. When you make a package for a linux distro, you usually package the binary and not the docker image. If you want to make this package available to other linux distros with their package manager, having a distributable binary is a must. Last but not least, I wanted to propose poetry as it didn't seem to add any burden to the maintainers, if you feel it's too much work, no worries.

happysalada avatar Apr 17 '23 16:04 happysalada

Oh no, I'm just a random schmuck, I was genuinely asking. Maybe this is a great idea

Reezlaw avatar Apr 19 '23 22:04 Reezlaw

Not at all, clarifying is always good !

happysalada avatar Apr 19 '23 23:04 happysalada

This issue has been closed due to inactivity for 30 days. If you believe it is still relevant, please leave a comment below.

github-actions[bot] avatar May 19 '23 23:05 github-actions[bot]

i've produced a .tool-versions (used with rtx) and pyproject.toml which is working well for CPU only inference.

.tool-versions

python 3.10.6

pyproject.toml

[tool.poetry]
name = "text-generation-webui"
version = "0.1.0"
description = ""
authors = ["Your Name <[email protected]>"]
readme = "README.md"

[[tool.poetry.source]]
name = "pytorch-cpu"
url = "https://download.pytorch.org/whl/cpu"
priority = "explicit"

[tool.poetry.dependencies]
python = ">=3.10,<3.12"
accelerate = {git = "https://github.com/huggingface/accelerate", rev = "0226f750257b3bf2cadc4f189f9eef0c764a0467"}
llama-cpp-python = "0.1.53"
bitsandbytes = "0.39.0"
transformers = {git = "https://github.com/huggingface/transformers", rev = "e45e756d22206ca8fa9fb057c8c3d8fa79bf81c6"}
peft = {git = "https://github.com/huggingface/peft", rev = "3714aa2fff158fdfa637b2b65952580801d890b2"}
tqdm = "^4.65.0"
sentencepiece = "^0.1.99"
safetensors = "0.3.1"
rwkv = "0.7.3"
requests = "^2.30.0"
pyyaml = "^6.0"
pillow = ">=9.5.0"
pandas = "^2.0.1"
numpy = "^1.24.3"
markdown = "^3.4.3"
gradio = "3.31.0"
flexgen = "0.1.7"
datasets = "^2.12.0"
colorama = "^0.4.6"
einops = "^0.6.1"
gradio-client = "0.2.5"
scipy = "^1.10.1"
torch = {version = "^2.0.1", source = "pytorch-cpu"}
torchvision = {version = "^0.15.2", source = "pytorch-cpu"}
torchaudio = {version = "^2.0.2", source = "pytorch-cpu"}

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

to install dependencies in a venv and start the server:

pip install poetry

poetry install --sync

poetry run server.py --cpu

khimaros avatar May 31 '23 19:05 khimaros

Isn't the docker-compose method perfectly reproducible?

Docker adds in a layer of complexity in getting nvidia-container-toolkit to work for gpu accelleration for instance. Ask me how I know :stuck_out_tongue_winking_eye:

ParetoOptimalDev avatar Dec 15 '23 08:12 ParetoOptimalDev

the python ecosystem seems to be moving toward pip-tools instead of poetry. mixes well with rtx

khimaros avatar Dec 15 '23 14:12 khimaros

Isn't the docker-compose method perfectly reproducible?

Docker adds in a layer of complexity in getting nvidia-container-toolkit to work for gpu accelleration for instance. Ask me how I know 😜

Really? That was never a problem for me

Reezlaw avatar Dec 26 '23 14:12 Reezlaw