Spaces:
Running
Running
Suporte commited on
Commit ·
f7daa57
1
Parent(s): fe2ae68
Pin Flux2 GGUF config to klein base repo and pass HF token
Browse files
app.py
CHANGED
|
@@ -41,16 +41,20 @@ def get_pipe() -> Flux2KleinPipeline:
|
|
| 41 |
with _lock:
|
| 42 |
if _pipe is None:
|
| 43 |
try:
|
|
|
|
| 44 |
gguf_path = hf_hub_download(repo_id=GGUF_REPO, filename=GGUF_FILE)
|
| 45 |
qconfig = GGUFQuantizationConfig(compute_dtype=torch.float32)
|
| 46 |
transformer = Flux2Transformer2DModel.from_single_file(
|
| 47 |
gguf_path,
|
|
|
|
|
|
|
| 48 |
quantization_config=qconfig,
|
| 49 |
torch_dtype=torch.float32,
|
| 50 |
)
|
| 51 |
pipe = Flux2KleinPipeline.from_pretrained(
|
| 52 |
BASE_REPO,
|
| 53 |
transformer=transformer,
|
|
|
|
| 54 |
torch_dtype=torch.float32,
|
| 55 |
)
|
| 56 |
pipe = pipe.to("cpu")
|
|
|
|
| 41 |
with _lock:
|
| 42 |
if _pipe is None:
|
| 43 |
try:
|
| 44 |
+
hf_token = os.getenv("HF_TOKEN") or os.getenv("HUGGINGFACEHUB_API_TOKEN")
|
| 45 |
gguf_path = hf_hub_download(repo_id=GGUF_REPO, filename=GGUF_FILE)
|
| 46 |
qconfig = GGUFQuantizationConfig(compute_dtype=torch.float32)
|
| 47 |
transformer = Flux2Transformer2DModel.from_single_file(
|
| 48 |
gguf_path,
|
| 49 |
+
config=BASE_REPO,
|
| 50 |
+
token=hf_token,
|
| 51 |
quantization_config=qconfig,
|
| 52 |
torch_dtype=torch.float32,
|
| 53 |
)
|
| 54 |
pipe = Flux2KleinPipeline.from_pretrained(
|
| 55 |
BASE_REPO,
|
| 56 |
transformer=transformer,
|
| 57 |
+
token=hf_token,
|
| 58 |
torch_dtype=torch.float32,
|
| 59 |
)
|
| 60 |
pipe = pipe.to("cpu")
|