Buckets:
AnonymousSpottedToad/candidate_bucket / codebase /python /Aquiles-ai_Aquiles-Image /example /aquiles_deploy_lora.py
| import modal | |
| import os | |
| aquiles_image = ( | |
| modal.Image.from_registry("nvidia/cuda:12.8.0-devel-ubuntu22.04", add_python="3.12") | |
| .apt_install("git", "curl", "build-essential",) | |
| .entrypoint([]) | |
| .run_commands( | |
| "python -m pip install --upgrade pip", | |
| "python -m pip install --upgrade setuptools wheel" | |
| ) | |
| .uv_pip_install( | |
| "torch==2.8", | |
| "git+https://github.com/huggingface/diffusers.git", | |
| "transformers==4.57.6", | |
| "tokenizers==0.22.2", | |
| "git+https://github.com/Aquiles-ai/Aquiles-Image.git@feature/Add-support-for-loading-LoRA#", | |
| "https://github.com/mjun0812/flash-attention-prebuild-wheels/releases/download/v0.3.14/flash_attn-2.8.2+cu128torch2.8-cp312-cp312-linux_x86_64.whl", | |
| "kernels", | |
| "uvicorn", | |
| "peft" | |
| ) | |
| .env({"HF_XET_HIGH_PERFORMANCE": "1"}) | |
| ) | |
| MODEL_NAME = "black-forest-labs/FLUX.1-dev" | |
| hf_cache_vol = modal.Volume.from_name("huggingface-cache", create_if_missing=True) | |
| aquiles_config_vol = modal.Volume.from_name("aquiles-cache", create_if_missing=True) | |
| app = modal.App("aquiles-image-server") | |
| N_GPU = 1 | |
| MINUTES = 60 | |
| AQUILES_PORT = 5500 | |
| LORA_PATH = "/root/.local/share/aquiles/lora.json" | |
| def genLoRA(): | |
| with aquiles_image.imports(): | |
| from aquilesimage.utils import save_lora_config | |
| from aquilesimage.models import LoRAConfig | |
| save_lora_config( | |
| LoRAConfig( | |
| repo_id="brushpenbob/Flux-retro-Disney-v2", | |
| weight_name="Flux_retro_Disney_v2.safetensors", | |
| adapter_name="flux-retro-disney-v2" | |
| ), | |
| LORA_PATH | |
| ) | |
| def serve(): | |
| genLoRA() | |
| import subprocess | |
| cmd = [ | |
| "aquiles-image", | |
| "serve", | |
| "--host", | |
| "0.0.0.0", | |
| "--port", | |
| str(AQUILES_PORT), | |
| "--model", | |
| MODEL_NAME, | |
| "--set-steps", "30", | |
| "--api-key", "dummy-api-key", | |
| "--device-map", "cuda", | |
| "--load-lora", | |
| "--lora-config", f"'{LORA_PATH}'" | |
| ] | |
| print(f"Starting Aquiles-Image with the model:{MODEL_NAME}") | |
| print(f"Command {' '.join(cmd)}") | |
| subprocess.Popen(" ".join(cmd), shell=True) |
Xet Storage Details
- Size:
- 2.61 kB
- Xet hash:
- 63520a3fda36748d2b339b5bd1d67ac34e819f8c8ee02b8d6d7bfc82fc6089de
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.