Skip to content

Commit c50a707

Browse files
committed
save issues
1 parent 81f0710 commit c50a707

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

src/maxdiffusion/scripts/convert_ltx2_vae_weights.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from huggingface_hub import hf_hub_download
1313
from flax import nnx
1414
from flax import traverse_util
15+
import shutil
1516

1617
def convert_ltx2_vae(hf_repo, output_path):
1718
# Ensure output path is absolute
@@ -131,6 +132,11 @@ def convert_ltx2_vae(hf_repo, output_path):
131132

132133
# Save checkpoint
133134
print(f"Saving converted weights to {output_path}...")
135+
136+
if os.path.exists(output_path):
137+
print(f"Removing existing checkpoint at {output_path}...")
138+
shutil.rmtree(output_path)
139+
134140
checkpointer = orbax.checkpoint.Checkpointer(orbax.checkpoint.PyTreeCheckpointHandler())
135141
save_args = orbax_utils.save_args_from_target(params_nested)
136142
checkpointer.save(output_path, params_nested, save_args=save_args)

0 commit comments

Comments
 (0)