Skip to content

Commit 4875f53

Browse files
committed
Use uv with pyproject.toml file to lock version used.
It can avoid issue when there are package updates and guarantee everyone will have the same package versions (too many issue happen with requirements files) "uv lock --upgrade" can be used to upgrade the dependencies Easy usage to install package for all cases: - uv sync --extra cpu - uv sync --extra cuda - uv sync --extra cuda-rtx50 - uv sync --extra rocm
1 parent 9337108 commit 4875f53

13 files changed

+2822
-72
lines changed

README.md

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,6 @@ git clone --branch v0.5.0 https://github.com/ack00gar/FunGen-AI-Powered-Funscrip
4444
cd FunGenBeta
4545
```
4646

47-
### Install the core python requirements
48-
```bash
49-
pip install -r core.requirements.txt
50-
```
5147
- If you have the original FunGen installed, skip to [Download the YOLO model](#download-the-yolo-model)
5248

5349
### NVIDIA GPU Setup (CUDA Required)
@@ -61,14 +57,12 @@ pip install -r core.requirements.txt
6157

6258
**For 20xx, 30xx and 40xx-series NVIDIA GPUs:**
6359
```bash
64-
pip install -r cuda.requirements.txt
65-
pip install tensorrt
60+
uv sync --extra cuda
6661
```
6762

6863
**For 50xx series NVIDIA GPUs (RTX 5070, 5080, 5090):**
6964
```bash
70-
pip install -r cuda.50series.requirements.txt
71-
pip install tensorrt
65+
uv sync --extra cuda-rtx50
7266
```
7367

7468
**Note:** NVIDIA 10xx series GPUs are not supported.
@@ -82,12 +76,12 @@ python -c "import torch; print(torch.cuda.is_available())" # Check PyTorch CUDA
8276

8377
### If your GPU doesn't support cuda
8478
```bash
85-
pip install -r cpu.requirements.txt
79+
uv sync --extra cpu
8680
```
8781

8882
### If your GPU supports ROCm (AMD Linux Only)
8983
```bash
90-
pip install -r rocm.requirements.txt
84+
uv sync --extra rocm
9185
```
9286

9387
## Download the YOLO model
@@ -98,7 +92,7 @@ Download from https://docs.ultralytics.com/tasks/pose/ and place in the `models/
9892

9993
### Start the app
10094
```bash
101-
python3 main.py
95+
uv run main.py
10296
```
10397

10498
We support multiple model formats across Windows, macOS, and Linux.

core.requirements.txt

Lines changed: 0 additions & 16 deletions
This file was deleted.

cpu.requirements.txt

Lines changed: 0 additions & 2 deletions
This file was deleted.

cuda.50series.requirements.txt

Lines changed: 0 additions & 6 deletions
This file was deleted.

cuda.requirements.txt

Lines changed: 0 additions & 6 deletions
This file was deleted.

environment.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ channels:
55
dependencies:
66
- python=3.12
77
- pip
8+
- uv
89
- ffmpeg # This will install ffmpeg and ffprobe from conda-forge
910
# - other_conda_package
1011
- pip:

install.bat

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,10 @@ if errorlevel 1 (
119119
pause
120120
exit /b 1
121121
)
122-
echo Installing dependencies from requirements.txt if it exists...
122+
echo Installing dependencies if it exists...
123123
call %CONDA_ACTIVATE_SCRIPT% %ENV_NAME%
124-
if exist "requirements.txt" (
125-
pip install -r requirements.txt
126-
)
124+
pip install uv
125+
uv sync
127126
echo NOTE: FFmpeg might not be installed if environment.yml was not used.
128127
echo Consider adding ffmpeg to your requirements or creating an environment.yml.
129128
call %CONDA_ACTIVATE_SCRIPT% %ENV_NAME% && conda install -c conda-forge ffmpeg -y

install_linux.sh

100644100755
Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,8 @@ if ! "$CONDA_EXE" env list | grep -q "^$ENV_NAME\s"; then
106106
fi
107107
echo "Activating environment to install requirements..."
108108
source "$CONDA_ACTIVATE_SCRIPT" "$ENV_NAME"
109-
if [ -f "requirements.txt" ]; then
110-
echo "Installing dependencies from requirements.txt..."
111-
pip install -r requirements.txt
112-
fi
109+
pip install uv
110+
uv sync
113111
echo "Attempting to install FFmpeg via Conda..."
114112
conda install -c conda-forge ffmpeg -y
115113
conda deactivate

