0xZohar commited on
Commit
657e4d3
·
verified ·
1 Parent(s): 0926bed

Fix startup hang: 使用 local_files_only=True

Browse files
Files changed (1) hide show
  1. code/demo.py +11 -11
code/demo.py CHANGED
@@ -326,36 +326,36 @@ def generate_ldr_gpu(ldr_content, ldr_path):
326
  is_hf_space = os.getenv("SPACE_ID") is not None
327
 
328
  if is_hf_space:
329
- # HF Spaces: Download all 3 checkpoints from Model Hub
330
  from huggingface_hub import hf_hub_download
331
- print("📥 Downloading model weights from HuggingFace Hub...")
332
 
333
- # Download base GPT model (7.17 GB)
334
  gpt_ckpt_path = hf_hub_download(
335
  repo_id="0xZohar/object-assembler-models",
336
  filename="shape_gpt.safetensors",
337
  cache_dir=HF_CACHE_DIR,
338
- local_files_only=False
339
  )
340
- print(f" ✓ Base GPT model loaded")
341
 
342
- # Download shape tokenizer (1.09 GB)
343
  shape_ckpt_path = hf_hub_download(
344
  repo_id="0xZohar/object-assembler-models",
345
  filename="shape_tokenizer.safetensors",
346
  cache_dir=HF_CACHE_DIR,
347
- local_files_only=False
348
  )
349
- print(f" ✓ Shape tokenizer loaded")
350
 
351
- # Download fine-tuned adapter (1.68 GB)
352
  save_gpt_ckpt_path = hf_hub_download(
353
  repo_id="0xZohar/object-assembler-models",
354
  filename="save_shape_cars_whole_p_rot_scratch_4mask_randp.safetensors",
355
  cache_dir=HF_CACHE_DIR,
356
- local_files_only=False
357
  )
358
- print(f" ✓ Fine-tuned adapter loaded")
359
  else:
360
  # Local environment: Use local paths (matching original demo.zip structure)
361
  gpt_ckpt_path = 'temp_weights/shape_gpt.safetensors'
 
326
  is_hf_space = os.getenv("SPACE_ID") is not None
327
 
328
  if is_hf_space:
329
+ # HF Spaces: Use pre-downloaded weights from build-time cache
330
  from huggingface_hub import hf_hub_download
331
+ print("📂 Loading pre-cached model weights from build...")
332
 
333
+ # Load base GPT model (7.17 GB, pre-downloaded during build)
334
  gpt_ckpt_path = hf_hub_download(
335
  repo_id="0xZohar/object-assembler-models",
336
  filename="shape_gpt.safetensors",
337
  cache_dir=HF_CACHE_DIR,
338
+ local_files_only=True
339
  )
340
+ print(f" ✓ Base GPT model loaded from cache")
341
 
342
+ # Load shape tokenizer (1.09 GB, pre-downloaded during build)
343
  shape_ckpt_path = hf_hub_download(
344
  repo_id="0xZohar/object-assembler-models",
345
  filename="shape_tokenizer.safetensors",
346
  cache_dir=HF_CACHE_DIR,
347
+ local_files_only=True
348
  )
349
+ print(f" ✓ Shape tokenizer loaded from cache")
350
 
351
+ # Load fine-tuned adapter (1.68 GB, pre-downloaded during build)
352
  save_gpt_ckpt_path = hf_hub_download(
353
  repo_id="0xZohar/object-assembler-models",
354
  filename="save_shape_cars_whole_p_rot_scratch_4mask_randp.safetensors",
355
  cache_dir=HF_CACHE_DIR,
356
+ local_files_only=True
357
  )
358
+ print(f" ✓ Fine-tuned adapter loaded from cache")
359
  else:
360
  # Local environment: Use local paths (matching original demo.zip structure)
361
  gpt_ckpt_path = 'temp_weights/shape_gpt.safetensors'