Skip to content

Commit

Permalink
refactor: rename typo to estimate
Browse files Browse the repository at this point in the history
  • Loading branch information
aiwantaozi committed Dec 17, 2024
1 parent a06952d commit a655951
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 17 deletions.
4 changes: 2 additions & 2 deletions vox_box/elstimator/bark.py → vox_box/estimator/bark.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
from typing import Dict
from vox_box.config.config import BackendEnum, Config, TaskTypeEnum
from vox_box.downloader.downloaders import download_model
from vox_box.elstimator.base import Elstimator
from vox_box.estimator.base import Estimator
from vox_box.utils.model import create_model_dict

logger = logging.getLogger(__name__)


class Bark(Elstimator):
class Bark(Estimator):
def __init__(
self,
cfg: Config,
Expand Down
2 changes: 1 addition & 1 deletion vox_box/elstimator/base.py → vox_box/estimator/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from vox_box.config.config import Config


class Elstimator(ABC):
class Estimator(ABC):
def __init__(
self,
cfg: Config,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
from typing import Dict

from vox_box.downloader.downloaders import download_model
from vox_box.elstimator.base import Elstimator
from vox_box.estimator.base import Estimator

from vox_box.config.config import BackendEnum, Config, TaskTypeEnum
from vox_box.utils.model import create_model_dict

logger = logging.getLogger(__name__)


class CosyVoice(Elstimator):
class CosyVoice(Estimator):
def __init__(
self,
cfg: Config,
Expand Down
18 changes: 11 additions & 7 deletions vox_box/elstimator/estimate.py → vox_box/estimator/estimate.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
from typing import Dict, List
from vox_box.config.config import Config
from vox_box.elstimator.bark import Bark
from vox_box.elstimator.base import Elstimator
from vox_box.elstimator.cosyvoice import CosyVoice
from vox_box.elstimator.faster_whisper import FasterWhisper
from vox_box.elstimator.funasr import FunASR
from vox_box.estimator.bark import Bark
from vox_box.estimator.base import Estimator
from vox_box.estimator.cosyvoice import CosyVoice
from vox_box.estimator.faster_whisper import FasterWhisper
from vox_box.estimator.funasr import FunASR
from vox_box.utils.model import create_model_dict


def estimate_model(cfg: Config) -> Dict:
elstimator: List[Elstimator] = [
estimators: List[Estimator] = [
FasterWhisper(cfg),
FunASR(cfg),
CosyVoice(cfg),
Expand All @@ -21,7 +21,11 @@ def estimate_model(cfg: Config) -> Dict:
model,
supported=False,
)
for e in elstimator:

def get_model_info(estimator: Estimator) -> Dict:
return estimator.model_info()

for e in estimators:
model_info = e.model_info()
if model_info["supported"]:
return model_info
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
from vox_box.config.config import BackendEnum, Config, TaskTypeEnum
from vox_box.downloader.downloaders import download_model
from vox_box.downloader.hub import match_files
from vox_box.elstimator.base import Elstimator
from vox_box.estimator.base import Estimator
from vox_box.utils.model import create_model_dict
from faster_whisper.transcribe import WhisperModel

logger = logging.getLogger(__name__)


class FasterWhisper(Elstimator):
class FasterWhisper(Estimator):
def __init__(
self,
cfg: Config,
Expand Down
4 changes: 2 additions & 2 deletions vox_box/elstimator/funasr.py → vox_box/estimator/funasr.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
import yaml
from vox_box.config.config import BackendEnum, Config, TaskTypeEnum
from vox_box.downloader.downloaders import download_model
from vox_box.elstimator.base import Elstimator
from vox_box.estimator.base import Estimator
from vox_box.utils.model import create_model_dict


logger = logging.getLogger(__name__)


class FunASR(Elstimator):
class FunASR(Estimator):
def __init__(
self,
cfg: Config,
Expand Down
2 changes: 1 addition & 1 deletion vox_box/server/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from vox_box.backends.tts.cosyvoice import CosyVoice
from vox_box.config.config import BackendEnum, Config
from vox_box.downloader import downloaders
from vox_box.elstimator.estimate import estimate_model
from vox_box.estimator.estimate import estimate_model

_instance = None

Expand Down

0 comments on commit a655951

Please sign in to comment.