install_mac.sh

100644100755
Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,10 @@ if ! "$CONDA_EXE" env list | grep -q "^$ENV_NAME\s"; then
108108
echo "Failed to create Conda environment."
109109
exit 1
110110
fi
111-
echo "Activating environment to install requirements..."
111+
echo "Activating environment to install dependencies..."
112112
source "$CONDA_ACTIVATE_SCRIPT" "$ENV_NAME"
113-
if [ -f "requirements.txt" ]; then
114-
echo "Installing dependencies from requirements.txt..."
115-
pip install -r requirements.txt
116-
fi
113+
pip install uv
114+
uv sync
117115
echo "Attempting to install FFmpeg via Conda..."
118116
conda install -c conda-forge ffmpeg -y
119117
conda deactivate

pyproject.toml

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
[project]
2+
name = "fungen-ai-powered-funscript-generator"
3+
version = "0.1.0"
4+
description = ""
5+
authors = [
6+
]
7+
requires-python = ">=3.10.0"
8+
dependencies = [
9+
"numpy>=2.1.1,<3",
10+
"ultralytics>=8.3.78,<9",
11+
"glfw>=2.8.0,<3",
12+
"pyopengl>=3.1.7,<4",
13+
"tqdm>=4.67.1,<5",
14+
"opencv-python>=4.10.0.84,<5",
15+
"scipy>=1.15.1,<2",
16+
"simplification>=0.7.13,<8",
17+
"msgpack>=1.1.0,<2",
18+
"orjson>=3.10.15,<4",
19+
"imgui>=2.0.0",
20+
"scenedetect[opencv]>=0.6.6",
21+
"rdp>=0.8",
22+
"send2trash>=1.8.3",
23+
"aiosqlite>=0.21.0",
24+
"sympy>=1.13.1",
25+
]
26+
27+
[project.optional-dependencies]
28+
cpu = [
29+
"torch>=2.8,<2.9",
30+
"torchvision>=0.20.1",
31+
]
32+
cuda = [
33+
"torch>=2.8,<2.9",
34+
"torchvision>=0.20.1",
35+
"tensorrt",
36+
]
37+
cuda-rtx50 = [
38+
"torch>=2.8,<2.9",
39+
"torchvision>=0.22.1",
40+
"tensorrt",
41+
]
42+
rocm = [
43+
"torch>=2.8,<2.9",
44+
"torchvision>=0.20.1",
45+
"pytorch-triton-rocm",
46+
]
47+
48+
[tool.uv]
49+
conflicts = [
50+
[
51+
{ extra = "cpu" },
52+
{ extra = "cuda" },
53+
{ extra = "cuda-rtx50" },
54+
{ extra = "rocm" },
55+
],
56+
]
57+
58+
[tool.uv.sources]
59+
torch = [
60+
{ index = "pytorch-cpu", extra = "cpu" },
61+
{ index = "pytorch-cuda", extra = "cuda" },
62+
{ index = "pytorch-cuda-rtx50", extra = "cuda-rtx50" },
63+
{ index = "pytorch-rocm", extra = "rocm" },
64+
]
65+
torchvision = [
66+
{ index = "pytorch-cpu", extra = "cpu" },
67+
{ index = "pytorch-cuda", extra = "cuda" },
68+
{ index = "pytorch-cuda-rtx50", extra = "cuda-rtx50" },
69+
{ index = "pytorch-rocm", extra = "rocm" },
70+
]
71+
pytorch-triton-rocm = [
72+
{ index = "pytorch-rocm", extra = "rocm" },
73+
]
74+
75+
[[tool.uv.index]]
76+
name = "pytorch-cpu"
77+
url = "https://download.pytorch.org/whl/cpu"
78+
explicit = true
79+
80+
[[tool.uv.index]]
81+
name = "pytorch-cuda"
82+
url = "https://download.pytorch.org/whl/cu128"
83+
explicit = true
84+
85+
[[tool.uv.index]]
86+
name = "pytorch-cuda-rtx50"
87+
url = "https://download.pytorch.org/whl/cu129"
88+
explicit = true
89+
90+
[[tool.uv.index]]
91+
name = "pytorch-rocm"
92+
url = "https://download.pytorch.org/whl/rocm6.4"
93+
explicit = true
94+

0 commit comments

Comments
 (0)