fix cpu+fp16 inference issue

fix cpu+fp16 inference issue
This commit is contained in:
RVC-Boss 2024-08-01 21:47:30 +08:00 committed by GitHub
parent 9498fc775b
commit bce451a2d1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 8 additions and 6 deletions

View File

@ -10,13 +10,13 @@ all_parts = os.environ.get("all_parts")
os.environ["CUDA_VISIBLE_DEVICES"] = os.environ.get("_CUDA_VISIBLE_DEVICES") os.environ["CUDA_VISIBLE_DEVICES"] = os.environ.get("_CUDA_VISIBLE_DEVICES")
opt_dir = os.environ.get("opt_dir") opt_dir = os.environ.get("opt_dir")
bert_pretrained_dir = os.environ.get("bert_pretrained_dir") bert_pretrained_dir = os.environ.get("bert_pretrained_dir")
is_half = eval(os.environ.get("is_half", "True")) import torch
is_half = eval(os.environ.get("is_half", "True")) and torch.cuda.is_available()
import sys, numpy as np, traceback, pdb import sys, numpy as np, traceback, pdb
import os.path import os.path
from glob import glob from glob import glob
from tqdm import tqdm from tqdm import tqdm
from text.cleaner import clean_text from text.cleaner import clean_text
import torch
from transformers import AutoModelForMaskedLM, AutoTokenizer from transformers import AutoModelForMaskedLM, AutoTokenizer
import numpy as np import numpy as np

View File

@ -10,11 +10,12 @@ os.environ["CUDA_VISIBLE_DEVICES"]= os.environ.get("_CUDA_VISIBLE_DEVICES")
from feature_extractor import cnhubert from feature_extractor import cnhubert
opt_dir= os.environ.get("opt_dir") opt_dir= os.environ.get("opt_dir")
cnhubert.cnhubert_base_path= os.environ.get("cnhubert_base_dir") cnhubert.cnhubert_base_path= os.environ.get("cnhubert_base_dir")
is_half=eval(os.environ.get("is_half","True")) import torch
is_half = eval(os.environ.get("is_half", "True")) and torch.cuda.is_available()
import pdb,traceback,numpy as np,logging import pdb,traceback,numpy as np,logging
from scipy.io import wavfile from scipy.io import wavfile
import librosa,torch import librosa
now_dir = os.getcwd() now_dir = os.getcwd()
sys.path.append(now_dir) sys.path.append(now_dir)
from tools.my_utils import load_audio from tools.my_utils import load_audio

View File

@ -8,7 +8,8 @@ os.environ["CUDA_VISIBLE_DEVICES"] = os.environ.get("_CUDA_VISIBLE_DEVICES")
opt_dir = os.environ.get("opt_dir") opt_dir = os.environ.get("opt_dir")
pretrained_s2G = os.environ.get("pretrained_s2G") pretrained_s2G = os.environ.get("pretrained_s2G")
s2config_path = os.environ.get("s2config_path") s2config_path = os.environ.get("s2config_path")
is_half = eval(os.environ.get("is_half", "True")) import torch
is_half = eval(os.environ.get("is_half", "True")) and torch.cuda.is_available()
import math, traceback import math, traceback
import multiprocessing import multiprocessing
import sys, pdb import sys, pdb
@ -19,7 +20,7 @@ from random import shuffle
import torch.multiprocessing as mp import torch.multiprocessing as mp
from glob import glob from glob import glob
from tqdm import tqdm from tqdm import tqdm
import logging, librosa, utils, torch import logging, librosa, utils
from module.models import SynthesizerTrn from module.models import SynthesizerTrn
logging.getLogger("numba").setLevel(logging.WARNING) logging.getLogger("numba").setLevel(logging.WARNING)