self-contained torch wheel
Bundles the known-working ROCm torch, triton-rocm, and torchvision wheels
locally so install no longer depends on the PyTorch nightly index being
available. Also fixes model name mismatches between docs and code, and
adds missing dependencies.
What:
• wheels/ — bundled torch 2.11.0+rocm7.2, triton-rocm 3.6.0, and
torchvision 0.26.0+rocm7.2 (wheels/ is in .gitignore; they are
downloaded once and reused)
• README install section — replaced 'pip install torch --index-url ...'
with 'pip install wheels/*.whl' for all three ROCm wheels; added
download instructions for the initial fetch
• README Current State — marked self-contained torch wheel as done,
removed from Future Improvements
• Fixed model name defaults across README examples and session.py
docstring — they used shortened filenames (novaAnimeXL.safetensors,
qwen_image_edit.safetensors) that don't match the actual symlinks
created by the Models section
• pyproject.toml — added torchvision and realesrgan (previously
undeclared; upscale.py imported torchvision.transforms at module
level without the dependency being declared)
Why:
The ROCm nightly index is volatile — versions rotate frequently and the
index itself may not be reachable. Bundling the three ROCm-only wheels
(torch, triton-rocm, torchvision) makes the install reproducible. All
other dependencies resolve from standard PyPI.
Verified by creating a clean Python 3.12 venv, installing all three
wheels from the local files, running 'pip install -e .', and confirming
'vnasset --help' and GPU tensor allocation work without any remote
ROCm index access.
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -6,3 +6,4 @@ models/
|
||||
dist/
|
||||
build/
|
||||
output/
|
||||
wheels/
|
||||
|
||||
33
README.md
33
README.md
@@ -26,13 +26,25 @@ cd vnassets
|
||||
python3.12 -m venv .venv
|
||||
source .venv/bin/activate
|
||||
|
||||
# Install ROCm PyTorch (adjust index URL for your ROCm version)
|
||||
pip install torch --index-url https://download.pytorch.org/whl/rocm7.2
|
||||
# Install ROCm PyTorch from local wheels (no remote index dependency)
|
||||
pip install wheels/torch-2.11.0+rocm7.2-cp312-cp312-manylinux_2_28_x86_64.whl \
|
||||
wheels/triton_rocm-3.6.0-cp312-cp312-linux_x86_64.whl \
|
||||
wheels/torchvision-0.26.0+rocm7.2-cp312-cp312-manylinux_2_28_x86_64.whl
|
||||
|
||||
# Install the rest
|
||||
pip install -e .
|
||||
```
|
||||
|
||||
The torch, triton-rocm, and torchvision wheels are bundled in `wheels/`. If
|
||||
you don't have them yet (e.g. after a fresh clone), download them first:
|
||||
|
||||
```bash
|
||||
mkdir -p wheels
|
||||
python3.12 -m pip download torch==2.11.0 triton-rocm==3.6.0 torchvision==0.26.0 \
|
||||
--index-url https://download.pytorch.org/whl/rocm7.2 \
|
||||
--dest wheels --no-deps
|
||||
```
|
||||
|
||||
### Models
|
||||
|
||||
Symlink your ComfyUI models into `models/`:
|
||||
@@ -74,9 +86,9 @@ Config structure:
|
||||
|
||||
```yaml
|
||||
session:
|
||||
sdxl_checkpoint: models/novaAnimeXL.safetensors
|
||||
edit_model: models/qwen_image_edit.safetensors
|
||||
edit_lora: models/lightning-4steps.safetensors # optional
|
||||
sdxl_checkpoint: models/novaAnimeXL_ilV190.safetensors
|
||||
edit_model: models/qwen_image_edit_2509_fp8_e4m3fn.safetensors
|
||||
edit_lora: models/Qwen-Image-Edit-2509-Lightning-4steps-V1.0-bf16.safetensors # optional
|
||||
|
||||
output_dir: output/my_pipeline
|
||||
|
||||
@@ -221,9 +233,9 @@ memory between operations. Models are loaded eagerly at construction:
|
||||
from vnassets import VnAssetsSession
|
||||
|
||||
with VnAssetsSession(
|
||||
sdxl_checkpoint="models/novaAnimeXL.safetensors",
|
||||
edit_model="models/qwen_image_edit.safetensors",
|
||||
edit_lora="models/lightning-4steps.safetensors",
|
||||
sdxl_checkpoint="models/novaAnimeXL_ilV190.safetensors",
|
||||
edit_model="models/qwen_image_edit_2509_fp8_e4m3fn.safetensors",
|
||||
edit_lora="models/Qwen-Image-Edit-2509-Lightning-4steps-V1.0-bf16.safetensors",
|
||||
) as vna:
|
||||
vna.generate("1girl, red hair", output="base.png")
|
||||
vna.edit("base.png", "make her smile", output="happy.png")
|
||||
@@ -572,6 +584,7 @@ Use `--raw` to bypass weighting and fall back to plain diffusers encoding.
|
||||
| Flash attention (experimental) | ✅ Working |
|
||||
| `vnasset remove-bg` | ✅ Working |
|
||||
| `vnasset upscale` | ✅ Working |
|
||||
| Self-contained torch wheel | ✅ Working |
|
||||
| `vnasset serve` (daemon/HTTP API) | 🚧 Planned |
|
||||
| `torch.compile` on UNet | 🚧 Planned |
|
||||
| Batch edit loop (shared VAE encode) | 🚧 Planned |
|
||||
@@ -583,9 +596,5 @@ Use `--raw` to bypass weighting and fall back to plain diffusers encoding.
|
||||
- **Shared encode optimization** — for N edit variants of the same input image,
|
||||
run VAE encode and VL visual token encoding once, then only text-encode and
|
||||
denoise per variant.
|
||||
- **Self-contained torch wheel** — bundle the known-working torch wheel file in
|
||||
the project (`wheels/torch-2.11.0+rocm7.2-cp312-cp312-linux_x86_64.whl`) so
|
||||
the install is reproducible without depending on PyTorch's nightly index
|
||||
availability or a ComfyUI installation.
|
||||
- **`vnasset serve`** — lightweight daemon with Unix socket or HTTP API for
|
||||
integrating VNAsset into external tools.
|
||||
|
||||
@@ -18,6 +18,8 @@ dependencies = [
|
||||
"compel",
|
||||
"rembg",
|
||||
"onnxruntime",
|
||||
"torchvision",
|
||||
"realesrgan",
|
||||
]
|
||||
|
||||
[tool.setuptools.packages.find]
|
||||
|
||||
@@ -40,9 +40,9 @@ class VnAssetsSession:
|
||||
Usage as context manager::
|
||||
|
||||
with VnAssetsSession(
|
||||
sdxl_checkpoint="models/novaAnimeXL.safetensors",
|
||||
edit_model="models/qwen_image_edit.safetensors",
|
||||
edit_lora="models/lightning-4steps.safetensors",
|
||||
sdxl_checkpoint="models/novaAnimeXL_ilV190.safetensors",
|
||||
edit_model="models/qwen_image_edit_2509_fp8_e4m3fn.safetensors",
|
||||
edit_lora="models/Qwen-Image-Edit-2509-Lightning-4steps-V1.0-bf16.safetensors",
|
||||
) as vna:
|
||||
vna.generate("1girl, red hair", output="base.png")
|
||||
vna.edit("base.png", "make her smile", output="happy.png")
|
||||
|
||||
Reference in New Issue
Block a user