Spaces:
Running on L4
Running on L4
wanglamao commited on
Commit ·
96f5261
1
Parent(s): 71d4610
vc add default sampling param
Browse files- gpa_inference.py +9 -2
gpa_inference.py
CHANGED
|
@@ -31,7 +31,7 @@ class GPAInference:
|
|
| 31 |
self.text_tokenizer_path = text_tokenizer_path
|
| 32 |
self.bicodec_tokenizer_path = bicodec_tokenizer_path
|
| 33 |
self.gpa_model_path = gpa_model_path
|
| 34 |
-
|
| 35 |
# Use temporary directory if output_dir is None
|
| 36 |
if output_dir is None:
|
| 37 |
self.output_dir = tempfile.mkdtemp()
|
|
@@ -39,7 +39,7 @@ class GPAInference:
|
|
| 39 |
else:
|
| 40 |
self.output_dir = output_dir
|
| 41 |
os.makedirs(self.output_dir, exist_ok=True)
|
| 42 |
-
|
| 43 |
self.device = device
|
| 44 |
|
| 45 |
print(f"Using device: {self.device}")
|
|
@@ -220,6 +220,13 @@ class GPAInference:
|
|
| 220 |
print("\n--- Voice Conversion (VC) ---")
|
| 221 |
output_path = os.path.join(self.output_dir, output_filename)
|
| 222 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 223 |
inputs = self.processor.process_input(
|
| 224 |
task="vc",
|
| 225 |
audio_path=source_audio_path,
|
|
|
|
| 31 |
self.text_tokenizer_path = text_tokenizer_path
|
| 32 |
self.bicodec_tokenizer_path = bicodec_tokenizer_path
|
| 33 |
self.gpa_model_path = gpa_model_path
|
| 34 |
+
|
| 35 |
# Use temporary directory if output_dir is None
|
| 36 |
if output_dir is None:
|
| 37 |
self.output_dir = tempfile.mkdtemp()
|
|
|
|
| 39 |
else:
|
| 40 |
self.output_dir = output_dir
|
| 41 |
os.makedirs(self.output_dir, exist_ok=True)
|
| 42 |
+
|
| 43 |
self.device = device
|
| 44 |
|
| 45 |
print(f"Using device: {self.device}")
|
|
|
|
| 220 |
print("\n--- Voice Conversion (VC) ---")
|
| 221 |
output_path = os.path.join(self.output_dir, output_filename)
|
| 222 |
|
| 223 |
+
kwargs = {
|
| 224 |
+
"max_new_tokens": 512,
|
| 225 |
+
"temperature": 0.2,
|
| 226 |
+
"repetition_penalty": 1.2,
|
| 227 |
+
"do_sample": True,
|
| 228 |
+
}
|
| 229 |
+
|
| 230 |
inputs = self.processor.process_input(
|
| 231 |
task="vc",
|
| 232 |
audio_path=source_audio_path,
|