turome-learning commited on
Commit
7e0992b
·
verified ·
1 Parent(s): b09bc29

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +9 -2
main.py CHANGED
@@ -15,8 +15,15 @@ import imageio
15
  TMP_DIR = "/tmp/space_tmp"
16
  os.makedirs(TMP_DIR, exist_ok=True)
17
 
18
- # ✅ Load pipeline once to avoid reloading for every request
19
- pipeline = TrellisImageTo3DPipeline.from_pretrained("JeffreyXiang/TRELLIS-image-large")
 
 
 
 
 
 
 
20
  pipeline.cuda()
21
 
22
  # ✅ Preload model (to prevent cold starts)
 
15
  TMP_DIR = "/tmp/space_tmp"
16
  os.makedirs(TMP_DIR, exist_ok=True)
17
 
18
+ # ✅ Define a writable cache directory
19
+ cache_dir = "/tmp/huggingface_cache"
20
+ os.makedirs(cache_dir, exist_ok=True)
21
+
22
+ # ✅ Manually specify cache directory when loading the model
23
+ pipeline = TrellisImageTo3DPipeline.from_pretrained(
24
+ "JeffreyXiang/TRELLIS-image-large",
25
+ cache_dir=cache_dir
26
+ )
27
  pipeline.cuda()
28
 
29
  # ✅ Preload model (to prevent cold starts)