File size: 1,553 Bytes
19f8af1
060ca74
19f8af1
 
 
060ca74
19f8af1
 
 
 
 
 
060ca74
19f8af1
060ca74
 
19f8af1
 
060ca74
 
19f8af1
 
dbfa2d9
 
 
bc23d68
dbfa2d9
bc23d68
dbfa2d9
 
19f8af1
c4ac18c
 
 
 
 
 
 
bc23d68
c4ac18c
adf3303
c4ac18c
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import modal
from pathlib import Path

image = (
    modal.Image.debian_slim(python_version="3.12")
    .apt_install("git")
    .pip_install(
        "torch==2.7.0",
        "torchvision",
        "diffusers==0.33.1",
        "transformers==4.52.4",
        "accelerate==1.7.0",
        "opencv-python-headless",
        "huggingface_hub[hf_transfer]==0.32.4",
        "git+https://github.com/sitatec/lang-segment-anything.git",
        "https://github.com/mit-han-lab/nunchaku/releases/download/v0.3.1dev20250609/nunchaku-0.3.1.dev20250609+torch2.7-cp312-cp312-linux_x86_64.whl#sha256=1518f6c02358545fd0336a6a74547e2c875603b381d5ce75b1664f981105b141",
    )
    .env({"HF_HUB_ENABLE_HF_TRANSFER": "1"})
    .add_local_file(str(Path(__file__).resolve()), "/root/configs.py")
    .add_local_file(str(Path(__file__).parent / "auto_masker.py"), "/root/auto_masker.py")
)

hf_cache_vol = modal.Volume.from_name(
    "huggingface-cache", create_if_missing=True, environment_name="vibe-shopping"
)
SECRETS = modal.Secret.from_name(
    "vibe-shopping-secrets",
    required_keys=["VT_API_KEY", "HF_TOKEN"],
    environment_name="vibe-shopping",
)
MINUTE = 60

modal_class_config = {
    "image": image,
    "gpu": "A100-40GB",
    "volumes": {
        "/root/.cache/huggingface": hf_cache_vol,
    },
    "secrets": [SECRETS],
    "scaledown_window": (
        10 * MINUTE
        # how long should we stay up with no requests? Keep it low to minimize credit usage for now.
    ),
    "timeout": 10 * MINUTE,  # how long should we wait for container start?
}