Merge branch 'SillyTavern:neo' into neo

This commit is contained in:
Tony Ribeiro
2023-08-14 04:01:46 +02:00
committed by GitHub
4 changed files with 19 additions and 19 deletions

View File

@@ -66,7 +66,7 @@ class Config:
or "1070" in self.gpu_name
or "1080" in self.gpu_name
):
print("16/10系显卡和P40强制单精度")
print("Forcing full precision for 16/10 series cards.")
self.is_half = False
config_file_change_fp32()
else:
@@ -84,12 +84,12 @@ class Config:
# with open("trainset_preprocess_pipeline_print.py", "w") as f:
# f.write(strr)
elif torch.backends.mps.is_available():
print("没有发现支持的N卡, 使用MPS进行推理")
print("No compatible GPU found, using MPS for inference.")
self.device = "mps"
self.is_half = False
config_file_change_fp32()
else:
print("没有发现支持的N卡, 使用CPU进行推理")
print("No compatible GPU found, using CPU for inference.")
self.device = "cpu"
self.is_half = False
config_file_change_fp32()
@@ -150,7 +150,7 @@ def load_audio(audio_source, sr):
elif isinstance(audio_source, io.BytesIO): # If it's a BytesIO object
audio_source.seek(0)
out, _ = (
ffmpeg.input("pipe:0", format="wav", threads=0)
ffmpeg.input("pipe:0", threads=0)
.output("-", format="f32le", acodec="pcm_f32le", ac=1, ar=sr)
.run(input=audio_source.read(), cmd=["ffmpeg", "-nostdin"], capture_stdout=True, capture_stderr=True)
)

View File

@@ -115,7 +115,7 @@ class VC(object):
) + 1
f0_mel[f0_mel <= 1] = 1
f0_mel[f0_mel > 255] = 255
f0_coarse = np.rint(f0_mel).astype(np.int)
f0_coarse = np.rint(f0_mel).astype(int)
return f0_coarse, f0bak # 1-0
def vc(

View File

@@ -371,7 +371,7 @@ if "streaming-stt" in modules:
if "rvc" in modules:
print("Initializing RVC voice conversion (from ST request file)")
import sys
sys.path.insert(0,'modules/voice_conversion')

View File

@@ -18,7 +18,7 @@ from TTS.tts.models.tortoise import Tortoise
from flask import send_file
tts = None
type = None
tts_type = None
multlang = "None"
multspeak = "None"
loadedModel = "None"
@@ -55,7 +55,7 @@ def model_type(_config_path):
def load_model(_model, _gpu, _progress):
global tts
global type
global tts_type
global loadedModel
global multlang
global multspeak
@@ -96,13 +96,13 @@ def load_model(_model, _gpu, _progress):
#prevent multiple loading
if status == "Loading":
if status == "Loading":
status = "Loading"
print(status)
return status
#prevent multiple loading
if os.path.join(_model_path) == loadedModel:
if os.path.join(_model_path) == loadedModel:
status = "Already Loaded"
print(status)
return status
@@ -134,20 +134,20 @@ def load_model(_model, _gpu, _progress):
else:
pass
type = model_type(_config_path)
tts_type = model_type(_config_path)
#print("Type: ", type)
#print("Status", status)
if status is None:
status = "Unknown error occurred"
if type is None:
type = "Unknown"
if tts_type is None:
tts_type = "Unknown"
return status
def is_multi_speaker_model():
global multspeak
global type
global tts_type
global spkdirectory
global multspeakjson
global tts
@@ -158,7 +158,7 @@ def is_multi_speaker_model():
try:
if type == "bark" or type == "tortoise":
if tts_type == "bark" or tts_type == "tortoise":
_target_directory = ModelManager().output_prefix
# Convert _target_directory to a string and remove the trailing backslash if present
_target_directory_str = str(_target_directory)
@@ -313,7 +313,7 @@ def coqui_modeldownload(_modeldownload): #Avail voices function
return status
def coqui_tts(text, speaker_id, mspker_id, style_wav, language_id):
global type
global tts_type
global multlang
global multspeak
global loadedModel
@@ -365,7 +365,7 @@ def coqui_tts(text, speaker_id, mspker_id, style_wav, language_id):
print("MODEL NOT LOADED!!! Loading... ", loadedModel, speaker_id)
print("Loading :", speaker_id, "GPU is: ", _gpu)
load_model(speaker_id, _gpu, True)
load_model(speaker_id, _gpu, True)
audio_buffer = io.BytesIO()
@@ -375,7 +375,7 @@ def coqui_tts(text, speaker_id, mspker_id, style_wav, language_id):
tts.tts_to_file(text, file_path=audio_buffer)
elif isinstance(multspeak, (int, float)) and not isinstance(multlang, (int, float)):
#print("speaker only")
if type == "bark" or type == "tortoise":
if tts_type == "bark" or tts_type == "tortoise":
try:
if multspeakjson == "": #failing because multispeakjson not loaded
parsed_multspeak = json.loads(is_multi_speaker_model())