This commit is contained in:
2026-05-14 23:46:58 +08:00
parent 2653a5eb1e
commit 83c2c26e89
3 changed files with 10 additions and 73 deletions
@@ -1,6 +1,6 @@
from __future__ import annotations
import os
from pathlib import Path
from typing import Any, Callable
import numpy as np
@@ -24,12 +24,15 @@ def make_flux_fill_predictor(
else:
torch_dtype = torch.float32
hf_token = os.environ.get("HF_TOKEN") or os.environ.get("HUGGING_FACE_HUB_TOKEN")
root = Path(model_id.strip()).expanduser()
# 本机 diffusers 目录(含 model_index.json)时不访问 Hub,避免自动下载。
local_files_only = root.is_dir() and (root / "model_index.json").is_file()
pipe = FluxFillPipeline.from_pretrained(
model_id,
str(root),
torch_dtype=torch_dtype,
token=hf_token,
token=None,
local_files_only=local_files_only,
)
if device == "cuda":