sayakpaul HF staff commited on
Commit
94913a9
1 Parent(s): b64b5e6

fix: formatting.

Browse files
Files changed (2) hide show
  1. convert.py +5 -4
  2. hub_utils/readme.py +1 -1
convert.py CHANGED
@@ -64,7 +64,7 @@ def run_conversion(text_encoder_weights: str = None, unet_weights: str = None):
64
 
65
  text_encoder_state_dict_from_tf = populate_text_encoder(tf_text_encoder)
66
  unet_state_dict_from_tf = populate_unet(tf_unet)
67
- print("Conversion done, now running assertions...")
68
 
69
  # Since we cannot compare the fine-tuned weights.
70
  if text_encoder_weights is None:
@@ -74,9 +74,10 @@ def run_conversion(text_encoder_weights: str = None, unet_weights: str = None):
74
  unet_state_dict_from_pt = pt_unet.state_dict()
75
  run_assertion(unet_state_dict_from_pt, unet_state_dict_from_tf)
76
 
77
- print(
78
- "Assertions successful, populating the converted parameters into the diffusers models..."
79
- )
 
80
  pt_text_encoder.load_state_dict(text_encoder_state_dict_from_tf)
81
  pt_unet.load_state_dict(unet_state_dict_from_tf)
82
 
 
64
 
65
  text_encoder_state_dict_from_tf = populate_text_encoder(tf_text_encoder)
66
  unet_state_dict_from_tf = populate_unet(tf_unet)
67
+ print("Conversion done, now running optional assertions...")
68
 
69
  # Since we cannot compare the fine-tuned weights.
70
  if text_encoder_weights is None:
 
74
  unet_state_dict_from_pt = pt_unet.state_dict()
75
  run_assertion(unet_state_dict_from_pt, unet_state_dict_from_tf)
76
 
77
+ if text_encoder_weights is None or unet_weights is None:
78
+ print(
79
+ "Assertions successful, populating the converted parameters into the diffusers models..."
80
+ )
81
  pt_text_encoder.load_state_dict(text_encoder_state_dict_from_tf)
82
  pt_unet.load_state_dict(unet_state_dict_from_tf)
83
 
hub_utils/readme.py CHANGED
@@ -19,7 +19,7 @@ inference: true
19
  model_card = f"""
20
  # KerasCV Stable Diffusion in Diffusers 🧨🤗
21
 
22
- The pipeline contained in this repository was created using [this Space](https://huggingface.co/spaces/sayakpaul/convert-kerascv-sd-diffusers). The purpose is to convert the KerasCV Stable Diffusion weights in a way that is compatible with Diffusers. This allows users to fine-tune using KerasCV and use the fine-tuned weights in Diffusers taking advantage of its nifty features (like schedulers, fast attention, etc.).\n
23
 
24
  """
25
 
 
19
  model_card = f"""
20
  # KerasCV Stable Diffusion in Diffusers 🧨🤗
21
 
22
+ The pipeline contained in this repository was created using [this Space](https://huggingface.co/spaces/sayakpaul/convert-kerascv-sd-diffusers). The purpose is to convert the KerasCV Stable Diffusion weights in a way that is compatible with [Diffusers](https://github.com/huggingface/diffusers). This allows users to fine-tune using KerasCV and use the fine-tuned weights in Diffusers taking advantage of its nifty features (like [schedulers](https://huggingface.co/docs/diffusers/main/en/using-diffusers/schedulers), [fast attention](https://huggingface.co/docs/diffusers/optimization/fp16), etc.).\n
23
 
24
  """
25