Spaces:
Running
Running
Aitron Emper
commited on
Commit
•
7e361e2
1
Parent(s):
c99d8c1
Update core.py
Browse files
core.py
CHANGED
@@ -1,1390 +1,1392 @@
|
|
1 |
-
import os
|
2 |
-
import sys
|
3 |
-
import json
|
4 |
-
import argparse
|
5 |
-
import subprocess
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
from rvc.
|
14 |
-
from rvc.
|
15 |
-
|
16 |
-
|
17 |
-
from rvc.train.process.
|
18 |
-
from rvc.train.process.
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
"
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
if str(
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
"-
|
354 |
-
|
355 |
-
"-
|
356 |
-
|
357 |
-
"-
|
358 |
-
|
359 |
-
"-
|
360 |
-
|
361 |
-
"-
|
362 |
-
|
363 |
-
"-
|
364 |
-
|
365 |
-
"-
|
366 |
-
|
367 |
-
"-
|
368 |
-
|
369 |
-
"-
|
370 |
-
|
371 |
-
"-
|
372 |
-
|
373 |
-
"-
|
374 |
-
|
375 |
-
"-
|
376 |
-
|
377 |
-
"-
|
378 |
-
|
379 |
-
"-
|
380 |
-
|
381 |
-
"-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
"
|
461 |
-
|
462 |
-
"--
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
"
|
529 |
-
"
|
530 |
-
"
|
531 |
-
"
|
532 |
-
"
|
533 |
-
"
|
534 |
-
"
|
535 |
-
"hybrid[rmvpe
|
536 |
-
"hybrid[crepe+
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
infer_parser.add_argument("--
|
543 |
-
infer_parser.add_argument(
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
|
629 |
-
|
630 |
-
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
-
|
638 |
-
|
639 |
-
|
640 |
-
|
641 |
-
|
642 |
-
|
643 |
-
|
644 |
-
|
645 |
-
|
646 |
-
|
647 |
-
|
648 |
-
|
649 |
-
|
650 |
-
|
651 |
-
|
652 |
-
|
653 |
-
|
654 |
-
|
655 |
-
|
656 |
-
|
657 |
-
"
|
658 |
-
"
|
659 |
-
"
|
660 |
-
"
|
661 |
-
"
|
662 |
-
"
|
663 |
-
"
|
664 |
-
"hybrid[rmvpe
|
665 |
-
"hybrid[crepe+
|
666 |
-
|
667 |
-
|
668 |
-
|
669 |
-
|
670 |
-
|
671 |
-
batch_infer_parser.add_argument(
|
672 |
-
|
673 |
-
|
674 |
-
|
675 |
-
|
676 |
-
|
677 |
-
|
678 |
-
|
679 |
-
|
680 |
-
|
681 |
-
|
682 |
-
|
683 |
-
|
684 |
-
|
685 |
-
|
686 |
-
|
687 |
-
|
688 |
-
|
689 |
-
|
690 |
-
|
691 |
-
|
692 |
-
|
693 |
-
|
694 |
-
|
695 |
-
|
696 |
-
|
697 |
-
|
698 |
-
|
699 |
-
|
700 |
-
|
701 |
-
|
702 |
-
|
703 |
-
|
704 |
-
|
705 |
-
|
706 |
-
|
707 |
-
|
708 |
-
|
709 |
-
|
710 |
-
|
711 |
-
|
712 |
-
|
713 |
-
|
714 |
-
|
715 |
-
|
716 |
-
|
717 |
-
|
718 |
-
|
719 |
-
|
720 |
-
|
721 |
-
|
722 |
-
|
723 |
-
|
724 |
-
|
725 |
-
|
726 |
-
|
727 |
-
|
728 |
-
|
729 |
-
|
730 |
-
|
731 |
-
|
732 |
-
|
733 |
-
|
734 |
-
|
735 |
-
|
736 |
-
|
737 |
-
|
738 |
-
|
739 |
-
|
740 |
-
|
741 |
-
|
742 |
-
|
743 |
-
|
744 |
-
|
745 |
-
|
746 |
-
|
747 |
-
|
748 |
-
|
749 |
-
|
750 |
-
|
751 |
-
|
752 |
-
|
753 |
-
|
754 |
-
|
755 |
-
|
756 |
-
|
757 |
-
|
758 |
-
|
759 |
-
|
760 |
-
|
761 |
-
|
762 |
-
|
763 |
-
|
764 |
-
|
765 |
-
|
766 |
-
|
767 |
-
|
768 |
-
|
769 |
-
|
770 |
-
|
771 |
-
|
772 |
-
|
773 |
-
|
774 |
-
|
775 |
-
|
776 |
-
|
777 |
-
|
778 |
-
|
779 |
-
|
780 |
-
|
781 |
-
|
782 |
-
|
783 |
-
|
784 |
-
|
785 |
-
|
786 |
-
|
787 |
-
|
788 |
-
|
789 |
-
|
790 |
-
|
791 |
-
|
792 |
-
|
793 |
-
|
794 |
-
|
795 |
-
|
796 |
-
|
797 |
-
|
798 |
-
|
799 |
-
|
800 |
-
|
801 |
-
|
802 |
-
|
803 |
-
|
804 |
-
"
|
805 |
-
"
|
806 |
-
"
|
807 |
-
"
|
808 |
-
"
|
809 |
-
"
|
810 |
-
"
|
811 |
-
"hybrid[rmvpe
|
812 |
-
"hybrid[crepe+
|
813 |
-
|
814 |
-
|
815 |
-
|
816 |
-
|
817 |
-
|
818 |
-
tts_parser.add_argument("--
|
819 |
-
tts_parser.add_argument(
|
820 |
-
|
821 |
-
|
822 |
-
|
823 |
-
|
824 |
-
|
825 |
-
|
826 |
-
|
827 |
-
|
828 |
-
|
829 |
-
|
830 |
-
|
831 |
-
|
832 |
-
|
833 |
-
|
834 |
-
|
835 |
-
|
836 |
-
|
837 |
-
|
838 |
-
|
839 |
-
|
840 |
-
|
841 |
-
|
842 |
-
|
843 |
-
|
844 |
-
|
845 |
-
|
846 |
-
|
847 |
-
|
848 |
-
|
849 |
-
|
850 |
-
|
851 |
-
|
852 |
-
|
853 |
-
|
854 |
-
|
855 |
-
|
856 |
-
|
857 |
-
|
858 |
-
|
859 |
-
|
860 |
-
|
861 |
-
|
862 |
-
|
863 |
-
|
864 |
-
|
865 |
-
|
866 |
-
|
867 |
-
|
868 |
-
|
869 |
-
|
870 |
-
|
871 |
-
|
872 |
-
|
873 |
-
|
874 |
-
|
875 |
-
|
876 |
-
|
877 |
-
|
878 |
-
|
879 |
-
|
880 |
-
|
881 |
-
|
882 |
-
|
883 |
-
preprocess_parser.
|
884 |
-
|
885 |
-
|
886 |
-
|
887 |
-
|
888 |
-
|
889 |
-
|
890 |
-
|
891 |
-
|
892 |
-
|
893 |
-
|
894 |
-
|
895 |
-
|
896 |
-
|
897 |
-
|
898 |
-
|
899 |
-
|
900 |
-
|
901 |
-
|
902 |
-
|
903 |
-
|
904 |
-
|
905 |
-
|
906 |
-
|
907 |
-
|
908 |
-
|
909 |
-
|
910 |
-
|
911 |
-
|
912 |
-
|
913 |
-
|
914 |
-
|
915 |
-
|
916 |
-
"
|
917 |
-
"
|
918 |
-
"
|
919 |
-
"
|
920 |
-
|
921 |
-
|
922 |
-
|
923 |
-
|
924 |
-
|
925 |
-
|
926 |
-
|
927 |
-
|
928 |
-
|
929 |
-
|
930 |
-
|
931 |
-
|
932 |
-
|
933 |
-
|
934 |
-
|
935 |
-
|
936 |
-
|
937 |
-
|
938 |
-
|
939 |
-
|
940 |
-
|
941 |
-
|
942 |
-
|
943 |
-
|
944 |
-
|
945 |
-
|
946 |
-
|
947 |
-
|
948 |
-
|
949 |
-
|
950 |
-
|
951 |
-
|
952 |
-
|
953 |
-
|
954 |
-
|
955 |
-
|
956 |
-
|
957 |
-
|
958 |
-
|
959 |
-
|
960 |
-
|
961 |
-
|
962 |
-
|
963 |
-
|
964 |
-
|
965 |
-
|
966 |
-
|
967 |
-
|
968 |
-
|
969 |
-
|
970 |
-
|
971 |
-
|
972 |
-
|
973 |
-
|
974 |
-
|
975 |
-
|
976 |
-
|
977 |
-
|
978 |
-
|
979 |
-
|
980 |
-
|
981 |
-
|
982 |
-
|
983 |
-
|
984 |
-
|
985 |
-
|
986 |
-
|
987 |
-
|
988 |
-
|
989 |
-
|
990 |
-
|
991 |
-
|
992 |
-
|
993 |
-
|
994 |
-
|
995 |
-
|
996 |
-
|
997 |
-
|
998 |
-
|
999 |
-
|
1000 |
-
|
1001 |
-
|
1002 |
-
|
1003 |
-
|
1004 |
-
|
1005 |
-
|
1006 |
-
|
1007 |
-
|
1008 |
-
|
1009 |
-
|
1010 |
-
|
1011 |
-
|
1012 |
-
|
1013 |
-
|
1014 |
-
|
1015 |
-
|
1016 |
-
|
1017 |
-
|
1018 |
-
|
1019 |
-
|
1020 |
-
|
1021 |
-
|
1022 |
-
|
1023 |
-
|
1024 |
-
|
1025 |
-
|
1026 |
-
|
1027 |
-
|
1028 |
-
|
1029 |
-
|
1030 |
-
|
1031 |
-
|
1032 |
-
|
1033 |
-
|
1034 |
-
|
1035 |
-
|
1036 |
-
|
1037 |
-
|
1038 |
-
|
1039 |
-
|
1040 |
-
|
1041 |
-
|
1042 |
-
|
1043 |
-
|
1044 |
-
|
1045 |
-
|
1046 |
-
|
1047 |
-
|
1048 |
-
|
1049 |
-
|
1050 |
-
|
1051 |
-
|
1052 |
-
|
1053 |
-
|
1054 |
-
|
1055 |
-
|
1056 |
-
|
1057 |
-
|
1058 |
-
|
1059 |
-
|
1060 |
-
|
1061 |
-
|
1062 |
-
|
1063 |
-
|
1064 |
-
|
1065 |
-
|
1066 |
-
|
1067 |
-
|
1068 |
-
|
1069 |
-
|
1070 |
-
|
1071 |
-
|
1072 |
-
|
1073 |
-
|
1074 |
-
|
1075 |
-
|
1076 |
-
|
1077 |
-
|
1078 |
-
|
1079 |
-
|
1080 |
-
|
1081 |
-
|
1082 |
-
|
1083 |
-
|
1084 |
-
|
1085 |
-
|
1086 |
-
|
1087 |
-
|
1088 |
-
|
1089 |
-
|
1090 |
-
|
1091 |
-
|
1092 |
-
|
1093 |
-
|
1094 |
-
|
1095 |
-
|
1096 |
-
|
1097 |
-
|
1098 |
-
|
1099 |
-
|
1100 |
-
|
1101 |
-
|
1102 |
-
|
1103 |
-
|
1104 |
-
|
1105 |
-
|
1106 |
-
|
1107 |
-
|
1108 |
-
|
1109 |
-
|
1110 |
-
|
1111 |
-
|
1112 |
-
|
1113 |
-
|
1114 |
-
|
1115 |
-
|
1116 |
-
|
1117 |
-
|
1118 |
-
|
1119 |
-
|
1120 |
-
|
1121 |
-
|
1122 |
-
|
1123 |
-
|
1124 |
-
|
1125 |
-
|
1126 |
-
|
1127 |
-
|
1128 |
-
|
1129 |
-
|
1130 |
-
|
1131 |
-
|
1132 |
-
|
1133 |
-
|
1134 |
-
|
1135 |
-
|
1136 |
-
|
1137 |
-
|
1138 |
-
|
1139 |
-
|
1140 |
-
|
1141 |
-
|
1142 |
-
|
1143 |
-
|
1144 |
-
|
1145 |
-
|
1146 |
-
|
1147 |
-
|
1148 |
-
|
1149 |
-
|
1150 |
-
|
1151 |
-
|
1152 |
-
|
1153 |
-
|
1154 |
-
|
1155 |
-
|
1156 |
-
|
1157 |
-
|
1158 |
-
|
1159 |
-
|
1160 |
-
|
1161 |
-
|
1162 |
-
|
1163 |
-
|
1164 |
-
|
1165 |
-
|
1166 |
-
|
1167 |
-
|
1168 |
-
|
1169 |
-
|
1170 |
-
|
1171 |
-
|
1172 |
-
|
1173 |
-
|
1174 |
-
|
1175 |
-
|
1176 |
-
|
1177 |
-
|
1178 |
-
|
1179 |
-
|
1180 |
-
|
1181 |
-
|
1182 |
-
|
1183 |
-
|
1184 |
-
|
1185 |
-
|
1186 |
-
|
1187 |
-
|
1188 |
-
|
1189 |
-
|
1190 |
-
|
1191 |
-
|
1192 |
-
|
1193 |
-
|
1194 |
-
|
1195 |
-
|
1196 |
-
|
1197 |
-
|
1198 |
-
|
1199 |
-
|
1200 |
-
|
1201 |
-
|
1202 |
-
|
1203 |
-
|
1204 |
-
|
1205 |
-
|
1206 |
-
|
1207 |
-
|
1208 |
-
audio_analyzer
|
1209 |
-
|
1210 |
-
|
1211 |
-
|
1212 |
-
|
1213 |
-
|
1214 |
-
|
1215 |
-
|
1216 |
-
|
1217 |
-
|
1218 |
-
|
1219 |
-
|
1220 |
-
|
1221 |
-
|
1222 |
-
|
1223 |
-
|
1224 |
-
|
1225 |
-
|
1226 |
-
|
1227 |
-
|
1228 |
-
|
1229 |
-
|
1230 |
-
|
1231 |
-
|
1232 |
-
|
1233 |
-
|
1234 |
-
|
1235 |
-
|
1236 |
-
str(args.
|
1237 |
-
str(args.
|
1238 |
-
str(args.
|
1239 |
-
str(args.
|
1240 |
-
str(args.
|
1241 |
-
str(args.
|
1242 |
-
str(args.
|
1243 |
-
str(args.
|
1244 |
-
str(args.
|
1245 |
-
str(args.
|
1246 |
-
str(args.
|
1247 |
-
str(args.
|
1248 |
-
str(args.
|
1249 |
-
str(args.
|
1250 |
-
str(args.
|
1251 |
-
str(args.
|
1252 |
-
str(args.
|
1253 |
-
|
1254 |
-
|
1255 |
-
|
1256 |
-
|
1257 |
-
|
1258 |
-
str(args.
|
1259 |
-
str(args.
|
1260 |
-
str(args.
|
1261 |
-
str(args.
|
1262 |
-
str(args.
|
1263 |
-
str(args.
|
1264 |
-
str(args.
|
1265 |
-
str(args.
|
1266 |
-
str(args.
|
1267 |
-
str(args.
|
1268 |
-
str(args.
|
1269 |
-
str(args.
|
1270 |
-
str(args.
|
1271 |
-
str(args.
|
1272 |
-
str(args.
|
1273 |
-
str(args.
|
1274 |
-
str(args.
|
1275 |
-
|
1276 |
-
|
1277 |
-
|
1278 |
-
|
1279 |
-
|
1280 |
-
str(args.
|
1281 |
-
str(args.
|
1282 |
-
str(args.
|
1283 |
-
str(args.
|
1284 |
-
str(args.
|
1285 |
-
str(args.
|
1286 |
-
str(args.
|
1287 |
-
str(args.
|
1288 |
-
str(args.
|
1289 |
-
str(args.
|
1290 |
-
str(args.
|
1291 |
-
str(args.
|
1292 |
-
str(args.
|
1293 |
-
str(args.
|
1294 |
-
str(args.
|
1295 |
-
str(args.
|
1296 |
-
str(args.
|
1297 |
-
str(args.
|
1298 |
-
str(args.
|
1299 |
-
str(args.
|
1300 |
-
|
1301 |
-
|
1302 |
-
|
1303 |
-
|
1304 |
-
|
1305 |
-
str(args.
|
1306 |
-
|
1307 |
-
|
1308 |
-
|
1309 |
-
|
1310 |
-
|
1311 |
-
str(args.
|
1312 |
-
str(args.
|
1313 |
-
str(args.
|
1314 |
-
str(args.
|
1315 |
-
str(args.
|
1316 |
-
|
1317 |
-
|
1318 |
-
|
1319 |
-
|
1320 |
-
|
1321 |
-
str(args.
|
1322 |
-
str(args.
|
1323 |
-
str(args.
|
1324 |
-
str(args.
|
1325 |
-
str(args.
|
1326 |
-
str(args.
|
1327 |
-
str(args.
|
1328 |
-
str(args.
|
1329 |
-
str(args.
|
1330 |
-
str(args.
|
1331 |
-
str(args.
|
1332 |
-
str(args.
|
1333 |
-
str(args.
|
1334 |
-
str(args.
|
1335 |
-
str(args.
|
1336 |
-
|
1337 |
-
|
1338 |
-
|
1339 |
-
|
1340 |
-
|
1341 |
-
|
1342 |
-
|
1343 |
-
|
1344 |
-
|
1345 |
-
|
1346 |
-
str(args.
|
1347 |
-
str(args.
|
1348 |
-
str(args.
|
1349 |
-
str(args.
|
1350 |
-
str(args.
|
1351 |
-
|
1352 |
-
|
1353 |
-
|
1354 |
-
|
1355 |
-
|
1356 |
-
|
1357 |
-
|
1358 |
-
|
1359 |
-
|
1360 |
-
str(args.
|
1361 |
-
str(args.
|
1362 |
-
|
1363 |
-
|
1364 |
-
|
1365 |
-
elif args.mode == "
|
1366 |
-
|
1367 |
-
|
1368 |
-
|
1369 |
-
|
1370 |
-
|
1371 |
-
|
1372 |
-
|
1373 |
-
str(args.
|
1374 |
-
str(args.
|
1375 |
-
|
1376 |
-
|
1377 |
-
|
1378 |
-
|
1379 |
-
|
1380 |
-
|
1381 |
-
|
1382 |
-
|
1383 |
-
|
1384 |
-
|
1385 |
-
|
1386 |
-
|
1387 |
-
|
1388 |
-
|
1389 |
-
|
1390 |
-
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
import sys
|
3 |
+
import json
|
4 |
+
import argparse
|
5 |
+
import subprocess
|
6 |
+
import spaces
|
7 |
+
|
8 |
+
now_dir = os.getcwd()
|
9 |
+
sys.path.append(now_dir)
|
10 |
+
|
11 |
+
from rvc.configs.config import Config
|
12 |
+
|
13 |
+
from rvc.lib.tools.prerequisites_download import prequisites_download_pipeline
|
14 |
+
from rvc.train.extract.preparing_files import generate_config, generate_filelist
|
15 |
+
from rvc.lib.tools.pretrained_selector import pretrained_selector
|
16 |
+
|
17 |
+
from rvc.train.process.model_blender import model_blender
|
18 |
+
from rvc.train.process.model_information import model_information
|
19 |
+
from rvc.train.process.extract_small_model import extract_small_model
|
20 |
+
|
21 |
+
from rvc.infer.infer import infer_pipeline
|
22 |
+
|
23 |
+
from rvc.lib.tools.analyzer import analyze_audio
|
24 |
+
|
25 |
+
from rvc.lib.tools.launch_tensorboard import launch_tensorboard_pipeline
|
26 |
+
|
27 |
+
from rvc.lib.tools.model_download import model_download_pipeline
|
28 |
+
|
29 |
+
config = Config()
|
30 |
+
current_script_directory = os.path.dirname(os.path.realpath(__file__))
|
31 |
+
logs_path = os.path.join(current_script_directory, "logs")
|
32 |
+
|
33 |
+
# Get TTS Voices
|
34 |
+
with open(os.path.join("rvc", "lib", "tools", "tts_voices.json"), "r") as f:
|
35 |
+
voices_data = json.load(f)
|
36 |
+
|
37 |
+
locales = list({voice["Locale"] for voice in voices_data})
|
38 |
+
|
39 |
+
|
40 |
+
# Infer
|
41 |
+
@spaces.GPU
|
42 |
+
def run_infer_script(
|
43 |
+
f0up_key,
|
44 |
+
filter_radius,
|
45 |
+
index_rate,
|
46 |
+
rms_mix_rate,
|
47 |
+
protect,
|
48 |
+
hop_length,
|
49 |
+
f0method,
|
50 |
+
input_path,
|
51 |
+
output_path,
|
52 |
+
pth_path,
|
53 |
+
index_path,
|
54 |
+
split_audio,
|
55 |
+
f0autotune,
|
56 |
+
clean_audio,
|
57 |
+
clean_strength,
|
58 |
+
export_format,
|
59 |
+
embedder_model,
|
60 |
+
embedder_model_custom,
|
61 |
+
upscale_audio,
|
62 |
+
):
|
63 |
+
f0autotune = "True" if str(f0autotune) == "True" else "False"
|
64 |
+
clean_audio = "True" if str(clean_audio) == "True" else "False"
|
65 |
+
upscale_audio = "True" if str(upscale_audio) == "True" else "False"
|
66 |
+
infer_pipeline(
|
67 |
+
f0up_key,
|
68 |
+
filter_radius,
|
69 |
+
index_rate,
|
70 |
+
rms_mix_rate,
|
71 |
+
protect,
|
72 |
+
hop_length,
|
73 |
+
f0method,
|
74 |
+
input_path,
|
75 |
+
output_path,
|
76 |
+
pth_path,
|
77 |
+
index_path,
|
78 |
+
split_audio,
|
79 |
+
f0autotune,
|
80 |
+
clean_audio,
|
81 |
+
clean_strength,
|
82 |
+
export_format,
|
83 |
+
embedder_model,
|
84 |
+
embedder_model_custom,
|
85 |
+
upscale_audio,
|
86 |
+
)
|
87 |
+
return f"File {input_path} inferred successfully.", output_path.replace(
|
88 |
+
".wav", f".{export_format.lower()}"
|
89 |
+
)
|
90 |
+
|
91 |
+
|
92 |
+
# Batch infer
|
93 |
+
def run_batch_infer_script(
|
94 |
+
f0up_key,
|
95 |
+
filter_radius,
|
96 |
+
index_rate,
|
97 |
+
rms_mix_rate,
|
98 |
+
protect,
|
99 |
+
hop_length,
|
100 |
+
f0method,
|
101 |
+
input_folder,
|
102 |
+
output_folder,
|
103 |
+
pth_path,
|
104 |
+
index_path,
|
105 |
+
split_audio,
|
106 |
+
f0autotune,
|
107 |
+
clean_audio,
|
108 |
+
clean_strength,
|
109 |
+
export_format,
|
110 |
+
embedder_model,
|
111 |
+
embedder_model_custom,
|
112 |
+
upscale_audio,
|
113 |
+
):
|
114 |
+
f0autotune = "True" if str(f0autotune) == "True" else "False"
|
115 |
+
clean_audio = "True" if str(clean_audio) == "True" else "False"
|
116 |
+
upscale_audio = "True" if str(upscale_audio) == "True" else "False"
|
117 |
+
audio_files = [
|
118 |
+
f for f in os.listdir(input_folder) if f.endswith((".mp3", ".wav", ".flac"))
|
119 |
+
]
|
120 |
+
print(f"Detected {len(audio_files)} audio files for inference.")
|
121 |
+
|
122 |
+
for audio_file in audio_files:
|
123 |
+
if "_output" in audio_file:
|
124 |
+
pass
|
125 |
+
else:
|
126 |
+
input_path = os.path.join(input_folder, audio_file)
|
127 |
+
output_file_name = os.path.splitext(os.path.basename(audio_file))[0]
|
128 |
+
output_path = os.path.join(
|
129 |
+
output_folder,
|
130 |
+
f"{output_file_name}_output{os.path.splitext(audio_file)[1]}",
|
131 |
+
)
|
132 |
+
print(f"Inferring {input_path}...")
|
133 |
+
|
134 |
+
infer_pipeline(
|
135 |
+
f0up_key,
|
136 |
+
filter_radius,
|
137 |
+
index_rate,
|
138 |
+
rms_mix_rate,
|
139 |
+
protect,
|
140 |
+
hop_length,
|
141 |
+
f0method,
|
142 |
+
input_path,
|
143 |
+
output_path,
|
144 |
+
pth_path,
|
145 |
+
index_path,
|
146 |
+
split_audio,
|
147 |
+
f0autotune,
|
148 |
+
clean_audio,
|
149 |
+
clean_strength,
|
150 |
+
export_format,
|
151 |
+
embedder_model,
|
152 |
+
embedder_model_custom,
|
153 |
+
upscale_audio,
|
154 |
+
)
|
155 |
+
|
156 |
+
return f"Files from {input_folder} inferred successfully."
|
157 |
+
|
158 |
+
|
159 |
+
# TTS
|
160 |
+
def run_tts_script(
|
161 |
+
tts_text,
|
162 |
+
tts_voice,
|
163 |
+
tts_rate,
|
164 |
+
f0up_key,
|
165 |
+
filter_radius,
|
166 |
+
index_rate,
|
167 |
+
rms_mix_rate,
|
168 |
+
protect,
|
169 |
+
hop_length,
|
170 |
+
f0method,
|
171 |
+
output_tts_path,
|
172 |
+
output_rvc_path,
|
173 |
+
pth_path,
|
174 |
+
index_path,
|
175 |
+
split_audio,
|
176 |
+
f0autotune,
|
177 |
+
clean_audio,
|
178 |
+
clean_strength,
|
179 |
+
export_format,
|
180 |
+
embedder_model,
|
181 |
+
embedder_model_custom,
|
182 |
+
upscale_audio,
|
183 |
+
):
|
184 |
+
f0autotune = "True" if str(f0autotune) == "True" else "False"
|
185 |
+
clean_audio = "True" if str(clean_audio) == "True" else "False"
|
186 |
+
upscale_audio = "True" if str(upscale_audio) == "True" else "False"
|
187 |
+
tts_script_path = os.path.join("rvc", "lib", "tools", "tts.py")
|
188 |
+
|
189 |
+
if os.path.exists(output_tts_path):
|
190 |
+
os.remove(output_tts_path)
|
191 |
+
|
192 |
+
command_tts = [
|
193 |
+
"python",
|
194 |
+
tts_script_path,
|
195 |
+
tts_text,
|
196 |
+
tts_voice,
|
197 |
+
str(tts_rate),
|
198 |
+
output_tts_path,
|
199 |
+
]
|
200 |
+
subprocess.run(command_tts)
|
201 |
+
|
202 |
+
infer_pipeline(
|
203 |
+
f0up_key,
|
204 |
+
filter_radius,
|
205 |
+
index_rate,
|
206 |
+
rms_mix_rate,
|
207 |
+
protect,
|
208 |
+
hop_length,
|
209 |
+
f0method,
|
210 |
+
output_tts_path,
|
211 |
+
output_rvc_path,
|
212 |
+
pth_path,
|
213 |
+
index_path,
|
214 |
+
split_audio,
|
215 |
+
f0autotune,
|
216 |
+
clean_audio,
|
217 |
+
clean_strength,
|
218 |
+
export_format,
|
219 |
+
embedder_model,
|
220 |
+
embedder_model_custom,
|
221 |
+
upscale_audio,
|
222 |
+
)
|
223 |
+
|
224 |
+
return f"Text {tts_text} synthesized successfully.", output_rvc_path.replace(
|
225 |
+
".wav", f".{export_format.lower()}"
|
226 |
+
)
|
227 |
+
|
228 |
+
|
229 |
+
# Preprocess
|
230 |
+
def run_preprocess_script(model_name, dataset_path, sampling_rate):
|
231 |
+
per = 3.0 if config.is_half else 3.7
|
232 |
+
preprocess_script_path = os.path.join("rvc", "train", "preprocess", "preprocess.py")
|
233 |
+
command = [
|
234 |
+
"python",
|
235 |
+
preprocess_script_path,
|
236 |
+
*map(
|
237 |
+
str,
|
238 |
+
[
|
239 |
+
os.path.join(logs_path, model_name),
|
240 |
+
dataset_path,
|
241 |
+
sampling_rate,
|
242 |
+
per,
|
243 |
+
],
|
244 |
+
),
|
245 |
+
]
|
246 |
+
|
247 |
+
os.makedirs(os.path.join(logs_path, model_name), exist_ok=True)
|
248 |
+
subprocess.run(command)
|
249 |
+
return f"Model {model_name} preprocessed successfully."
|
250 |
+
|
251 |
+
|
252 |
+
# Extract
|
253 |
+
def run_extract_script(
|
254 |
+
model_name,
|
255 |
+
rvc_version,
|
256 |
+
f0method,
|
257 |
+
hop_length,
|
258 |
+
sampling_rate,
|
259 |
+
embedder_model,
|
260 |
+
embedder_model_custom,
|
261 |
+
):
|
262 |
+
model_path = os.path.join(logs_path, model_name)
|
263 |
+
extract_f0_script_path = os.path.join(
|
264 |
+
"rvc", "train", "extract", "extract_f0_print.py"
|
265 |
+
)
|
266 |
+
extract_feature_script_path = os.path.join(
|
267 |
+
"rvc", "train", "extract", "extract_feature_print.py"
|
268 |
+
)
|
269 |
+
|
270 |
+
command_1 = [
|
271 |
+
"python",
|
272 |
+
extract_f0_script_path,
|
273 |
+
*map(
|
274 |
+
str,
|
275 |
+
[
|
276 |
+
model_path,
|
277 |
+
f0method,
|
278 |
+
hop_length,
|
279 |
+
],
|
280 |
+
),
|
281 |
+
]
|
282 |
+
command_2 = [
|
283 |
+
"python",
|
284 |
+
extract_feature_script_path,
|
285 |
+
*map(
|
286 |
+
str,
|
287 |
+
[
|
288 |
+
config.device,
|
289 |
+
"1",
|
290 |
+
"0",
|
291 |
+
"0",
|
292 |
+
model_path,
|
293 |
+
rvc_version,
|
294 |
+
"True",
|
295 |
+
embedder_model,
|
296 |
+
embedder_model_custom,
|
297 |
+
],
|
298 |
+
),
|
299 |
+
]
|
300 |
+
subprocess.run(command_1)
|
301 |
+
subprocess.run(command_2)
|
302 |
+
|
303 |
+
generate_config(rvc_version, sampling_rate, model_path)
|
304 |
+
generate_filelist(f0method, model_path, rvc_version, sampling_rate)
|
305 |
+
return f"Model {model_name} extracted successfully."
|
306 |
+
|
307 |
+
|
308 |
+
# Train
|
309 |
+
def run_train_script(
|
310 |
+
model_name,
|
311 |
+
rvc_version,
|
312 |
+
save_every_epoch,
|
313 |
+
save_only_latest,
|
314 |
+
save_every_weights,
|
315 |
+
total_epoch,
|
316 |
+
sampling_rate,
|
317 |
+
batch_size,
|
318 |
+
gpu,
|
319 |
+
pitch_guidance,
|
320 |
+
overtraining_detector,
|
321 |
+
overtraining_threshold,
|
322 |
+
pretrained,
|
323 |
+
custom_pretrained,
|
324 |
+
sync_graph,
|
325 |
+
g_pretrained_path=None,
|
326 |
+
d_pretrained_path=None,
|
327 |
+
):
|
328 |
+
f0 = 1 if str(pitch_guidance) == "True" else 0
|
329 |
+
latest = 1 if str(save_only_latest) == "True" else 0
|
330 |
+
save_every = 1 if str(save_every_weights) == "True" else 0
|
331 |
+
detector = 1 if str(overtraining_detector) == "True" else 0
|
332 |
+
sync = 1 if str(sync_graph) == "True" else 0
|
333 |
+
|
334 |
+
if str(pretrained) == "True":
|
335 |
+
if str(custom_pretrained) == "False":
|
336 |
+
pg, pd = pretrained_selector(f0)[rvc_version][sampling_rate]
|
337 |
+
else:
|
338 |
+
if g_pretrained_path is None or d_pretrained_path is None:
|
339 |
+
raise ValueError(
|
340 |
+
"Please provide the path to the pretrained G and D models."
|
341 |
+
)
|
342 |
+
pg, pd = g_pretrained_path, d_pretrained_path
|
343 |
+
else:
|
344 |
+
pg, pd = "", ""
|
345 |
+
|
346 |
+
train_script_path = os.path.join("rvc", "train", "train.py")
|
347 |
+
command = [
|
348 |
+
"python",
|
349 |
+
train_script_path,
|
350 |
+
*map(
|
351 |
+
str,
|
352 |
+
[
|
353 |
+
"-se",
|
354 |
+
save_every_epoch,
|
355 |
+
"-te",
|
356 |
+
total_epoch,
|
357 |
+
"-pg",
|
358 |
+
pg,
|
359 |
+
"-pd",
|
360 |
+
pd,
|
361 |
+
"-sr",
|
362 |
+
sampling_rate,
|
363 |
+
"-bs",
|
364 |
+
batch_size,
|
365 |
+
"-g",
|
366 |
+
gpu,
|
367 |
+
"-e",
|
368 |
+
os.path.join(logs_path, model_name),
|
369 |
+
"-v",
|
370 |
+
rvc_version,
|
371 |
+
"-l",
|
372 |
+
latest,
|
373 |
+
"-c",
|
374 |
+
"0",
|
375 |
+
"-sw",
|
376 |
+
save_every,
|
377 |
+
"-f0",
|
378 |
+
f0,
|
379 |
+
"-od",
|
380 |
+
detector,
|
381 |
+
"-ot",
|
382 |
+
overtraining_threshold,
|
383 |
+
"-sg",
|
384 |
+
sync,
|
385 |
+
],
|
386 |
+
),
|
387 |
+
]
|
388 |
+
|
389 |
+
subprocess.run(command)
|
390 |
+
run_index_script(model_name, rvc_version)
|
391 |
+
return f"Model {model_name} trained successfully."
|
392 |
+
|
393 |
+
|
394 |
+
# Index
|
395 |
+
def run_index_script(model_name, rvc_version):
|
396 |
+
index_script_path = os.path.join("rvc", "train", "process", "extract_index.py")
|
397 |
+
command = [
|
398 |
+
"python",
|
399 |
+
index_script_path,
|
400 |
+
os.path.join(logs_path, model_name),
|
401 |
+
rvc_version,
|
402 |
+
]
|
403 |
+
|
404 |
+
subprocess.run(command)
|
405 |
+
return f"Index file for {model_name} generated successfully."
|
406 |
+
|
407 |
+
|
408 |
+
# Model extract
|
409 |
+
def run_model_extract_script(
|
410 |
+
pth_path, model_name, sampling_rate, pitch_guidance, rvc_version, epoch, step
|
411 |
+
):
|
412 |
+
f0 = 1 if str(pitch_guidance) == "True" else 0
|
413 |
+
extract_small_model(
|
414 |
+
pth_path, model_name, sampling_rate, f0, rvc_version, epoch, step
|
415 |
+
)
|
416 |
+
return f"Model {model_name} extracted successfully."
|
417 |
+
|
418 |
+
|
419 |
+
# Model information
|
420 |
+
def run_model_information_script(pth_path):
|
421 |
+
print(model_information(pth_path))
|
422 |
+
|
423 |
+
|
424 |
+
# Model blender
|
425 |
+
def run_model_blender_script(model_name, pth_path_1, pth_path_2, ratio):
|
426 |
+
message, model_blended = model_blender(model_name, pth_path_1, pth_path_2, ratio)
|
427 |
+
return message, model_blended
|
428 |
+
|
429 |
+
|
430 |
+
# Tensorboard
|
431 |
+
def run_tensorboard_script():
|
432 |
+
launch_tensorboard_pipeline()
|
433 |
+
|
434 |
+
|
435 |
+
# Download
|
436 |
+
def run_download_script(model_link):
|
437 |
+
model_download_pipeline(model_link)
|
438 |
+
return f"Model downloaded successfully."
|
439 |
+
|
440 |
+
|
441 |
+
# Prerequisites
|
442 |
+
def run_prerequisites_script(pretraineds_v1, pretraineds_v2, models, exe):
|
443 |
+
prequisites_download_pipeline(pretraineds_v1, pretraineds_v2, models, exe)
|
444 |
+
return "Prerequisites installed successfully."
|
445 |
+
|
446 |
+
|
447 |
+
# Audio analyzer
|
448 |
+
def run_audio_analyzer_script(input_path, save_plot_path="logs/audio_analysis.png"):
|
449 |
+
audio_info, plot_path = analyze_audio(input_path, save_plot_path)
|
450 |
+
print(
|
451 |
+
f"Audio info of {input_path}: {audio_info}",
|
452 |
+
f"Audio file {input_path} analyzed successfully. Plot saved at: {plot_path}",
|
453 |
+
)
|
454 |
+
return audio_info, plot_path
|
455 |
+
|
456 |
+
|
457 |
+
# API
|
458 |
+
def run_api_script(ip, port):
|
459 |
+
command = [
|
460 |
+
"env/Scripts/uvicorn.exe" if os.name == "nt" else "uvicorn",
|
461 |
+
"api:app",
|
462 |
+
"--host",
|
463 |
+
ip,
|
464 |
+
"--port",
|
465 |
+
port,
|
466 |
+
]
|
467 |
+
subprocess.run(command)
|
468 |
+
|
469 |
+
|
470 |
+
# Parse arguments
|
471 |
+
def parse_arguments():
|
472 |
+
parser = argparse.ArgumentParser(
|
473 |
+
description="Run the main.py script with specific parameters."
|
474 |
+
)
|
475 |
+
subparsers = parser.add_subparsers(
|
476 |
+
title="subcommands", dest="mode", help="Choose a mode"
|
477 |
+
)
|
478 |
+
|
479 |
+
# Parser for 'infer' mode
|
480 |
+
infer_parser = subparsers.add_parser("infer", help="Run inference")
|
481 |
+
infer_parser.add_argument(
|
482 |
+
"--f0up_key",
|
483 |
+
type=str,
|
484 |
+
help="Value for f0up_key",
|
485 |
+
choices=[str(i) for i in range(-24, 25)],
|
486 |
+
default="0",
|
487 |
+
)
|
488 |
+
infer_parser.add_argument(
|
489 |
+
"--filter_radius",
|
490 |
+
type=str,
|
491 |
+
help="Value for filter_radius",
|
492 |
+
choices=[str(i) for i in range(11)],
|
493 |
+
default="3",
|
494 |
+
)
|
495 |
+
infer_parser.add_argument(
|
496 |
+
"--index_rate",
|
497 |
+
type=str,
|
498 |
+
help="Value for index_rate",
|
499 |
+
choices=[str(i / 10) for i in range(11)],
|
500 |
+
default="0.3",
|
501 |
+
)
|
502 |
+
infer_parser.add_argument(
|
503 |
+
"--rms_mix_rate",
|
504 |
+
type=str,
|
505 |
+
help="Value for rms_mix_rate",
|
506 |
+
choices=[str(i / 10) for i in range(11)],
|
507 |
+
default="1",
|
508 |
+
)
|
509 |
+
infer_parser.add_argument(
|
510 |
+
"--protect",
|
511 |
+
type=str,
|
512 |
+
help="Value for protect",
|
513 |
+
choices=[str(i / 10) for i in range(6)],
|
514 |
+
default="0.33",
|
515 |
+
)
|
516 |
+
infer_parser.add_argument(
|
517 |
+
"--hop_length",
|
518 |
+
type=str,
|
519 |
+
help="Value for hop_length",
|
520 |
+
choices=[str(i) for i in range(1, 513)],
|
521 |
+
default="128",
|
522 |
+
)
|
523 |
+
infer_parser.add_argument(
|
524 |
+
"--f0method",
|
525 |
+
type=str,
|
526 |
+
help="Value for f0method",
|
527 |
+
choices=[
|
528 |
+
"pm",
|
529 |
+
"harvest",
|
530 |
+
"dio",
|
531 |
+
"crepe",
|
532 |
+
"crepe-tiny",
|
533 |
+
"rmvpe",
|
534 |
+
"fcpe",
|
535 |
+
"hybrid[crepe+rmvpe]",
|
536 |
+
"hybrid[crepe+fcpe]",
|
537 |
+
"hybrid[rmvpe+fcpe]",
|
538 |
+
"hybrid[crepe+rmvpe+fcpe]",
|
539 |
+
],
|
540 |
+
default="rmvpe",
|
541 |
+
)
|
542 |
+
infer_parser.add_argument("--input_path", type=str, help="Input path")
|
543 |
+
infer_parser.add_argument("--output_path", type=str, help="Output path")
|
544 |
+
infer_parser.add_argument("--pth_path", type=str, help="Path to the .pth file")
|
545 |
+
infer_parser.add_argument(
|
546 |
+
"--index_path",
|
547 |
+
type=str,
|
548 |
+
help="Path to the .index file",
|
549 |
+
)
|
550 |
+
infer_parser.add_argument(
|
551 |
+
"--split_audio",
|
552 |
+
type=str,
|
553 |
+
help="Enable split audio",
|
554 |
+
choices=["True", "False"],
|
555 |
+
default="False",
|
556 |
+
)
|
557 |
+
infer_parser.add_argument(
|
558 |
+
"--f0autotune",
|
559 |
+
type=str,
|
560 |
+
help="Enable autotune",
|
561 |
+
choices=["True", "False"],
|
562 |
+
default="False",
|
563 |
+
)
|
564 |
+
infer_parser.add_argument(
|
565 |
+
"--clean_audio",
|
566 |
+
type=str,
|
567 |
+
help="Enable clean audio",
|
568 |
+
choices=["True", "False"],
|
569 |
+
default="False",
|
570 |
+
)
|
571 |
+
infer_parser.add_argument(
|
572 |
+
"--clean_strength",
|
573 |
+
type=str,
|
574 |
+
help="Value for clean_strength",
|
575 |
+
choices=[str(i / 10) for i in range(11)],
|
576 |
+
default="0.7",
|
577 |
+
)
|
578 |
+
infer_parser.add_argument(
|
579 |
+
"--export_format",
|
580 |
+
type=str,
|
581 |
+
help="Export format",
|
582 |
+
choices=["WAV", "MP3", "FLAC", "OGG", "M4A"],
|
583 |
+
default="WAV",
|
584 |
+
)
|
585 |
+
infer_parser.add_argument(
|
586 |
+
"--embedder_model",
|
587 |
+
type=str,
|
588 |
+
help="Embedder model",
|
589 |
+
choices=["contentvec", "hubert", "custom"],
|
590 |
+
default="hubert",
|
591 |
+
)
|
592 |
+
infer_parser.add_argument(
|
593 |
+
"--embedder_model_custom",
|
594 |
+
type=str,
|
595 |
+
help="Custom Embedder model",
|
596 |
+
default=None,
|
597 |
+
)
|
598 |
+
infer_parser.add_argument(
|
599 |
+
"--upscale_audio",
|
600 |
+
type=str,
|
601 |
+
help="Enable audio upscaling",
|
602 |
+
choices=["True", "False"],
|
603 |
+
default="False",
|
604 |
+
)
|
605 |
+
|
606 |
+
# Parser for 'batch_infer' mode
|
607 |
+
batch_infer_parser = subparsers.add_parser(
|
608 |
+
"batch_infer", help="Run batch inference"
|
609 |
+
)
|
610 |
+
batch_infer_parser.add_argument(
|
611 |
+
"--f0up_key",
|
612 |
+
type=str,
|
613 |
+
help="Value for f0up_key",
|
614 |
+
choices=[str(i) for i in range(-24, 25)],
|
615 |
+
default="0",
|
616 |
+
)
|
617 |
+
batch_infer_parser.add_argument(
|
618 |
+
"--filter_radius",
|
619 |
+
type=str,
|
620 |
+
help="Value for filter_radius",
|
621 |
+
choices=[str(i) for i in range(11)],
|
622 |
+
default="3",
|
623 |
+
)
|
624 |
+
batch_infer_parser.add_argument(
|
625 |
+
"--index_rate",
|
626 |
+
type=str,
|
627 |
+
help="Value for index_rate",
|
628 |
+
choices=[str(i / 10) for i in range(11)],
|
629 |
+
default="0.3",
|
630 |
+
)
|
631 |
+
batch_infer_parser.add_argument(
|
632 |
+
"--rms_mix_rate",
|
633 |
+
type=str,
|
634 |
+
help="Value for rms_mix_rate",
|
635 |
+
choices=[str(i / 10) for i in range(11)],
|
636 |
+
default="1",
|
637 |
+
)
|
638 |
+
batch_infer_parser.add_argument(
|
639 |
+
"--protect",
|
640 |
+
type=str,
|
641 |
+
help="Value for protect",
|
642 |
+
choices=[str(i / 10) for i in range(6)],
|
643 |
+
default="0.33",
|
644 |
+
)
|
645 |
+
batch_infer_parser.add_argument(
|
646 |
+
"--hop_length",
|
647 |
+
type=str,
|
648 |
+
help="Value for hop_length",
|
649 |
+
choices=[str(i) for i in range(1, 513)],
|
650 |
+
default="128",
|
651 |
+
)
|
652 |
+
batch_infer_parser.add_argument(
|
653 |
+
"--f0method",
|
654 |
+
type=str,
|
655 |
+
help="Value for f0method",
|
656 |
+
choices=[
|
657 |
+
"pm",
|
658 |
+
"harvest",
|
659 |
+
"dio",
|
660 |
+
"crepe",
|
661 |
+
"crepe-tiny",
|
662 |
+
"rmvpe",
|
663 |
+
"fcpe",
|
664 |
+
"hybrid[crepe+rmvpe]",
|
665 |
+
"hybrid[crepe+fcpe]",
|
666 |
+
"hybrid[rmvpe+fcpe]",
|
667 |
+
"hybrid[crepe+rmvpe+fcpe]",
|
668 |
+
],
|
669 |
+
default="rmvpe",
|
670 |
+
)
|
671 |
+
batch_infer_parser.add_argument("--input_folder", type=str, help="Input folder")
|
672 |
+
batch_infer_parser.add_argument("--output_folder", type=str, help="Output folder")
|
673 |
+
batch_infer_parser.add_argument(
|
674 |
+
"--pth_path", type=str, help="Path to the .pth file"
|
675 |
+
)
|
676 |
+
batch_infer_parser.add_argument(
|
677 |
+
"--index_path",
|
678 |
+
type=str,
|
679 |
+
help="Path to the .index file",
|
680 |
+
)
|
681 |
+
batch_infer_parser.add_argument(
|
682 |
+
"--split_audio",
|
683 |
+
type=str,
|
684 |
+
help="Enable split audio",
|
685 |
+
choices=["True", "False"],
|
686 |
+
default="False",
|
687 |
+
)
|
688 |
+
batch_infer_parser.add_argument(
|
689 |
+
"--f0autotune",
|
690 |
+
type=str,
|
691 |
+
help="Enable autotune",
|
692 |
+
choices=["True", "False"],
|
693 |
+
default="False",
|
694 |
+
)
|
695 |
+
batch_infer_parser.add_argument(
|
696 |
+
"--clean_audio",
|
697 |
+
type=str,
|
698 |
+
help="Enable clean audio",
|
699 |
+
choices=["True", "False"],
|
700 |
+
default="False",
|
701 |
+
)
|
702 |
+
batch_infer_parser.add_argument(
|
703 |
+
"--clean_strength",
|
704 |
+
type=str,
|
705 |
+
help="Value for clean_strength",
|
706 |
+
choices=[str(i / 10) for i in range(11)],
|
707 |
+
default="0.7",
|
708 |
+
)
|
709 |
+
batch_infer_parser.add_argument(
|
710 |
+
"--export_format",
|
711 |
+
type=str,
|
712 |
+
help="Export format",
|
713 |
+
choices=["WAV", "MP3", "FLAC", "OGG", "M4A"],
|
714 |
+
default="WAV",
|
715 |
+
)
|
716 |
+
batch_infer_parser.add_argument(
|
717 |
+
"--embedder_model",
|
718 |
+
type=str,
|
719 |
+
help="Embedder model",
|
720 |
+
choices=["contentvec", "hubert", "custom"],
|
721 |
+
default="hubert",
|
722 |
+
)
|
723 |
+
batch_infer_parser.add_argument(
|
724 |
+
"--embedder_model_custom",
|
725 |
+
type=str,
|
726 |
+
help="Custom Embedder model",
|
727 |
+
default=None,
|
728 |
+
)
|
729 |
+
batch_infer_parser.add_argument(
|
730 |
+
"--upscale_audio",
|
731 |
+
type=str,
|
732 |
+
help="Enable audio upscaling",
|
733 |
+
choices=["True", "False"],
|
734 |
+
default="False",
|
735 |
+
)
|
736 |
+
|
737 |
+
# Parser for 'tts' mode
|
738 |
+
tts_parser = subparsers.add_parser("tts", help="Run TTS")
|
739 |
+
tts_parser.add_argument(
|
740 |
+
"--tts_text",
|
741 |
+
type=str,
|
742 |
+
help="Text to be synthesized",
|
743 |
+
)
|
744 |
+
tts_parser.add_argument(
|
745 |
+
"--tts_voice",
|
746 |
+
type=str,
|
747 |
+
help="Voice to be used",
|
748 |
+
choices=locales,
|
749 |
+
)
|
750 |
+
tts_parser.add_argument(
|
751 |
+
"--tts_rate",
|
752 |
+
type=str,
|
753 |
+
help="Increase or decrease TTS speed",
|
754 |
+
choices=[str(i) for i in range(-100, 100)],
|
755 |
+
default="0",
|
756 |
+
)
|
757 |
+
tts_parser.add_argument(
|
758 |
+
"--f0up_key",
|
759 |
+
type=str,
|
760 |
+
help="Value for f0up_key",
|
761 |
+
choices=[str(i) for i in range(-24, 25)],
|
762 |
+
default="0",
|
763 |
+
)
|
764 |
+
tts_parser.add_argument(
|
765 |
+
"--filter_radius",
|
766 |
+
type=str,
|
767 |
+
help="Value for filter_radius",
|
768 |
+
choices=[str(i) for i in range(11)],
|
769 |
+
default="3",
|
770 |
+
)
|
771 |
+
tts_parser.add_argument(
|
772 |
+
"--index_rate",
|
773 |
+
type=str,
|
774 |
+
help="Value for index_rate",
|
775 |
+
choices=[str(i / 10) for i in range(11)],
|
776 |
+
default="0.3",
|
777 |
+
)
|
778 |
+
tts_parser.add_argument(
|
779 |
+
"--rms_mix_rate",
|
780 |
+
type=str,
|
781 |
+
help="Value for rms_mix_rate",
|
782 |
+
choices=[str(i / 10) for i in range(11)],
|
783 |
+
default="1",
|
784 |
+
)
|
785 |
+
tts_parser.add_argument(
|
786 |
+
"--protect",
|
787 |
+
type=str,
|
788 |
+
help="Value for protect",
|
789 |
+
choices=[str(i / 10) for i in range(6)],
|
790 |
+
default="0.33",
|
791 |
+
)
|
792 |
+
tts_parser.add_argument(
|
793 |
+
"--hop_length",
|
794 |
+
type=str,
|
795 |
+
help="Value for hop_length",
|
796 |
+
choices=[str(i) for i in range(1, 513)],
|
797 |
+
default="128",
|
798 |
+
)
|
799 |
+
tts_parser.add_argument(
|
800 |
+
"--f0method",
|
801 |
+
type=str,
|
802 |
+
help="Value for f0method",
|
803 |
+
choices=[
|
804 |
+
"pm",
|
805 |
+
"harvest",
|
806 |
+
"dio",
|
807 |
+
"crepe",
|
808 |
+
"crepe-tiny",
|
809 |
+
"rmvpe",
|
810 |
+
"fcpe",
|
811 |
+
"hybrid[crepe+rmvpe]",
|
812 |
+
"hybrid[crepe+fcpe]",
|
813 |
+
"hybrid[rmvpe+fcpe]",
|
814 |
+
"hybrid[crepe+rmvpe+fcpe]",
|
815 |
+
],
|
816 |
+
default="rmvpe",
|
817 |
+
)
|
818 |
+
tts_parser.add_argument("--output_tts_path", type=str, help="Output tts path")
|
819 |
+
tts_parser.add_argument("--output_rvc_path", type=str, help="Output rvc path")
|
820 |
+
tts_parser.add_argument("--pth_path", type=str, help="Path to the .pth file")
|
821 |
+
tts_parser.add_argument(
|
822 |
+
"--index_path",
|
823 |
+
type=str,
|
824 |
+
help="Path to the .index file",
|
825 |
+
)
|
826 |
+
tts_parser.add_argument(
|
827 |
+
"--split_audio",
|
828 |
+
type=str,
|
829 |
+
help="Enable split audio",
|
830 |
+
choices=["True", "False"],
|
831 |
+
default="False",
|
832 |
+
)
|
833 |
+
tts_parser.add_argument(
|
834 |
+
"--f0autotune",
|
835 |
+
type=str,
|
836 |
+
help="Enable autotune",
|
837 |
+
choices=["True", "False"],
|
838 |
+
default="False",
|
839 |
+
)
|
840 |
+
tts_parser.add_argument(
|
841 |
+
"--clean_audio",
|
842 |
+
type=str,
|
843 |
+
help="Enable clean audio",
|
844 |
+
choices=["True", "False"],
|
845 |
+
default="False",
|
846 |
+
)
|
847 |
+
tts_parser.add_argument(
|
848 |
+
"--clean_strength",
|
849 |
+
type=str,
|
850 |
+
help="Value for clean_strength",
|
851 |
+
choices=[str(i / 10) for i in range(11)],
|
852 |
+
default="0.7",
|
853 |
+
)
|
854 |
+
tts_parser.add_argument(
|
855 |
+
"--export_format",
|
856 |
+
type=str,
|
857 |
+
help="Export format",
|
858 |
+
choices=["WAV", "MP3", "FLAC", "OGG", "M4A"],
|
859 |
+
default="WAV",
|
860 |
+
)
|
861 |
+
tts_parser.add_argument(
|
862 |
+
"--embedder_model",
|
863 |
+
type=str,
|
864 |
+
help="Embedder model",
|
865 |
+
choices=["contentvec", "hubert", "custom"],
|
866 |
+
default="hubert",
|
867 |
+
)
|
868 |
+
tts_parser.add_argument(
|
869 |
+
"--embedder_model_custom",
|
870 |
+
type=str,
|
871 |
+
help="Custom Embedder model",
|
872 |
+
default=None,
|
873 |
+
)
|
874 |
+
tts_parser.add_argument(
|
875 |
+
"--upscale_audio",
|
876 |
+
type=str,
|
877 |
+
help="Enable audio upscaling",
|
878 |
+
choices=["True", "False"],
|
879 |
+
default="False",
|
880 |
+
)
|
881 |
+
|
882 |
+
# Parser for 'preprocess' mode
|
883 |
+
preprocess_parser = subparsers.add_parser("preprocess", help="Run preprocessing")
|
884 |
+
preprocess_parser.add_argument("--model_name", type=str, help="Name of the model")
|
885 |
+
preprocess_parser.add_argument(
|
886 |
+
"--dataset_path",
|
887 |
+
type=str,
|
888 |
+
help="Path to the dataset",
|
889 |
+
)
|
890 |
+
preprocess_parser.add_argument(
|
891 |
+
"--sampling_rate",
|
892 |
+
type=str,
|
893 |
+
help="Sampling rate",
|
894 |
+
choices=["32000", "40000", "48000"],
|
895 |
+
)
|
896 |
+
|
897 |
+
# Parser for 'extract' mode
|
898 |
+
extract_parser = subparsers.add_parser("extract", help="Run extract")
|
899 |
+
extract_parser.add_argument(
|
900 |
+
"--model_name",
|
901 |
+
type=str,
|
902 |
+
help="Name of the model",
|
903 |
+
)
|
904 |
+
extract_parser.add_argument(
|
905 |
+
"--rvc_version",
|
906 |
+
type=str,
|
907 |
+
help="Version of the model",
|
908 |
+
choices=["v1", "v2"],
|
909 |
+
default="v2",
|
910 |
+
)
|
911 |
+
extract_parser.add_argument(
|
912 |
+
"--f0method",
|
913 |
+
type=str,
|
914 |
+
help="Value for f0method",
|
915 |
+
choices=[
|
916 |
+
"pm",
|
917 |
+
"harvest",
|
918 |
+
"dio",
|
919 |
+
"crepe",
|
920 |
+
"crepe-tiny",
|
921 |
+
"rmvpe",
|
922 |
+
],
|
923 |
+
default="rmvpe",
|
924 |
+
)
|
925 |
+
extract_parser.add_argument(
|
926 |
+
"--hop_length",
|
927 |
+
type=str,
|
928 |
+
help="Value for hop_length",
|
929 |
+
choices=[str(i) for i in range(1, 513)],
|
930 |
+
default="128",
|
931 |
+
)
|
932 |
+
extract_parser.add_argument(
|
933 |
+
"--sampling_rate",
|
934 |
+
type=str,
|
935 |
+
help="Sampling rate",
|
936 |
+
choices=["32000", "40000", "48000"],
|
937 |
+
)
|
938 |
+
extract_parser.add_argument(
|
939 |
+
"--embedder_model",
|
940 |
+
type=str,
|
941 |
+
help="Embedder model",
|
942 |
+
choices=["contentvec", "hubert", "custom"],
|
943 |
+
default="hubert",
|
944 |
+
)
|
945 |
+
extract_parser.add_argument(
|
946 |
+
"--embedder_model_custom",
|
947 |
+
type=str,
|
948 |
+
help="Custom Embedder model",
|
949 |
+
default=None,
|
950 |
+
)
|
951 |
+
|
952 |
+
# Parser for 'train' mode
|
953 |
+
train_parser = subparsers.add_parser("train", help="Run training")
|
954 |
+
train_parser.add_argument(
|
955 |
+
"--model_name",
|
956 |
+
type=str,
|
957 |
+
help="Name of the model",
|
958 |
+
)
|
959 |
+
train_parser.add_argument(
|
960 |
+
"--rvc_version",
|
961 |
+
type=str,
|
962 |
+
help="Version of the model",
|
963 |
+
choices=["v1", "v2"],
|
964 |
+
default="v2",
|
965 |
+
)
|
966 |
+
train_parser.add_argument(
|
967 |
+
"--save_every_epoch",
|
968 |
+
type=str,
|
969 |
+
help="Save every epoch",
|
970 |
+
choices=[str(i) for i in range(1, 101)],
|
971 |
+
)
|
972 |
+
train_parser.add_argument(
|
973 |
+
"--save_only_latest",
|
974 |
+
type=str,
|
975 |
+
help="Save weight only at last epoch",
|
976 |
+
choices=["True", "False"],
|
977 |
+
default="False",
|
978 |
+
)
|
979 |
+
train_parser.add_argument(
|
980 |
+
"--save_every_weights",
|
981 |
+
type=str,
|
982 |
+
help="Save weight every epoch",
|
983 |
+
choices=["True", "False"],
|
984 |
+
default="True",
|
985 |
+
)
|
986 |
+
train_parser.add_argument(
|
987 |
+
"--total_epoch",
|
988 |
+
type=str,
|
989 |
+
help="Total epoch",
|
990 |
+
choices=[str(i) for i in range(1, 10001)],
|
991 |
+
default="1000",
|
992 |
+
)
|
993 |
+
train_parser.add_argument(
|
994 |
+
"--sampling_rate",
|
995 |
+
type=str,
|
996 |
+
help="Sampling rate",
|
997 |
+
choices=["32000", "40000", "48000"],
|
998 |
+
)
|
999 |
+
train_parser.add_argument(
|
1000 |
+
"--batch_size",
|
1001 |
+
type=str,
|
1002 |
+
help="Batch size",
|
1003 |
+
choices=[str(i) for i in range(1, 51)],
|
1004 |
+
default="8",
|
1005 |
+
)
|
1006 |
+
train_parser.add_argument(
|
1007 |
+
"--gpu",
|
1008 |
+
type=str,
|
1009 |
+
help="GPU number",
|
1010 |
+
default="0",
|
1011 |
+
)
|
1012 |
+
train_parser.add_argument(
|
1013 |
+
"--pitch_guidance",
|
1014 |
+
type=str,
|
1015 |
+
help="Pitch guidance",
|
1016 |
+
choices=["True", "False"],
|
1017 |
+
default="True",
|
1018 |
+
)
|
1019 |
+
train_parser.add_argument(
|
1020 |
+
"--pretrained",
|
1021 |
+
type=str,
|
1022 |
+
help="Pretrained",
|
1023 |
+
choices=["True", "False"],
|
1024 |
+
default="True",
|
1025 |
+
)
|
1026 |
+
train_parser.add_argument(
|
1027 |
+
"--custom_pretrained",
|
1028 |
+
type=str,
|
1029 |
+
help="Custom pretrained",
|
1030 |
+
choices=["True", "False"],
|
1031 |
+
default="False",
|
1032 |
+
)
|
1033 |
+
train_parser.add_argument(
|
1034 |
+
"--g_pretrained_path",
|
1035 |
+
type=str,
|
1036 |
+
nargs="?",
|
1037 |
+
default=None,
|
1038 |
+
help="Path to the pretrained G file",
|
1039 |
+
)
|
1040 |
+
train_parser.add_argument(
|
1041 |
+
"--d_pretrained_path",
|
1042 |
+
type=str,
|
1043 |
+
nargs="?",
|
1044 |
+
default=None,
|
1045 |
+
help="Path to the pretrained D file",
|
1046 |
+
)
|
1047 |
+
train_parser.add_argument(
|
1048 |
+
"--overtraining_detector",
|
1049 |
+
type=str,
|
1050 |
+
help="Overtraining detector",
|
1051 |
+
choices=["True", "False"],
|
1052 |
+
default="False",
|
1053 |
+
)
|
1054 |
+
train_parser.add_argument(
|
1055 |
+
"--overtraining_threshold",
|
1056 |
+
type=str,
|
1057 |
+
help="Overtraining threshold",
|
1058 |
+
choices=[str(i) for i in range(1, 101)],
|
1059 |
+
default="50",
|
1060 |
+
)
|
1061 |
+
train_parser.add_argument(
|
1062 |
+
"--sync_graph",
|
1063 |
+
type=str,
|
1064 |
+
help="Sync graph",
|
1065 |
+
choices=["True", "False"],
|
1066 |
+
default="False",
|
1067 |
+
)
|
1068 |
+
|
1069 |
+
# Parser for 'index' mode
|
1070 |
+
index_parser = subparsers.add_parser("index", help="Generate index file")
|
1071 |
+
index_parser.add_argument(
|
1072 |
+
"--model_name",
|
1073 |
+
type=str,
|
1074 |
+
help="Name of the model",
|
1075 |
+
)
|
1076 |
+
index_parser.add_argument(
|
1077 |
+
"--rvc_version",
|
1078 |
+
type=str,
|
1079 |
+
help="Version of the model",
|
1080 |
+
choices=["v1", "v2"],
|
1081 |
+
default="v2",
|
1082 |
+
)
|
1083 |
+
|
1084 |
+
# Parser for 'model_extract' mode
|
1085 |
+
model_extract_parser = subparsers.add_parser("model_extract", help="Extract model")
|
1086 |
+
model_extract_parser.add_argument(
|
1087 |
+
"--pth_path",
|
1088 |
+
type=str,
|
1089 |
+
help="Path to the .pth file",
|
1090 |
+
)
|
1091 |
+
model_extract_parser.add_argument(
|
1092 |
+
"--model_name",
|
1093 |
+
type=str,
|
1094 |
+
help="Name of the model",
|
1095 |
+
)
|
1096 |
+
model_extract_parser.add_argument(
|
1097 |
+
"--sampling_rate",
|
1098 |
+
type=str,
|
1099 |
+
help="Sampling rate",
|
1100 |
+
choices=["40000", "48000"],
|
1101 |
+
)
|
1102 |
+
model_extract_parser.add_argument(
|
1103 |
+
"--pitch_guidance",
|
1104 |
+
type=str,
|
1105 |
+
help="Pitch guidance",
|
1106 |
+
choices=["True", "False"],
|
1107 |
+
)
|
1108 |
+
model_extract_parser.add_argument(
|
1109 |
+
"--rvc_version",
|
1110 |
+
type=str,
|
1111 |
+
help="Version of the model",
|
1112 |
+
choices=["v1", "v2"],
|
1113 |
+
default="v2",
|
1114 |
+
)
|
1115 |
+
model_extract_parser.add_argument(
|
1116 |
+
"--epoch",
|
1117 |
+
type=str,
|
1118 |
+
help="Epochs of the model",
|
1119 |
+
choices=[str(i) for i in range(1, 10001)],
|
1120 |
+
)
|
1121 |
+
model_extract_parser.add_argument(
|
1122 |
+
"--step",
|
1123 |
+
type=str,
|
1124 |
+
help="Steps of the model",
|
1125 |
+
)
|
1126 |
+
|
1127 |
+
# Parser for 'model_information' mode
|
1128 |
+
model_information_parser = subparsers.add_parser(
|
1129 |
+
"model_information", help="Print model information"
|
1130 |
+
)
|
1131 |
+
model_information_parser.add_argument(
|
1132 |
+
"--pth_path",
|
1133 |
+
type=str,
|
1134 |
+
help="Path to the .pth file",
|
1135 |
+
)
|
1136 |
+
|
1137 |
+
# Parser for 'model_blender' mode
|
1138 |
+
model_blender_parser = subparsers.add_parser(
|
1139 |
+
"model_blender", help="Fuse two models"
|
1140 |
+
)
|
1141 |
+
model_blender_parser.add_argument(
|
1142 |
+
"--model_name",
|
1143 |
+
type=str,
|
1144 |
+
help="Name of the model",
|
1145 |
+
)
|
1146 |
+
model_blender_parser.add_argument(
|
1147 |
+
"--pth_path_1",
|
1148 |
+
type=str,
|
1149 |
+
help="Path to the first .pth file",
|
1150 |
+
)
|
1151 |
+
model_blender_parser.add_argument(
|
1152 |
+
"--pth_path_2",
|
1153 |
+
type=str,
|
1154 |
+
help="Path to the second .pth file",
|
1155 |
+
)
|
1156 |
+
model_blender_parser.add_argument(
|
1157 |
+
"--ratio",
|
1158 |
+
type=str,
|
1159 |
+
help="Value for blender ratio",
|
1160 |
+
choices=[str(i / 10) for i in range(11)],
|
1161 |
+
default="0.5",
|
1162 |
+
)
|
1163 |
+
|
1164 |
+
# Parser for 'tensorboard' mode
|
1165 |
+
subparsers.add_parser("tensorboard", help="Run tensorboard")
|
1166 |
+
|
1167 |
+
# Parser for 'download' mode
|
1168 |
+
download_parser = subparsers.add_parser("download", help="Download models")
|
1169 |
+
download_parser.add_argument(
|
1170 |
+
"--model_link",
|
1171 |
+
type=str,
|
1172 |
+
help="Link of the model",
|
1173 |
+
)
|
1174 |
+
|
1175 |
+
# Parser for 'prerequisites' mode
|
1176 |
+
prerequisites_parser = subparsers.add_parser(
|
1177 |
+
"prerequisites", help="Install prerequisites"
|
1178 |
+
)
|
1179 |
+
prerequisites_parser.add_argument(
|
1180 |
+
"--pretraineds_v1",
|
1181 |
+
type=str,
|
1182 |
+
choices=["True", "False"],
|
1183 |
+
default="True",
|
1184 |
+
help="Download pretrained models for v1",
|
1185 |
+
)
|
1186 |
+
prerequisites_parser.add_argument(
|
1187 |
+
"--pretraineds_v2",
|
1188 |
+
type=str,
|
1189 |
+
choices=["True", "False"],
|
1190 |
+
default="True",
|
1191 |
+
help="Download pretrained models for v2",
|
1192 |
+
)
|
1193 |
+
prerequisites_parser.add_argument(
|
1194 |
+
"--models",
|
1195 |
+
type=str,
|
1196 |
+
choices=["True", "False"],
|
1197 |
+
default="True",
|
1198 |
+
help="Donwload models",
|
1199 |
+
)
|
1200 |
+
prerequisites_parser.add_argument(
|
1201 |
+
"--exe",
|
1202 |
+
type=str,
|
1203 |
+
choices=["True", "False"],
|
1204 |
+
default="True",
|
1205 |
+
help="Download executables",
|
1206 |
+
)
|
1207 |
+
|
1208 |
+
# Parser for 'audio_analyzer' mode
|
1209 |
+
audio_analyzer = subparsers.add_parser("audio_analyzer", help="Run audio analyzer")
|
1210 |
+
audio_analyzer.add_argument(
|
1211 |
+
"--input_path",
|
1212 |
+
type=str,
|
1213 |
+
help="Path to the input audio file",
|
1214 |
+
)
|
1215 |
+
|
1216 |
+
# Parser for 'api' mode
|
1217 |
+
api_parser = subparsers.add_parser("api", help="Run the API")
|
1218 |
+
api_parser.add_argument(
|
1219 |
+
"--host", type=str, help="Host address", default="127.0.0.1"
|
1220 |
+
)
|
1221 |
+
api_parser.add_argument("--port", type=str, help="Port", default="8000")
|
1222 |
+
|
1223 |
+
return parser.parse_args()
|
1224 |
+
|
1225 |
+
|
1226 |
+
def main():
|
1227 |
+
if len(sys.argv) == 1:
|
1228 |
+
print("Please run the script with '-h' for more information.")
|
1229 |
+
sys.exit(1)
|
1230 |
+
|
1231 |
+
args = parse_arguments()
|
1232 |
+
|
1233 |
+
try:
|
1234 |
+
if args.mode == "infer":
|
1235 |
+
run_infer_script(
|
1236 |
+
str(args.f0up_key),
|
1237 |
+
str(args.filter_radius),
|
1238 |
+
str(args.index_rate),
|
1239 |
+
str(args.rms_mix_rate),
|
1240 |
+
str(args.protect),
|
1241 |
+
str(args.hop_length),
|
1242 |
+
str(args.f0method),
|
1243 |
+
str(args.input_path),
|
1244 |
+
str(args.output_path),
|
1245 |
+
str(args.pth_path),
|
1246 |
+
str(args.index_path),
|
1247 |
+
str(args.split_audio),
|
1248 |
+
str(args.f0autotune),
|
1249 |
+
str(args.clean_audio),
|
1250 |
+
str(args.clean_strength),
|
1251 |
+
str(args.export_format),
|
1252 |
+
str(args.embedder_model),
|
1253 |
+
str(args.embedder_model_custom),
|
1254 |
+
str(args.upscale_audio),
|
1255 |
+
)
|
1256 |
+
elif args.mode == "batch_infer":
|
1257 |
+
run_batch_infer_script(
|
1258 |
+
str(args.f0up_key),
|
1259 |
+
str(args.filter_radius),
|
1260 |
+
str(args.index_rate),
|
1261 |
+
str(args.rms_mix_rate),
|
1262 |
+
str(args.protect),
|
1263 |
+
str(args.hop_length),
|
1264 |
+
str(args.f0method),
|
1265 |
+
str(args.input_folder),
|
1266 |
+
str(args.output_folder),
|
1267 |
+
str(args.pth_path),
|
1268 |
+
str(args.index_path),
|
1269 |
+
str(args.split_audio),
|
1270 |
+
str(args.f0autotune),
|
1271 |
+
str(args.clean_audio),
|
1272 |
+
str(args.clean_strength),
|
1273 |
+
str(args.export_format),
|
1274 |
+
str(args.embedder_model),
|
1275 |
+
str(args.embedder_model_custom),
|
1276 |
+
str(args.upscale_audio),
|
1277 |
+
)
|
1278 |
+
elif args.mode == "tts":
|
1279 |
+
run_tts_script(
|
1280 |
+
str(args.tts_text),
|
1281 |
+
str(args.tts_voice),
|
1282 |
+
str(args.tts_rate),
|
1283 |
+
str(args.f0up_key),
|
1284 |
+
str(args.filter_radius),
|
1285 |
+
str(args.index_rate),
|
1286 |
+
str(args.rms_mix_rate),
|
1287 |
+
str(args.protect),
|
1288 |
+
str(args.hop_length),
|
1289 |
+
str(args.f0method),
|
1290 |
+
str(args.output_tts_path),
|
1291 |
+
str(args.output_rvc_path),
|
1292 |
+
str(args.pth_path),
|
1293 |
+
str(args.index_path),
|
1294 |
+
str(args.split_audio),
|
1295 |
+
str(args.f0autotune),
|
1296 |
+
str(args.clean_audio),
|
1297 |
+
str(args.clean_strength),
|
1298 |
+
str(args.export_format),
|
1299 |
+
str(args.embedder_model),
|
1300 |
+
str(args.embedder_model_custom),
|
1301 |
+
str(args.upscale_audio),
|
1302 |
+
)
|
1303 |
+
elif args.mode == "preprocess":
|
1304 |
+
run_preprocess_script(
|
1305 |
+
str(args.model_name),
|
1306 |
+
str(args.dataset_path),
|
1307 |
+
str(args.sampling_rate),
|
1308 |
+
)
|
1309 |
+
elif args.mode == "extract":
|
1310 |
+
run_extract_script(
|
1311 |
+
str(args.model_name),
|
1312 |
+
str(args.rvc_version),
|
1313 |
+
str(args.f0method),
|
1314 |
+
str(args.hop_length),
|
1315 |
+
str(args.sampling_rate),
|
1316 |
+
str(args.embedder_model),
|
1317 |
+
str(args.embedder_model_custom),
|
1318 |
+
)
|
1319 |
+
elif args.mode == "train":
|
1320 |
+
run_train_script(
|
1321 |
+
str(args.model_name),
|
1322 |
+
str(args.rvc_version),
|
1323 |
+
str(args.save_every_epoch),
|
1324 |
+
str(args.save_only_latest),
|
1325 |
+
str(args.save_every_weights),
|
1326 |
+
str(args.total_epoch),
|
1327 |
+
str(args.sampling_rate),
|
1328 |
+
str(args.batch_size),
|
1329 |
+
str(args.gpu),
|
1330 |
+
str(args.pitch_guidance),
|
1331 |
+
str(args.overtraining_detector),
|
1332 |
+
str(args.overtraining_threshold),
|
1333 |
+
str(args.pretrained),
|
1334 |
+
str(args.custom_pretrained),
|
1335 |
+
str(args.sync_graph),
|
1336 |
+
str(args.g_pretrained_path),
|
1337 |
+
str(args.d_pretrained_path),
|
1338 |
+
)
|
1339 |
+
elif args.mode == "index":
|
1340 |
+
run_index_script(
|
1341 |
+
str(args.model_name),
|
1342 |
+
str(args.rvc_version),
|
1343 |
+
)
|
1344 |
+
elif args.mode == "model_extract":
|
1345 |
+
run_model_extract_script(
|
1346 |
+
str(args.pth_path),
|
1347 |
+
str(args.model_name),
|
1348 |
+
str(args.sampling_rate),
|
1349 |
+
str(args.pitch_guidance),
|
1350 |
+
str(args.rvc_version),
|
1351 |
+
str(args.epoch),
|
1352 |
+
str(args.step),
|
1353 |
+
)
|
1354 |
+
elif args.mode == "model_information":
|
1355 |
+
run_model_information_script(
|
1356 |
+
str(args.pth_path),
|
1357 |
+
)
|
1358 |
+
elif args.mode == "model_blender":
|
1359 |
+
run_model_blender_script(
|
1360 |
+
str(args.model_name),
|
1361 |
+
str(args.pth_path_1),
|
1362 |
+
str(args.pth_path_2),
|
1363 |
+
str(args.ratio),
|
1364 |
+
)
|
1365 |
+
elif args.mode == "tensorboard":
|
1366 |
+
run_tensorboard_script()
|
1367 |
+
elif args.mode == "download":
|
1368 |
+
run_download_script(
|
1369 |
+
str(args.model_link),
|
1370 |
+
)
|
1371 |
+
elif args.mode == "prerequisites":
|
1372 |
+
run_prerequisites_script(
|
1373 |
+
str(args.pretraineds_v1),
|
1374 |
+
str(args.pretraineds_v2),
|
1375 |
+
str(args.models),
|
1376 |
+
str(args.exe),
|
1377 |
+
)
|
1378 |
+
elif args.mode == "audio_analyzer":
|
1379 |
+
run_audio_analyzer_script(
|
1380 |
+
str(args.input_path),
|
1381 |
+
)
|
1382 |
+
elif args.mode == "api":
|
1383 |
+
run_api_script(
|
1384 |
+
str(args.host),
|
1385 |
+
str(args.port),
|
1386 |
+
)
|
1387 |
+
except Exception as error:
|
1388 |
+
print(f"Error: {error}")
|
1389 |
+
|
1390 |
+
|
1391 |
+
if __name__ == "__main__":
|
1392 |
+
main()
|