698698 " #@markdown <font size=\" -1.5\" > path to where you want to save your converted model and it's file\n " ,
699699 " exp_folder = \"\" #@param{type:\" string\" }\n " ,
700700 " \n " ,
701+ " search_text = \" args_work_dir = os.path.join(\"\n " ,
702+ " replacement = f\" args_work_dir = '{checkpoints_path}'\"\n " ,
703+ " with open(\" /content/DiffSinger/utils/hparams.py\" , \" r\" ) as file:\n " ,
704+ " lines = file.readlines()\n " ,
705+ " for i, line in enumerate(lines):\n " ,
706+ " if search_text in line:\n " ,
707+ " lines[i] = replacement + \"\\ n\"\n " ,
708+ " break\n " ,
709+ " with open(\" /content/DiffSinger/utils/hparams.py\" , \" w\" ) as file:\n " ,
710+ " file.writelines(lines)\n " ,
711+ " #incase if anyone wanna change it lmao\n " ,
712+ " search_text_alt = \" args_work_dir = '\"\n " ,
713+ " replacement_alt = f\" args_work_dir = '{checkpoints_path}'\"\n " ,
714+ " with open(\" /content/DiffSinger/utils/hparams.py\" , \" r\" ) as file:\n " ,
715+ " lines = file.readlines()\n " ,
716+ " for i, line in enumerate(lines):\n " ,
717+ " if search_text_alt in line:\n " ,
718+ " lines[i] = replacement_alt + \"\\ n\"\n " ,
719+ " break\n " ,
720+ " with open(\" /content/DiffSinger/utils/hparams.py\" , \" w\" ) as file:\n " ,
721+ " file.writelines(lines)\n " ,
722+ " \n " ,
701723 " !cp {checkpoints_path} -r /content/DiffSinger/checkpoints\n " ,
702724 " if no_warn:\n " ,
703725 " !python /content/DiffSinger/scripts/export.py {model_type} --exp {folder_name} --out {exp_folder} 2> /dev/null\n " ,
796818 }
797819 }
798820 ]
799- }
821+ }
0 commit comments