xinference 0.14.2__py3-none-any.whl → 0.14.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of xinference might be problematic. Click here for more details.
- xinference/_version.py +3 -3
- xinference/core/chat_interface.py +1 -1
- xinference/core/image_interface.py +9 -0
- xinference/core/model.py +4 -1
- xinference/core/worker.py +48 -41
- xinference/model/audio/chattts.py +24 -9
- xinference/model/audio/core.py +8 -2
- xinference/model/audio/fish_speech.py +228 -0
- xinference/model/audio/model_spec.json +8 -0
- xinference/model/embedding/core.py +23 -1
- xinference/model/image/model_spec.json +2 -1
- xinference/model/image/model_spec_modelscope.json +2 -1
- xinference/model/image/stable_diffusion/core.py +49 -1
- xinference/model/llm/__init__.py +6 -0
- xinference/model/llm/llm_family.json +54 -9
- xinference/model/llm/llm_family.py +2 -0
- xinference/model/llm/llm_family_modelscope.json +56 -10
- xinference/model/llm/lmdeploy/__init__.py +0 -0
- xinference/model/llm/lmdeploy/core.py +557 -0
- xinference/model/llm/transformers/cogvlm2.py +4 -45
- xinference/model/llm/transformers/cogvlm2_video.py +524 -0
- xinference/model/llm/transformers/core.py +1 -0
- xinference/model/llm/transformers/glm4v.py +2 -23
- xinference/model/llm/transformers/intern_vl.py +94 -11
- xinference/model/llm/transformers/minicpmv25.py +2 -23
- xinference/model/llm/transformers/minicpmv26.py +2 -22
- xinference/model/llm/transformers/yi_vl.py +2 -24
- xinference/model/llm/utils.py +10 -1
- xinference/model/llm/vllm/core.py +1 -1
- xinference/thirdparty/fish_speech/__init__.py +0 -0
- xinference/thirdparty/fish_speech/fish_speech/__init__.py +0 -0
- xinference/thirdparty/fish_speech/fish_speech/callbacks/__init__.py +3 -0
- xinference/thirdparty/fish_speech/fish_speech/callbacks/grad_norm.py +113 -0
- xinference/thirdparty/fish_speech/fish_speech/configs/__init__.py +0 -0
- xinference/thirdparty/fish_speech/fish_speech/configs/lora/__init__.py +0 -0
- xinference/thirdparty/fish_speech/fish_speech/conversation.py +2 -0
- xinference/thirdparty/fish_speech/fish_speech/datasets/__init__.py +0 -0
- xinference/thirdparty/fish_speech/fish_speech/datasets/concat_repeat.py +53 -0
- xinference/thirdparty/fish_speech/fish_speech/datasets/protos/__init__.py +0 -0
- xinference/thirdparty/fish_speech/fish_speech/datasets/protos/text_data_pb2.py +33 -0
- xinference/thirdparty/fish_speech/fish_speech/datasets/protos/text_data_stream.py +36 -0
- xinference/thirdparty/fish_speech/fish_speech/datasets/semantic.py +496 -0
- xinference/thirdparty/fish_speech/fish_speech/datasets/vqgan.py +147 -0
- xinference/thirdparty/fish_speech/fish_speech/i18n/__init__.py +3 -0
- xinference/thirdparty/fish_speech/fish_speech/i18n/core.py +40 -0
- xinference/thirdparty/fish_speech/fish_speech/i18n/locale/__init__.py +0 -0
- xinference/thirdparty/fish_speech/fish_speech/i18n/locale/en_US.json +122 -0
- xinference/thirdparty/fish_speech/fish_speech/i18n/locale/es_ES.json +122 -0
- xinference/thirdparty/fish_speech/fish_speech/i18n/locale/ja_JP.json +123 -0
- xinference/thirdparty/fish_speech/fish_speech/i18n/locale/pt_BR.json +133 -0
- xinference/thirdparty/fish_speech/fish_speech/i18n/locale/zh_CN.json +122 -0
- xinference/thirdparty/fish_speech/fish_speech/i18n/scan.py +122 -0
- xinference/thirdparty/fish_speech/fish_speech/models/__init__.py +0 -0
- xinference/thirdparty/fish_speech/fish_speech/models/text2semantic/__init__.py +0 -0
- xinference/thirdparty/fish_speech/fish_speech/models/text2semantic/lit_module.py +202 -0
- xinference/thirdparty/fish_speech/fish_speech/models/text2semantic/llama.py +779 -0
- xinference/thirdparty/fish_speech/fish_speech/models/text2semantic/lora.py +92 -0
- xinference/thirdparty/fish_speech/fish_speech/models/vqgan/__init__.py +3 -0
- xinference/thirdparty/fish_speech/fish_speech/models/vqgan/lit_module.py +442 -0
- xinference/thirdparty/fish_speech/fish_speech/models/vqgan/modules/__init__.py +0 -0
- xinference/thirdparty/fish_speech/fish_speech/models/vqgan/modules/discriminator.py +44 -0
- xinference/thirdparty/fish_speech/fish_speech/models/vqgan/modules/firefly.py +625 -0
- xinference/thirdparty/fish_speech/fish_speech/models/vqgan/modules/fsq.py +139 -0
- xinference/thirdparty/fish_speech/fish_speech/models/vqgan/modules/reference.py +115 -0
- xinference/thirdparty/fish_speech/fish_speech/models/vqgan/modules/wavenet.py +225 -0
- xinference/thirdparty/fish_speech/fish_speech/models/vqgan/utils.py +94 -0
- xinference/thirdparty/fish_speech/fish_speech/scheduler.py +40 -0
- xinference/thirdparty/fish_speech/fish_speech/text/__init__.py +4 -0
- xinference/thirdparty/fish_speech/fish_speech/text/chn_text_norm/__init__.py +0 -0
- xinference/thirdparty/fish_speech/fish_speech/text/chn_text_norm/basic_class.py +172 -0
- xinference/thirdparty/fish_speech/fish_speech/text/chn_text_norm/basic_constant.py +30 -0
- xinference/thirdparty/fish_speech/fish_speech/text/chn_text_norm/basic_util.py +342 -0
- xinference/thirdparty/fish_speech/fish_speech/text/chn_text_norm/cardinal.py +32 -0
- xinference/thirdparty/fish_speech/fish_speech/text/chn_text_norm/date.py +75 -0
- xinference/thirdparty/fish_speech/fish_speech/text/chn_text_norm/digit.py +32 -0
- xinference/thirdparty/fish_speech/fish_speech/text/chn_text_norm/fraction.py +35 -0
- xinference/thirdparty/fish_speech/fish_speech/text/chn_text_norm/money.py +43 -0
- xinference/thirdparty/fish_speech/fish_speech/text/chn_text_norm/percentage.py +33 -0
- xinference/thirdparty/fish_speech/fish_speech/text/chn_text_norm/telephone.py +51 -0
- xinference/thirdparty/fish_speech/fish_speech/text/chn_text_norm/text.py +177 -0
- xinference/thirdparty/fish_speech/fish_speech/text/clean.py +69 -0
- xinference/thirdparty/fish_speech/fish_speech/text/spliter.py +130 -0
- xinference/thirdparty/fish_speech/fish_speech/train.py +139 -0
- xinference/thirdparty/fish_speech/fish_speech/utils/__init__.py +23 -0
- xinference/thirdparty/fish_speech/fish_speech/utils/braceexpand.py +217 -0
- xinference/thirdparty/fish_speech/fish_speech/utils/context.py +13 -0
- xinference/thirdparty/fish_speech/fish_speech/utils/file.py +16 -0
- xinference/thirdparty/fish_speech/fish_speech/utils/instantiators.py +50 -0
- xinference/thirdparty/fish_speech/fish_speech/utils/logger.py +55 -0
- xinference/thirdparty/fish_speech/fish_speech/utils/logging_utils.py +48 -0
- xinference/thirdparty/fish_speech/fish_speech/utils/rich_utils.py +100 -0
- xinference/thirdparty/fish_speech/fish_speech/utils/spectrogram.py +122 -0
- xinference/thirdparty/fish_speech/fish_speech/utils/utils.py +114 -0
- xinference/thirdparty/fish_speech/fish_speech/webui/__init__.py +0 -0
- xinference/thirdparty/fish_speech/fish_speech/webui/launch_utils.py +120 -0
- xinference/thirdparty/fish_speech/fish_speech/webui/manage.py +1237 -0
- xinference/thirdparty/fish_speech/tools/__init__.py +0 -0
- xinference/thirdparty/fish_speech/tools/api.py +495 -0
- xinference/thirdparty/fish_speech/tools/auto_rerank.py +159 -0
- xinference/thirdparty/fish_speech/tools/download_models.py +55 -0
- xinference/thirdparty/fish_speech/tools/extract_model.py +21 -0
- xinference/thirdparty/fish_speech/tools/file.py +108 -0
- xinference/thirdparty/fish_speech/tools/gen_ref.py +36 -0
- xinference/thirdparty/fish_speech/tools/llama/__init__.py +0 -0
- xinference/thirdparty/fish_speech/tools/llama/build_dataset.py +169 -0
- xinference/thirdparty/fish_speech/tools/llama/eval_in_context.py +171 -0
- xinference/thirdparty/fish_speech/tools/llama/generate.py +698 -0
- xinference/thirdparty/fish_speech/tools/llama/merge_lora.py +95 -0
- xinference/thirdparty/fish_speech/tools/llama/quantize.py +497 -0
- xinference/thirdparty/fish_speech/tools/llama/rebuild_tokenizer.py +57 -0
- xinference/thirdparty/fish_speech/tools/merge_asr_files.py +55 -0
- xinference/thirdparty/fish_speech/tools/post_api.py +164 -0
- xinference/thirdparty/fish_speech/tools/sensevoice/__init__.py +0 -0
- xinference/thirdparty/fish_speech/tools/sensevoice/auto_model.py +573 -0
- xinference/thirdparty/fish_speech/tools/sensevoice/fun_asr.py +332 -0
- xinference/thirdparty/fish_speech/tools/sensevoice/vad_utils.py +61 -0
- xinference/thirdparty/fish_speech/tools/smart_pad.py +47 -0
- xinference/thirdparty/fish_speech/tools/vqgan/__init__.py +0 -0
- xinference/thirdparty/fish_speech/tools/vqgan/create_train_split.py +83 -0
- xinference/thirdparty/fish_speech/tools/vqgan/extract_vq.py +227 -0
- xinference/thirdparty/fish_speech/tools/vqgan/inference.py +120 -0
- xinference/thirdparty/fish_speech/tools/webui.py +619 -0
- xinference/thirdparty/fish_speech/tools/whisper_asr.py +176 -0
- xinference/web/ui/build/asset-manifest.json +3 -3
- xinference/web/ui/build/index.html +1 -1
- xinference/web/ui/build/static/js/{main.ffc26121.js → main.661c7b0a.js} +3 -3
- xinference/web/ui/build/static/js/main.661c7b0a.js.map +1 -0
- xinference/web/ui/node_modules/.cache/babel-loader/070d8c6b3b0f3485c6d3885f0b6bbfdf9643e088a468acbd5d596f2396071c16.json +1 -0
- {xinference-0.14.2.dist-info → xinference-0.14.3.dist-info}/METADATA +18 -6
- {xinference-0.14.2.dist-info → xinference-0.14.3.dist-info}/RECORD +135 -37
- xinference/web/ui/build/static/js/main.ffc26121.js.map +0 -1
- xinference/web/ui/node_modules/.cache/babel-loader/2f40209b32e7e46a2eab6b8c8a355eb42c3caa8bc3228dd929f32fd2b3940294.json +0 -1
- /xinference/web/ui/build/static/js/{main.ffc26121.js.LICENSE.txt → main.661c7b0a.js.LICENSE.txt} +0 -0
- {xinference-0.14.2.dist-info → xinference-0.14.3.dist-info}/LICENSE +0 -0
- {xinference-0.14.2.dist-info → xinference-0.14.3.dist-info}/WHEEL +0 -0
- {xinference-0.14.2.dist-info → xinference-0.14.3.dist-info}/entry_points.txt +0 -0
- {xinference-0.14.2.dist-info → xinference-0.14.3.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import warnings
|
|
2
|
+
from importlib.util import find_spec
|
|
3
|
+
from typing import Callable
|
|
4
|
+
|
|
5
|
+
from omegaconf import DictConfig
|
|
6
|
+
|
|
7
|
+
from .logger import RankedLogger
|
|
8
|
+
from .rich_utils import enforce_tags, print_config_tree
|
|
9
|
+
|
|
10
|
+
log = RankedLogger(__name__, rank_zero_only=True)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def extras(cfg: DictConfig) -> None:
|
|
14
|
+
"""Applies optional utilities before the task is started.
|
|
15
|
+
|
|
16
|
+
Utilities:
|
|
17
|
+
- Ignoring python warnings
|
|
18
|
+
- Setting tags from command line
|
|
19
|
+
- Rich config printing
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
# return if no `extras` config
|
|
23
|
+
if not cfg.get("extras"):
|
|
24
|
+
log.warning("Extras config not found! <cfg.extras=null>")
|
|
25
|
+
return
|
|
26
|
+
|
|
27
|
+
# disable python warnings
|
|
28
|
+
if cfg.extras.get("ignore_warnings"):
|
|
29
|
+
log.info("Disabling python warnings! <cfg.extras.ignore_warnings=True>")
|
|
30
|
+
warnings.filterwarnings("ignore")
|
|
31
|
+
|
|
32
|
+
# prompt user to input tags from command line if none are provided in the config
|
|
33
|
+
if cfg.extras.get("enforce_tags"):
|
|
34
|
+
log.info("Enforcing tags! <cfg.extras.enforce_tags=True>")
|
|
35
|
+
enforce_tags(cfg, save_to_file=True)
|
|
36
|
+
|
|
37
|
+
# pretty print config tree using Rich library
|
|
38
|
+
if cfg.extras.get("print_config"):
|
|
39
|
+
log.info("Printing config tree with Rich! <cfg.extras.print_config=True>")
|
|
40
|
+
print_config_tree(cfg, resolve=True, save_to_file=True)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def task_wrapper(task_func: Callable) -> Callable:
|
|
44
|
+
"""Optional decorator that controls the failure behavior when executing the task function.
|
|
45
|
+
|
|
46
|
+
This wrapper can be used to:
|
|
47
|
+
- make sure loggers are closed even if the task function raises an exception (prevents multirun failure)
|
|
48
|
+
- save the exception to a `.log` file
|
|
49
|
+
- mark the run as failed with a dedicated file in the `logs/` folder (so we can find and rerun it later)
|
|
50
|
+
- etc. (adjust depending on your needs)
|
|
51
|
+
|
|
52
|
+
Example:
|
|
53
|
+
```
|
|
54
|
+
@utils.task_wrapper
|
|
55
|
+
def train(cfg: DictConfig) -> Tuple[dict, dict]:
|
|
56
|
+
|
|
57
|
+
...
|
|
58
|
+
|
|
59
|
+
return metric_dict, object_dict
|
|
60
|
+
```
|
|
61
|
+
""" # noqa: E501
|
|
62
|
+
|
|
63
|
+
def wrap(cfg: DictConfig):
|
|
64
|
+
# execute the task
|
|
65
|
+
try:
|
|
66
|
+
metric_dict, object_dict = task_func(cfg=cfg)
|
|
67
|
+
|
|
68
|
+
# things to do if exception occurs
|
|
69
|
+
except Exception as ex:
|
|
70
|
+
# save exception to `.log` file
|
|
71
|
+
log.exception("")
|
|
72
|
+
|
|
73
|
+
# some hyperparameter combinations might be invalid or
|
|
74
|
+
# cause out-of-memory errors so when using hparam search
|
|
75
|
+
# plugins like Optuna, you might want to disable
|
|
76
|
+
# raising the below exception to avoid multirun failure
|
|
77
|
+
raise ex
|
|
78
|
+
|
|
79
|
+
# things to always do after either success or exception
|
|
80
|
+
finally:
|
|
81
|
+
# display output dir path in terminal
|
|
82
|
+
log.info(f"Output dir: {cfg.paths.run_dir}")
|
|
83
|
+
|
|
84
|
+
# always close wandb run (even if exception occurs so multirun won't fail)
|
|
85
|
+
if find_spec("wandb"): # check if wandb is installed
|
|
86
|
+
import wandb
|
|
87
|
+
|
|
88
|
+
if wandb.run:
|
|
89
|
+
log.info("Closing wandb!")
|
|
90
|
+
wandb.finish()
|
|
91
|
+
|
|
92
|
+
return metric_dict, object_dict
|
|
93
|
+
|
|
94
|
+
return wrap
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
def get_metric_value(metric_dict: dict, metric_name: str) -> float:
|
|
98
|
+
"""Safely retrieves value of the metric logged in LightningModule."""
|
|
99
|
+
|
|
100
|
+
if not metric_name:
|
|
101
|
+
log.info("Metric name is None! Skipping metric value retrieval...")
|
|
102
|
+
return None
|
|
103
|
+
|
|
104
|
+
if metric_name not in metric_dict:
|
|
105
|
+
raise Exception(
|
|
106
|
+
f"Metric value not found! <metric_name={metric_name}>\n"
|
|
107
|
+
"Make sure metric name logged in LightningModule is correct!\n"
|
|
108
|
+
"Make sure `optimized_metric` name in `hparams_search` config is correct!"
|
|
109
|
+
)
|
|
110
|
+
|
|
111
|
+
metric_value = metric_dict[metric_name].item()
|
|
112
|
+
log.info(f"Retrieved metric value! <{metric_name}={metric_value}>")
|
|
113
|
+
|
|
114
|
+
return metric_value
|
|
File without changes
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import importlib.util
|
|
2
|
+
import os
|
|
3
|
+
import subprocess
|
|
4
|
+
import sys
|
|
5
|
+
from functools import lru_cache
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
from typing import Iterable
|
|
8
|
+
|
|
9
|
+
import gradio as gr
|
|
10
|
+
from gradio.themes.base import Base
|
|
11
|
+
from gradio.themes.utils import colors, fonts, sizes
|
|
12
|
+
|
|
13
|
+
GIT = (
|
|
14
|
+
(Path(os.environ.get("GIT_HOME", "")) / "git").resolve()
|
|
15
|
+
if sys.platform == "win32"
|
|
16
|
+
else "git"
|
|
17
|
+
)
|
|
18
|
+
GIT = str(GIT)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def is_module_installed(module_name: str) -> bool:
|
|
22
|
+
spec = importlib.util.find_spec(module_name)
|
|
23
|
+
return spec is not None
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
@lru_cache()
|
|
27
|
+
def commit_hash():
|
|
28
|
+
try:
|
|
29
|
+
return subprocess.check_output(
|
|
30
|
+
[GIT, "log", "-1", "--format='%h %s'"], shell=False, encoding="utf8"
|
|
31
|
+
).strip()
|
|
32
|
+
except Exception:
|
|
33
|
+
return "<none>"
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def versions_html():
|
|
37
|
+
import torch
|
|
38
|
+
|
|
39
|
+
python_version = ".".join([str(x) for x in sys.version_info[0:3]])
|
|
40
|
+
commit = commit_hash()
|
|
41
|
+
hash = commit.strip("'").split(" ")[0]
|
|
42
|
+
|
|
43
|
+
return f"""
|
|
44
|
+
version: <a href="https://github.com/fishaudio/fish-speech/commit/{hash}">{hash}</a>
|
|
45
|
+
 • 
|
|
46
|
+
python: <span title="{sys.version}">{python_version}</span>
|
|
47
|
+
 • 
|
|
48
|
+
torch: {getattr(torch, '__long_version__',torch.__version__)}
|
|
49
|
+
 • 
|
|
50
|
+
gradio: {gr.__version__}
|
|
51
|
+
 • 
|
|
52
|
+
author: <a href="https://github.com/fishaudio">fishaudio</a>
|
|
53
|
+
"""
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def version_check(commit):
|
|
57
|
+
try:
|
|
58
|
+
import requests
|
|
59
|
+
|
|
60
|
+
commits = requests.get(
|
|
61
|
+
"https://api.github.com/repos/fishaudio/fish-speech/branches/main"
|
|
62
|
+
).json()
|
|
63
|
+
if commit != "<none>" and commits["commit"]["sha"] != commit:
|
|
64
|
+
print("--------------------------------------------------------")
|
|
65
|
+
print("| You are not up to date with the most recent release. |")
|
|
66
|
+
print("| Consider running `git pull` to update. |")
|
|
67
|
+
print("--------------------------------------------------------")
|
|
68
|
+
elif commits["commit"]["sha"] == commit:
|
|
69
|
+
print("You are up to date with the most recent release.")
|
|
70
|
+
else:
|
|
71
|
+
print("Not a git clone, can't perform version check.")
|
|
72
|
+
except Exception as e:
|
|
73
|
+
print("version check failed", e)
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
class Seafoam(Base):
|
|
77
|
+
def __init__(
|
|
78
|
+
self,
|
|
79
|
+
*,
|
|
80
|
+
primary_hue: colors.Color | str = colors.emerald,
|
|
81
|
+
secondary_hue: colors.Color | str = colors.blue,
|
|
82
|
+
neutral_hue: colors.Color | str = colors.blue,
|
|
83
|
+
spacing_size: sizes.Size | str = sizes.spacing_md,
|
|
84
|
+
radius_size: sizes.Size | str = sizes.radius_md,
|
|
85
|
+
text_size: sizes.Size | str = sizes.text_lg,
|
|
86
|
+
font: fonts.Font | str | Iterable[fonts.Font | str] = (
|
|
87
|
+
fonts.GoogleFont("Quicksand"),
|
|
88
|
+
"ui-sans-serif",
|
|
89
|
+
"sans-serif",
|
|
90
|
+
),
|
|
91
|
+
font_mono: fonts.Font | str | Iterable[fonts.Font | str] = (
|
|
92
|
+
fonts.GoogleFont("IBM Plex Mono"),
|
|
93
|
+
"ui-monospace",
|
|
94
|
+
"monospace",
|
|
95
|
+
),
|
|
96
|
+
):
|
|
97
|
+
super().__init__(
|
|
98
|
+
primary_hue=primary_hue,
|
|
99
|
+
secondary_hue=secondary_hue,
|
|
100
|
+
neutral_hue=neutral_hue,
|
|
101
|
+
spacing_size=spacing_size,
|
|
102
|
+
radius_size=radius_size,
|
|
103
|
+
text_size=text_size,
|
|
104
|
+
font=font,
|
|
105
|
+
font_mono=font_mono,
|
|
106
|
+
)
|
|
107
|
+
super().set(
|
|
108
|
+
button_primary_background_fill="linear-gradient(90deg, *primary_300, *secondary_400)",
|
|
109
|
+
button_primary_background_fill_hover="linear-gradient(90deg, *primary_200, *secondary_300)",
|
|
110
|
+
button_primary_text_color="white",
|
|
111
|
+
button_primary_background_fill_dark="linear-gradient(90deg, *primary_600, *secondary_800)",
|
|
112
|
+
slider_color="*secondary_300",
|
|
113
|
+
slider_color_dark="*secondary_600",
|
|
114
|
+
block_title_text_weight="600",
|
|
115
|
+
block_border_width="3px",
|
|
116
|
+
block_shadow="*shadow_drop_lg",
|
|
117
|
+
button_shadow="*shadow_drop_lg",
|
|
118
|
+
button_small_padding="0px",
|
|
119
|
+
button_large_padding="3px",
|
|
120
|
+
)
|