Skip to content

Commit 0c7cb9a

Browse files
authored
Flax: Ignore PyTorch, ONNX files when they coexist with Flax weights (huggingface#5237)
Ignore PyTorch, ONNX files when they coexist with Flax weights
1 parent 84e5cc5 commit 0c7cb9a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/diffusers/pipelines/pipeline_flax_utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,8 +341,8 @@ def from_pretrained(cls, pretrained_model_name_or_path: Optional[Union[str, os.P
341341
allow_patterns = [os.path.join(k, "*") for k in folder_names]
342342
allow_patterns += [FLAX_WEIGHTS_NAME, SCHEDULER_CONFIG_NAME, CONFIG_NAME, cls.config_name]
343343

344-
# make sure we don't download PyTorch weights, unless when using from_pt
345-
ignore_patterns = "*.bin" if not from_pt else []
344+
ignore_patterns = ["*.bin", "*.safetensors"] if not from_pt else []
345+
ignore_patterns += ["*.onnx", "*.onnx_data", "*.xml", "*.pb"]
346346

347347
if cls != FlaxDiffusionPipeline:
348348
requested_pipeline_class = cls.__name__

0 commit comments

Comments
 (0)