mahwiz khalil commited on
Commit
c54f4e7
·
unverified ·
1 Parent(s): 129014c

Update finetune_gradio.py

Browse files

The safest approach here is to explicitly set weights_only=True to load only the model weights and avoid executing potentially unsafe code

src/f5_tts/train/finetune_gradio.py CHANGED
@@ -974,7 +974,7 @@ def calculate_train(
974
 
975
  def extract_and_save_ema_model(checkpoint_path: str, new_checkpoint_path: str, safetensors: bool) -> str:
976
  try:
977
- checkpoint = torch.load(checkpoint_path)
978
  print("Original Checkpoint Keys:", checkpoint.keys())
979
 
980
  ema_model_state_dict = checkpoint.get("ema_model_state_dict", None)
 
974
 
975
  def extract_and_save_ema_model(checkpoint_path: str, new_checkpoint_path: str, safetensors: bool) -> str:
976
  try:
977
+ checkpoint = torch.load(checkpoint_path, weights_only=True)
978
  print("Original Checkpoint Keys:", checkpoint.keys())
979
 
980
  ema_model_state_dict = checkpoint.get("ema_model_state_dict", None)