xinference 1.10.0__py3-none-any.whl → 1.10.1__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/api/restful_api.py +11 -28
- xinference/client/restful/async_restful_client.py +20 -3
- xinference/client/restful/restful_client.py +20 -3
- xinference/core/supervisor.py +87 -53
- xinference/core/worker.py +10 -0
- xinference/deploy/cmdline.py +15 -0
- xinference/model/audio/core.py +21 -6
- xinference/model/audio/indextts2.py +166 -0
- xinference/model/audio/model_spec.json +38 -1
- xinference/model/image/model_spec.json +69 -0
- xinference/model/image/stable_diffusion/core.py +13 -4
- xinference/model/llm/__init__.py +4 -0
- xinference/model/llm/llm_family.json +464 -2
- xinference/model/llm/sglang/core.py +30 -11
- xinference/model/llm/tool_parsers/deepseek_r1_tool_parser.py +94 -32
- xinference/model/llm/transformers/multimodal/qwen2_vl.py +34 -8
- xinference/model/llm/utils.py +12 -9
- xinference/model/llm/vllm/core.py +93 -17
- xinference/thirdparty/audiotools/__init__.py +10 -0
- xinference/thirdparty/audiotools/core/__init__.py +4 -0
- xinference/thirdparty/audiotools/core/audio_signal.py +1682 -0
- xinference/thirdparty/audiotools/core/display.py +194 -0
- xinference/thirdparty/audiotools/core/dsp.py +390 -0
- xinference/thirdparty/audiotools/core/effects.py +647 -0
- xinference/thirdparty/audiotools/core/ffmpeg.py +211 -0
- xinference/thirdparty/audiotools/core/loudness.py +320 -0
- xinference/thirdparty/audiotools/core/playback.py +252 -0
- xinference/thirdparty/audiotools/core/templates/__init__.py +0 -0
- xinference/thirdparty/audiotools/core/templates/headers.html +322 -0
- xinference/thirdparty/audiotools/core/templates/pandoc.css +407 -0
- xinference/thirdparty/audiotools/core/templates/widget.html +52 -0
- xinference/thirdparty/audiotools/core/util.py +671 -0
- xinference/thirdparty/audiotools/core/whisper.py +97 -0
- xinference/thirdparty/audiotools/data/__init__.py +3 -0
- xinference/thirdparty/audiotools/data/datasets.py +517 -0
- xinference/thirdparty/audiotools/data/preprocess.py +81 -0
- xinference/thirdparty/audiotools/data/transforms.py +1592 -0
- xinference/thirdparty/audiotools/metrics/__init__.py +6 -0
- xinference/thirdparty/audiotools/metrics/distance.py +131 -0
- xinference/thirdparty/audiotools/metrics/quality.py +159 -0
- xinference/thirdparty/audiotools/metrics/spectral.py +247 -0
- xinference/thirdparty/audiotools/ml/__init__.py +5 -0
- xinference/thirdparty/audiotools/ml/accelerator.py +184 -0
- xinference/thirdparty/audiotools/ml/decorators.py +440 -0
- xinference/thirdparty/audiotools/ml/experiment.py +90 -0
- xinference/thirdparty/audiotools/ml/layers/__init__.py +2 -0
- xinference/thirdparty/audiotools/ml/layers/base.py +328 -0
- xinference/thirdparty/audiotools/ml/layers/spectral_gate.py +127 -0
- xinference/thirdparty/audiotools/post.py +140 -0
- xinference/thirdparty/audiotools/preference.py +600 -0
- xinference/thirdparty/indextts/BigVGAN/ECAPA_TDNN.py +656 -0
- xinference/thirdparty/indextts/BigVGAN/__init__.py +0 -0
- xinference/thirdparty/indextts/BigVGAN/activations.py +122 -0
- xinference/thirdparty/indextts/BigVGAN/alias_free_activation/__init__.py +0 -0
- xinference/thirdparty/indextts/BigVGAN/alias_free_activation/cuda/.gitignore +1 -0
- xinference/thirdparty/indextts/BigVGAN/alias_free_activation/cuda/__init__.py +0 -0
- xinference/thirdparty/indextts/BigVGAN/alias_free_activation/cuda/activation1d.py +76 -0
- xinference/thirdparty/indextts/BigVGAN/alias_free_activation/cuda/anti_alias_activation.cpp +23 -0
- xinference/thirdparty/indextts/BigVGAN/alias_free_activation/cuda/anti_alias_activation_cuda.cu +256 -0
- xinference/thirdparty/indextts/BigVGAN/alias_free_activation/cuda/compat.h +29 -0
- xinference/thirdparty/indextts/BigVGAN/alias_free_activation/cuda/load.py +121 -0
- xinference/thirdparty/indextts/BigVGAN/alias_free_activation/cuda/type_shim.h +92 -0
- xinference/thirdparty/indextts/BigVGAN/alias_free_activation/torch/__init__.py +6 -0
- xinference/thirdparty/indextts/BigVGAN/alias_free_activation/torch/act.py +31 -0
- xinference/thirdparty/indextts/BigVGAN/alias_free_activation/torch/filter.py +102 -0
- xinference/thirdparty/indextts/BigVGAN/alias_free_activation/torch/resample.py +58 -0
- xinference/thirdparty/indextts/BigVGAN/alias_free_torch/__init__.py +6 -0
- xinference/thirdparty/indextts/BigVGAN/alias_free_torch/act.py +29 -0
- xinference/thirdparty/indextts/BigVGAN/alias_free_torch/filter.py +96 -0
- xinference/thirdparty/indextts/BigVGAN/alias_free_torch/resample.py +49 -0
- xinference/thirdparty/indextts/BigVGAN/bigvgan.py +534 -0
- xinference/thirdparty/indextts/BigVGAN/models.py +451 -0
- xinference/thirdparty/indextts/BigVGAN/nnet/CNN.py +546 -0
- xinference/thirdparty/indextts/BigVGAN/nnet/__init__.py +0 -0
- xinference/thirdparty/indextts/BigVGAN/nnet/linear.py +89 -0
- xinference/thirdparty/indextts/BigVGAN/nnet/normalization.py +670 -0
- xinference/thirdparty/indextts/BigVGAN/utils.py +101 -0
- xinference/thirdparty/indextts/__init__.py +0 -0
- xinference/thirdparty/indextts/cli.py +65 -0
- xinference/thirdparty/indextts/gpt/__init__.py +0 -0
- xinference/thirdparty/indextts/gpt/conformer/__init__.py +0 -0
- xinference/thirdparty/indextts/gpt/conformer/attention.py +312 -0
- xinference/thirdparty/indextts/gpt/conformer/embedding.py +163 -0
- xinference/thirdparty/indextts/gpt/conformer/subsampling.py +348 -0
- xinference/thirdparty/indextts/gpt/conformer_encoder.py +520 -0
- xinference/thirdparty/indextts/gpt/model.py +713 -0
- xinference/thirdparty/indextts/gpt/model_v2.py +747 -0
- xinference/thirdparty/indextts/gpt/perceiver.py +317 -0
- xinference/thirdparty/indextts/gpt/transformers_beam_search.py +1013 -0
- xinference/thirdparty/indextts/gpt/transformers_generation_utils.py +4747 -0
- xinference/thirdparty/indextts/gpt/transformers_gpt2.py +1878 -0
- xinference/thirdparty/indextts/gpt/transformers_modeling_utils.py +5525 -0
- xinference/thirdparty/indextts/infer.py +690 -0
- xinference/thirdparty/indextts/infer_v2.py +739 -0
- xinference/thirdparty/indextts/s2mel/dac/__init__.py +16 -0
- xinference/thirdparty/indextts/s2mel/dac/__main__.py +36 -0
- xinference/thirdparty/indextts/s2mel/dac/model/__init__.py +4 -0
- xinference/thirdparty/indextts/s2mel/dac/model/base.py +294 -0
- xinference/thirdparty/indextts/s2mel/dac/model/dac.py +400 -0
- xinference/thirdparty/indextts/s2mel/dac/model/discriminator.py +228 -0
- xinference/thirdparty/indextts/s2mel/dac/model/encodec.py +320 -0
- xinference/thirdparty/indextts/s2mel/dac/nn/__init__.py +3 -0
- xinference/thirdparty/indextts/s2mel/dac/nn/layers.py +33 -0
- xinference/thirdparty/indextts/s2mel/dac/nn/loss.py +368 -0
- xinference/thirdparty/indextts/s2mel/dac/nn/quantize.py +339 -0
- xinference/thirdparty/indextts/s2mel/dac/utils/__init__.py +123 -0
- xinference/thirdparty/indextts/s2mel/dac/utils/decode.py +95 -0
- xinference/thirdparty/indextts/s2mel/dac/utils/encode.py +94 -0
- xinference/thirdparty/indextts/s2mel/hf_utils.py +12 -0
- xinference/thirdparty/indextts/s2mel/modules/alias_free_torch/__init__.py +5 -0
- xinference/thirdparty/indextts/s2mel/modules/alias_free_torch/act.py +29 -0
- xinference/thirdparty/indextts/s2mel/modules/alias_free_torch/filter.py +96 -0
- xinference/thirdparty/indextts/s2mel/modules/alias_free_torch/resample.py +57 -0
- xinference/thirdparty/indextts/s2mel/modules/audio.py +82 -0
- xinference/thirdparty/indextts/s2mel/modules/bigvgan/activations.py +120 -0
- xinference/thirdparty/indextts/s2mel/modules/bigvgan/alias_free_activation/cuda/__init__.py +0 -0
- xinference/thirdparty/indextts/s2mel/modules/bigvgan/alias_free_activation/cuda/activation1d.py +77 -0
- xinference/thirdparty/indextts/s2mel/modules/bigvgan/alias_free_activation/cuda/anti_alias_activation.cpp +23 -0
- xinference/thirdparty/indextts/s2mel/modules/bigvgan/alias_free_activation/cuda/anti_alias_activation_cuda.cu +246 -0
- xinference/thirdparty/indextts/s2mel/modules/bigvgan/alias_free_activation/cuda/compat.h +29 -0
- xinference/thirdparty/indextts/s2mel/modules/bigvgan/alias_free_activation/cuda/load.py +86 -0
- xinference/thirdparty/indextts/s2mel/modules/bigvgan/alias_free_activation/cuda/type_shim.h +92 -0
- xinference/thirdparty/indextts/s2mel/modules/bigvgan/alias_free_activation/torch/__init__.py +6 -0
- xinference/thirdparty/indextts/s2mel/modules/bigvgan/alias_free_activation/torch/act.py +30 -0
- xinference/thirdparty/indextts/s2mel/modules/bigvgan/alias_free_activation/torch/filter.py +101 -0
- xinference/thirdparty/indextts/s2mel/modules/bigvgan/alias_free_activation/torch/resample.py +58 -0
- xinference/thirdparty/indextts/s2mel/modules/bigvgan/bigvgan.py +492 -0
- xinference/thirdparty/indextts/s2mel/modules/bigvgan/config.json +63 -0
- xinference/thirdparty/indextts/s2mel/modules/bigvgan/env.py +18 -0
- xinference/thirdparty/indextts/s2mel/modules/bigvgan/meldataset.py +354 -0
- xinference/thirdparty/indextts/s2mel/modules/bigvgan/utils.py +99 -0
- xinference/thirdparty/indextts/s2mel/modules/campplus/DTDNN.py +115 -0
- xinference/thirdparty/indextts/s2mel/modules/campplus/classifier.py +70 -0
- xinference/thirdparty/indextts/s2mel/modules/campplus/layers.py +253 -0
- xinference/thirdparty/indextts/s2mel/modules/commons.py +632 -0
- xinference/thirdparty/indextts/s2mel/modules/diffusion_transformer.py +257 -0
- xinference/thirdparty/indextts/s2mel/modules/encodec.py +292 -0
- xinference/thirdparty/indextts/s2mel/modules/flow_matching.py +171 -0
- xinference/thirdparty/indextts/s2mel/modules/gpt_fast/generate.py +436 -0
- xinference/thirdparty/indextts/s2mel/modules/gpt_fast/model.py +360 -0
- xinference/thirdparty/indextts/s2mel/modules/gpt_fast/quantize.py +622 -0
- xinference/thirdparty/indextts/s2mel/modules/hifigan/f0_predictor.py +55 -0
- xinference/thirdparty/indextts/s2mel/modules/hifigan/generator.py +454 -0
- xinference/thirdparty/indextts/s2mel/modules/layers.py +354 -0
- xinference/thirdparty/indextts/s2mel/modules/length_regulator.py +141 -0
- xinference/thirdparty/indextts/s2mel/modules/openvoice/__init__.py +0 -0
- xinference/thirdparty/indextts/s2mel/modules/openvoice/api.py +186 -0
- xinference/thirdparty/indextts/s2mel/modules/openvoice/attentions.py +465 -0
- xinference/thirdparty/indextts/s2mel/modules/openvoice/checkpoints_v2/converter/config.json +57 -0
- xinference/thirdparty/indextts/s2mel/modules/openvoice/commons.py +160 -0
- xinference/thirdparty/indextts/s2mel/modules/openvoice/mel_processing.py +183 -0
- xinference/thirdparty/indextts/s2mel/modules/openvoice/models.py +499 -0
- xinference/thirdparty/indextts/s2mel/modules/openvoice/modules.py +598 -0
- xinference/thirdparty/indextts/s2mel/modules/openvoice/openvoice_app.py +275 -0
- xinference/thirdparty/indextts/s2mel/modules/openvoice/se_extractor.py +153 -0
- xinference/thirdparty/indextts/s2mel/modules/openvoice/transforms.py +209 -0
- xinference/thirdparty/indextts/s2mel/modules/openvoice/utils.py +194 -0
- xinference/thirdparty/indextts/s2mel/modules/quantize.py +229 -0
- xinference/thirdparty/indextts/s2mel/modules/rmvpe.py +631 -0
- xinference/thirdparty/indextts/s2mel/modules/vocos/__init__.py +4 -0
- xinference/thirdparty/indextts/s2mel/modules/vocos/heads.py +164 -0
- xinference/thirdparty/indextts/s2mel/modules/vocos/helpers.py +71 -0
- xinference/thirdparty/indextts/s2mel/modules/vocos/loss.py +114 -0
- xinference/thirdparty/indextts/s2mel/modules/vocos/models.py +118 -0
- xinference/thirdparty/indextts/s2mel/modules/vocos/modules.py +213 -0
- xinference/thirdparty/indextts/s2mel/modules/vocos/pretrained.py +51 -0
- xinference/thirdparty/indextts/s2mel/modules/vocos/spectral_ops.py +192 -0
- xinference/thirdparty/indextts/s2mel/modules/wavenet.py +174 -0
- xinference/thirdparty/indextts/s2mel/optimizers.py +96 -0
- xinference/thirdparty/indextts/s2mel/wav2vecbert_extract.py +148 -0
- xinference/thirdparty/indextts/utils/__init__.py +0 -0
- xinference/thirdparty/indextts/utils/arch_util.py +120 -0
- xinference/thirdparty/indextts/utils/checkpoint.py +34 -0
- xinference/thirdparty/indextts/utils/common.py +121 -0
- xinference/thirdparty/indextts/utils/feature_extractors.py +50 -0
- xinference/thirdparty/indextts/utils/front.py +536 -0
- xinference/thirdparty/indextts/utils/maskgct/models/codec/__init__.py +0 -0
- xinference/thirdparty/indextts/utils/maskgct/models/codec/amphion_codec/codec.py +427 -0
- xinference/thirdparty/indextts/utils/maskgct/models/codec/amphion_codec/quantize/__init__.py +11 -0
- xinference/thirdparty/indextts/utils/maskgct/models/codec/amphion_codec/quantize/factorized_vector_quantize.py +150 -0
- xinference/thirdparty/indextts/utils/maskgct/models/codec/amphion_codec/quantize/lookup_free_quantize.py +77 -0
- xinference/thirdparty/indextts/utils/maskgct/models/codec/amphion_codec/quantize/residual_vq.py +177 -0
- xinference/thirdparty/indextts/utils/maskgct/models/codec/amphion_codec/quantize/vector_quantize.py +401 -0
- xinference/thirdparty/indextts/utils/maskgct/models/codec/amphion_codec/vocos.py +881 -0
- xinference/thirdparty/indextts/utils/maskgct/models/codec/codec_dataset.py +264 -0
- xinference/thirdparty/indextts/utils/maskgct/models/codec/codec_inference.py +515 -0
- xinference/thirdparty/indextts/utils/maskgct/models/codec/codec_sampler.py +126 -0
- xinference/thirdparty/indextts/utils/maskgct/models/codec/codec_trainer.py +166 -0
- xinference/thirdparty/indextts/utils/maskgct/models/codec/facodec/__init__.py +0 -0
- xinference/thirdparty/indextts/utils/maskgct/models/codec/facodec/alias_free_torch/__init__.py +5 -0
- xinference/thirdparty/indextts/utils/maskgct/models/codec/facodec/alias_free_torch/act.py +29 -0
- xinference/thirdparty/indextts/utils/maskgct/models/codec/facodec/alias_free_torch/filter.py +96 -0
- xinference/thirdparty/indextts/utils/maskgct/models/codec/facodec/alias_free_torch/resample.py +57 -0
- xinference/thirdparty/indextts/utils/maskgct/models/codec/facodec/facodec_dataset.py +98 -0
- xinference/thirdparty/indextts/utils/maskgct/models/codec/facodec/facodec_inference.py +137 -0
- xinference/thirdparty/indextts/utils/maskgct/models/codec/facodec/facodec_trainer.py +776 -0
- xinference/thirdparty/indextts/utils/maskgct/models/codec/facodec/modules/JDC/__init__.py +1 -0
- xinference/thirdparty/indextts/utils/maskgct/models/codec/facodec/modules/JDC/bst.t7 +0 -0
- xinference/thirdparty/indextts/utils/maskgct/models/codec/facodec/modules/JDC/model.py +219 -0
- xinference/thirdparty/indextts/utils/maskgct/models/codec/facodec/modules/attentions.py +437 -0
- xinference/thirdparty/indextts/utils/maskgct/models/codec/facodec/modules/commons.py +331 -0
- xinference/thirdparty/indextts/utils/maskgct/models/codec/facodec/modules/gradient_reversal.py +35 -0
- xinference/thirdparty/indextts/utils/maskgct/models/codec/facodec/modules/layers.py +460 -0
- xinference/thirdparty/indextts/utils/maskgct/models/codec/facodec/modules/quantize.py +741 -0
- xinference/thirdparty/indextts/utils/maskgct/models/codec/facodec/modules/style_encoder.py +110 -0
- xinference/thirdparty/indextts/utils/maskgct/models/codec/facodec/modules/wavenet.py +224 -0
- xinference/thirdparty/indextts/utils/maskgct/models/codec/facodec/optimizer.py +104 -0
- xinference/thirdparty/indextts/utils/maskgct/models/codec/kmeans/repcodec_model.py +210 -0
- xinference/thirdparty/indextts/utils/maskgct/models/codec/kmeans/vocos.py +850 -0
- xinference/thirdparty/indextts/utils/maskgct/models/codec/melvqgan/melspec.py +108 -0
- xinference/thirdparty/indextts/utils/maskgct/models/codec/ns3_codec/README.md +216 -0
- xinference/thirdparty/indextts/utils/maskgct/models/codec/ns3_codec/__init__.py +6 -0
- xinference/thirdparty/indextts/utils/maskgct/models/codec/ns3_codec/alias_free_torch/__init__.py +5 -0
- xinference/thirdparty/indextts/utils/maskgct/models/codec/ns3_codec/alias_free_torch/act.py +29 -0
- xinference/thirdparty/indextts/utils/maskgct/models/codec/ns3_codec/alias_free_torch/filter.py +96 -0
- xinference/thirdparty/indextts/utils/maskgct/models/codec/ns3_codec/alias_free_torch/resample.py +57 -0
- xinference/thirdparty/indextts/utils/maskgct/models/codec/ns3_codec/facodec.py +1222 -0
- xinference/thirdparty/indextts/utils/maskgct/models/codec/ns3_codec/gradient_reversal.py +35 -0
- xinference/thirdparty/indextts/utils/maskgct/models/codec/ns3_codec/melspec.py +102 -0
- xinference/thirdparty/indextts/utils/maskgct/models/codec/ns3_codec/quantize/__init__.py +7 -0
- xinference/thirdparty/indextts/utils/maskgct/models/codec/ns3_codec/quantize/fvq.py +116 -0
- xinference/thirdparty/indextts/utils/maskgct/models/codec/ns3_codec/quantize/rvq.py +87 -0
- xinference/thirdparty/indextts/utils/maskgct/models/codec/ns3_codec/transformer.py +234 -0
- xinference/thirdparty/indextts/utils/maskgct/models/codec/speechtokenizer/model.py +184 -0
- xinference/thirdparty/indextts/utils/maskgct/models/codec/speechtokenizer/modules/__init__.py +27 -0
- xinference/thirdparty/indextts/utils/maskgct/models/codec/speechtokenizer/modules/conv.py +346 -0
- xinference/thirdparty/indextts/utils/maskgct/models/codec/speechtokenizer/modules/lstm.py +46 -0
- xinference/thirdparty/indextts/utils/maskgct/models/codec/speechtokenizer/modules/norm.py +37 -0
- xinference/thirdparty/indextts/utils/maskgct/models/codec/speechtokenizer/modules/quantization/__init__.py +14 -0
- xinference/thirdparty/indextts/utils/maskgct/models/codec/speechtokenizer/modules/quantization/ac.py +317 -0
- xinference/thirdparty/indextts/utils/maskgct/models/codec/speechtokenizer/modules/quantization/core_vq.py +388 -0
- xinference/thirdparty/indextts/utils/maskgct/models/codec/speechtokenizer/modules/quantization/distrib.py +135 -0
- xinference/thirdparty/indextts/utils/maskgct/models/codec/speechtokenizer/modules/quantization/vq.py +125 -0
- xinference/thirdparty/indextts/utils/maskgct/models/codec/speechtokenizer/modules/seanet.py +414 -0
- xinference/thirdparty/indextts/utils/maskgct/models/codec/vevo/vevo_repcodec.py +592 -0
- xinference/thirdparty/indextts/utils/maskgct/models/tts/maskgct/ckpt/wav2vec2bert_stats.pt +0 -0
- xinference/thirdparty/indextts/utils/maskgct/models/tts/maskgct/llama_nar.py +650 -0
- xinference/thirdparty/indextts/utils/maskgct/models/tts/maskgct/maskgct_s2a.py +503 -0
- xinference/thirdparty/indextts/utils/maskgct_utils.py +259 -0
- xinference/thirdparty/indextts/utils/text_utils.py +41 -0
- xinference/thirdparty/indextts/utils/typical_sampling.py +30 -0
- xinference/thirdparty/indextts/utils/utils.py +93 -0
- xinference/thirdparty/indextts/utils/webui_utils.py +42 -0
- xinference/thirdparty/indextts/utils/xtransformers.py +1247 -0
- xinference/thirdparty/indextts/vqvae/__init__.py +0 -0
- xinference/thirdparty/indextts/vqvae/xtts_dvae.py +395 -0
- xinference/ui/gradio/media_interface.py +66 -8
- xinference/ui/web/ui/build/asset-manifest.json +6 -6
- xinference/ui/web/ui/build/index.html +1 -1
- xinference/ui/web/ui/build/static/css/main.5ea97072.css +2 -0
- xinference/ui/web/ui/build/static/css/main.5ea97072.css.map +1 -0
- xinference/ui/web/ui/build/static/js/main.d192c4f3.js +3 -0
- xinference/ui/web/ui/build/static/js/{main.1086c759.js.LICENSE.txt → main.d192c4f3.js.LICENSE.txt} +0 -7
- xinference/ui/web/ui/build/static/js/main.d192c4f3.js.map +1 -0
- xinference/ui/web/ui/node_modules/.cache/babel-loader/089c38df5f52348d212ed868dda5c518a42e0c2762caed4175487c0405830c35.json +1 -0
- xinference/ui/web/ui/node_modules/.cache/babel-loader/2b6e3a5b6eb2c5c5f2d007e68cd46c372721cd52bf63508adcdb21ecf79241d8.json +1 -0
- xinference/ui/web/ui/node_modules/.cache/babel-loader/2d887825fd07a56f872eda4420da25fba0b5b62a23bdcc6c6da1a5281887f618.json +1 -0
- xinference/ui/web/ui/node_modules/.cache/babel-loader/4001f9c3e64e73a4f2158826650c174a59d5e3f89ddecddf17cbb6bb688cc4ca.json +1 -0
- xinference/ui/web/ui/node_modules/.cache/babel-loader/4a7018a69e6b7f90fc313248c2aa86f2a8f1eb1db120df586047a8023549b44b.json +1 -0
- xinference/ui/web/ui/node_modules/.cache/babel-loader/64b12aaa1c1d1bf53820ada8a63769067c0ccc5aab46b32348eb1917ae7f2a11.json +1 -0
- xinference/ui/web/ui/node_modules/.cache/babel-loader/7275b67c78ec76ce38a686bb8a576d8c9cecf54e1573614c84859d538efb9be5.json +1 -0
- xinference/ui/web/ui/node_modules/.cache/babel-loader/a68b6ee3b31eadc051fb95ce8f8ccb9c2e8b52c60f290dbab545a1917e065282.json +1 -0
- xinference/ui/web/ui/node_modules/.cache/babel-loader/ae8771cc37693feb160fa8727231312a0c54ef2d1d1ca893be568cd70016ca7e.json +1 -0
- xinference/ui/web/ui/node_modules/.cache/babel-loader/bb4e8722d2d41d87f1fce3661bc8937bffe9448e231fc5f0462630849e851592.json +1 -0
- xinference/ui/web/ui/node_modules/.cache/babel-loader/be6aada1ee4adc2bbf65dbe56d17db32bb3b5478be05d6b527805a8ba6cfb2b9.json +1 -0
- xinference/ui/web/ui/node_modules/.cache/babel-loader/de91c352653c233cf0cb6674e6e04049a44fd0e1156560de65d5c4620521391e.json +1 -0
- xinference/ui/web/ui/node_modules/.cache/babel-loader/e85f7002fc325c83b9c9cd8a1619e5b3ebc701d30e811afc284b88e6ae710cb5.json +1 -0
- xinference/ui/web/ui/node_modules/.cache/babel-loader/e8b603c78944bf3d213639078bfe155ff5c0dfa4048a93cbb967cad6a4eb4ff3.json +1 -0
- xinference/ui/web/ui/node_modules/.cache/babel-loader/f05535160a508b2a312de546a6de234776c613db276479ea4253c0b1bdeeb7d6.json +1 -0
- xinference/ui/web/ui/node_modules/.cache/babel-loader/f09ba9e11106bd59a0de10cc85c55084097729dcab575f43dfcf07375961ed87.json +1 -0
- xinference/ui/web/ui/node_modules/.cache/babel-loader/f995a2425dfb0822fd07127f66ffe9b026883bc156b402eb8bd0b83d52460a93.json +1 -0
- xinference/ui/web/ui/node_modules/.package-lock.json +0 -33
- xinference/ui/web/ui/package-lock.json +0 -34
- xinference/ui/web/ui/package.json +0 -1
- xinference/ui/web/ui/src/locales/en.json +9 -3
- xinference/ui/web/ui/src/locales/ja.json +9 -3
- xinference/ui/web/ui/src/locales/ko.json +9 -3
- xinference/ui/web/ui/src/locales/zh.json +9 -3
- {xinference-1.10.0.dist-info → xinference-1.10.1.dist-info}/METADATA +18 -2
- {xinference-1.10.0.dist-info → xinference-1.10.1.dist-info}/RECORD +285 -67
- xinference/ui/web/ui/build/static/css/main.013f296b.css +0 -2
- xinference/ui/web/ui/build/static/css/main.013f296b.css.map +0 -1
- xinference/ui/web/ui/build/static/js/main.1086c759.js +0 -3
- xinference/ui/web/ui/build/static/js/main.1086c759.js.map +0 -1
- xinference/ui/web/ui/node_modules/.cache/babel-loader/0b0f77000cc1b482ca091cfbcae511dfe02f08916971645fad21d0b1234d04a2.json +0 -1
- xinference/ui/web/ui/node_modules/.cache/babel-loader/1c5f8ff423a7c9202bea60b15680f04b1e9964b445b0da3f86c6ff70cf24e797.json +0 -1
- xinference/ui/web/ui/node_modules/.cache/babel-loader/44ce7993e344980e3ed4f13e8f69237d4a5dfc60e37ca6b54f51f8ee1357bd67.json +0 -1
- xinference/ui/web/ui/node_modules/.cache/babel-loader/4aec1cc414ac3ebb3481d3d915e4db597d9127de813291346eacb8554ab170d4.json +0 -1
- xinference/ui/web/ui/node_modules/.cache/babel-loader/644cfec52f3c57a6e222ce60f112237a1efefe9835efd9aad857a685f53d8eed.json +0 -1
- xinference/ui/web/ui/node_modules/.cache/babel-loader/663436f72af53fe0d72394f56d003fa4e0bba489e5bb4e483fd34b00f84637f7.json +0 -1
- xinference/ui/web/ui/node_modules/.cache/babel-loader/69db82ca9bfe27fe417cc6cf2b1716b09be9c6f0cd198530f12bfc60e801bbcf.json +0 -1
- xinference/ui/web/ui/node_modules/.cache/babel-loader/85087e27618d740c236bf159f30e0219db443ab55f0997388eed5fde6f9e90cc.json +0 -1
- xinference/ui/web/ui/node_modules/.cache/babel-loader/88b07838348864aa86c672be3bbca1e9f58f6f3a2881b32070ec27f4e7b449d1.json +0 -1
- xinference/ui/web/ui/node_modules/.cache/babel-loader/8b8cd408ccfbe115acef27ccfa5b233da8597131a2a5712add13e1e4d5d4504b.json +0 -1
- xinference/ui/web/ui/node_modules/.cache/babel-loader/a23824fe746b9c6ca5eee9159b5764d1ff1653c1d856288c0f75c742bbb0023b.json +0 -1
- xinference/ui/web/ui/node_modules/.cache/babel-loader/a3eb18af328280b139693c9092dff2a0ef8c9a967e6c8956ceee0996611f1984.json +0 -1
- xinference/ui/web/ui/node_modules/.cache/babel-loader/bc1aacc65a102db325ca61bcd2f681e1ae22c36a1f1d98a6ff5e4ad49dc7544f.json +0 -1
- xinference/ui/web/ui/node_modules/.cache/babel-loader/c682fd521747c19dae437d83ce3235a306ce6b68e24a117bc57c27ebb8d1f1ca.json +0 -1
- xinference/ui/web/ui/node_modules/.cache/babel-loader/d5c224be7081f18cba1678b7874a9782eba895df004874ff8f243f94ba79942a.json +0 -1
- xinference/ui/web/ui/node_modules/.cache/babel-loader/f7f18bfb539b036a6a342176dd98a85df5057a884a8da978d679f2a0264883d0.json +0 -1
- xinference/ui/web/ui/node_modules/clipboard/.babelrc.json +0 -11
- xinference/ui/web/ui/node_modules/clipboard/.eslintrc.json +0 -24
- xinference/ui/web/ui/node_modules/clipboard/.prettierrc.json +0 -9
- xinference/ui/web/ui/node_modules/clipboard/bower.json +0 -18
- xinference/ui/web/ui/node_modules/clipboard/composer.json +0 -25
- xinference/ui/web/ui/node_modules/clipboard/package.json +0 -63
- xinference/ui/web/ui/node_modules/delegate/package.json +0 -31
- xinference/ui/web/ui/node_modules/good-listener/bower.json +0 -11
- xinference/ui/web/ui/node_modules/good-listener/package.json +0 -35
- xinference/ui/web/ui/node_modules/select/bower.json +0 -13
- xinference/ui/web/ui/node_modules/select/package.json +0 -29
- xinference/ui/web/ui/node_modules/tiny-emitter/package.json +0 -53
- {xinference-1.10.0.dist-info → xinference-1.10.1.dist-info}/WHEEL +0 -0
- {xinference-1.10.0.dist-info → xinference-1.10.1.dist-info}/entry_points.txt +0 -0
- {xinference-1.10.0.dist-info → xinference-1.10.1.dist-info}/licenses/LICENSE +0 -0
- {xinference-1.10.0.dist-info → xinference-1.10.1.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
{
|
|
2
|
+
"resblock": "1",
|
|
3
|
+
"num_gpus": 0,
|
|
4
|
+
"batch_size": 32,
|
|
5
|
+
"learning_rate": 0.0001,
|
|
6
|
+
"adam_b1": 0.8,
|
|
7
|
+
"adam_b2": 0.99,
|
|
8
|
+
"lr_decay": 0.9999996,
|
|
9
|
+
"seed": 1234,
|
|
10
|
+
|
|
11
|
+
"upsample_rates": [4,4,2,2,2,2],
|
|
12
|
+
"upsample_kernel_sizes": [8,8,4,4,4,4],
|
|
13
|
+
"upsample_initial_channel": 1536,
|
|
14
|
+
"resblock_kernel_sizes": [3,7,11],
|
|
15
|
+
"resblock_dilation_sizes": [[1,3,5], [1,3,5], [1,3,5]],
|
|
16
|
+
|
|
17
|
+
"use_tanh_at_final": false,
|
|
18
|
+
"use_bias_at_final": false,
|
|
19
|
+
|
|
20
|
+
"activation": "snakebeta",
|
|
21
|
+
"snake_logscale": true,
|
|
22
|
+
|
|
23
|
+
"use_cqtd_instead_of_mrd": true,
|
|
24
|
+
"cqtd_filters": 128,
|
|
25
|
+
"cqtd_max_filters": 1024,
|
|
26
|
+
"cqtd_filters_scale": 1,
|
|
27
|
+
"cqtd_dilations": [1, 2, 4],
|
|
28
|
+
"cqtd_hop_lengths": [512, 256, 256],
|
|
29
|
+
"cqtd_n_octaves": [9, 9, 9],
|
|
30
|
+
"cqtd_bins_per_octaves": [24, 36, 48],
|
|
31
|
+
|
|
32
|
+
"mpd_reshapes": [2, 3, 5, 7, 11],
|
|
33
|
+
"use_spectral_norm": false,
|
|
34
|
+
"discriminator_channel_mult": 1,
|
|
35
|
+
|
|
36
|
+
"use_multiscale_melloss": true,
|
|
37
|
+
"lambda_melloss": 15,
|
|
38
|
+
|
|
39
|
+
"clip_grad_norm": 500,
|
|
40
|
+
|
|
41
|
+
"segment_size": 65536,
|
|
42
|
+
"num_mels": 80,
|
|
43
|
+
"num_freq": 1025,
|
|
44
|
+
"n_fft": 1024,
|
|
45
|
+
"hop_size": 256,
|
|
46
|
+
"win_size": 1024,
|
|
47
|
+
|
|
48
|
+
"sampling_rate": 22050,
|
|
49
|
+
|
|
50
|
+
"fmin": 0,
|
|
51
|
+
"fmax": null,
|
|
52
|
+
"fmax_for_loss": null,
|
|
53
|
+
|
|
54
|
+
"normalize_volume": true,
|
|
55
|
+
|
|
56
|
+
"num_workers": 4,
|
|
57
|
+
|
|
58
|
+
"dist_config": {
|
|
59
|
+
"dist_backend": "nccl",
|
|
60
|
+
"dist_url": "tcp://localhost:54321",
|
|
61
|
+
"world_size": 1
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Adapted from https://github.com/jik876/hifi-gan under the MIT license.
|
|
2
|
+
# LICENSE is in incl_licenses directory.
|
|
3
|
+
|
|
4
|
+
import os
|
|
5
|
+
import shutil
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class AttrDict(dict):
|
|
9
|
+
def __init__(self, *args, **kwargs):
|
|
10
|
+
super(AttrDict, self).__init__(*args, **kwargs)
|
|
11
|
+
self.__dict__ = self
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def build_env(config, config_name, path):
|
|
15
|
+
t_path = os.path.join(path, config_name)
|
|
16
|
+
if config != t_path:
|
|
17
|
+
os.makedirs(path, exist_ok=True)
|
|
18
|
+
shutil.copyfile(config, os.path.join(path, config_name))
|
|
@@ -0,0 +1,354 @@
|
|
|
1
|
+
# Copyright (c) 2024 NVIDIA CORPORATION.
|
|
2
|
+
# Licensed under the MIT license.
|
|
3
|
+
|
|
4
|
+
# Adapted from https://github.com/jik876/hifi-gan under the MIT license.
|
|
5
|
+
# LICENSE is in incl_licenses directory.
|
|
6
|
+
|
|
7
|
+
import math
|
|
8
|
+
import os
|
|
9
|
+
import random
|
|
10
|
+
import torch
|
|
11
|
+
import torch.utils.data
|
|
12
|
+
import numpy as np
|
|
13
|
+
from librosa.util import normalize
|
|
14
|
+
from scipy.io.wavfile import read
|
|
15
|
+
from librosa.filters import mel as librosa_mel_fn
|
|
16
|
+
import pathlib
|
|
17
|
+
from tqdm import tqdm
|
|
18
|
+
|
|
19
|
+
MAX_WAV_VALUE = 32767.0 # NOTE: 32768.0 -1 to prevent int16 overflow (results in popping sound in corner cases)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def load_wav(full_path, sr_target):
|
|
23
|
+
sampling_rate, data = read(full_path)
|
|
24
|
+
if sampling_rate != sr_target:
|
|
25
|
+
raise RuntimeError(
|
|
26
|
+
f"Sampling rate of the file {full_path} is {sampling_rate} Hz, but the model requires {sr_target} Hz"
|
|
27
|
+
)
|
|
28
|
+
return data, sampling_rate
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def dynamic_range_compression(x, C=1, clip_val=1e-5):
|
|
32
|
+
return np.log(np.clip(x, a_min=clip_val, a_max=None) * C)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def dynamic_range_decompression(x, C=1):
|
|
36
|
+
return np.exp(x) / C
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def dynamic_range_compression_torch(x, C=1, clip_val=1e-5):
|
|
40
|
+
return torch.log(torch.clamp(x, min=clip_val) * C)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def dynamic_range_decompression_torch(x, C=1):
|
|
44
|
+
return torch.exp(x) / C
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def spectral_normalize_torch(magnitudes):
|
|
48
|
+
return dynamic_range_compression_torch(magnitudes)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def spectral_de_normalize_torch(magnitudes):
|
|
52
|
+
return dynamic_range_decompression_torch(magnitudes)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
mel_basis_cache = {}
|
|
56
|
+
hann_window_cache = {}
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def mel_spectrogram(
|
|
60
|
+
y: torch.Tensor,
|
|
61
|
+
n_fft: int,
|
|
62
|
+
num_mels: int,
|
|
63
|
+
sampling_rate: int,
|
|
64
|
+
hop_size: int,
|
|
65
|
+
win_size: int,
|
|
66
|
+
fmin: int,
|
|
67
|
+
fmax: int = None,
|
|
68
|
+
center: bool = False,
|
|
69
|
+
) -> torch.Tensor:
|
|
70
|
+
"""
|
|
71
|
+
Calculate the mel spectrogram of an input signal.
|
|
72
|
+
This function uses slaney norm for the librosa mel filterbank (using librosa.filters.mel) and uses Hann window for STFT (using torch.stft).
|
|
73
|
+
|
|
74
|
+
Args:
|
|
75
|
+
y (torch.Tensor): Input signal.
|
|
76
|
+
n_fft (int): FFT size.
|
|
77
|
+
num_mels (int): Number of mel bins.
|
|
78
|
+
sampling_rate (int): Sampling rate of the input signal.
|
|
79
|
+
hop_size (int): Hop size for STFT.
|
|
80
|
+
win_size (int): Window size for STFT.
|
|
81
|
+
fmin (int): Minimum frequency for mel filterbank.
|
|
82
|
+
fmax (int): Maximum frequency for mel filterbank. If None, defaults to half the sampling rate (fmax = sr / 2.0) inside librosa_mel_fn
|
|
83
|
+
center (bool): Whether to pad the input to center the frames. Default is False.
|
|
84
|
+
|
|
85
|
+
Returns:
|
|
86
|
+
torch.Tensor: Mel spectrogram.
|
|
87
|
+
"""
|
|
88
|
+
if torch.min(y) < -1.0:
|
|
89
|
+
print(f"[WARNING] Min value of input waveform signal is {torch.min(y)}")
|
|
90
|
+
if torch.max(y) > 1.0:
|
|
91
|
+
print(f"[WARNING] Max value of input waveform signal is {torch.max(y)}")
|
|
92
|
+
|
|
93
|
+
device = y.device
|
|
94
|
+
key = f"{n_fft}_{num_mels}_{sampling_rate}_{hop_size}_{win_size}_{fmin}_{fmax}_{device}"
|
|
95
|
+
|
|
96
|
+
if key not in mel_basis_cache:
|
|
97
|
+
mel = librosa_mel_fn(
|
|
98
|
+
sr=sampling_rate, n_fft=n_fft, n_mels=num_mels, fmin=fmin, fmax=fmax
|
|
99
|
+
)
|
|
100
|
+
mel_basis_cache[key] = torch.from_numpy(mel).float().to(device)
|
|
101
|
+
hann_window_cache[key] = torch.hann_window(win_size).to(device)
|
|
102
|
+
|
|
103
|
+
mel_basis = mel_basis_cache[key]
|
|
104
|
+
hann_window = hann_window_cache[key]
|
|
105
|
+
|
|
106
|
+
padding = (n_fft - hop_size) // 2
|
|
107
|
+
y = torch.nn.functional.pad(
|
|
108
|
+
y.unsqueeze(1), (padding, padding), mode="reflect"
|
|
109
|
+
).squeeze(1)
|
|
110
|
+
|
|
111
|
+
spec = torch.stft(
|
|
112
|
+
y,
|
|
113
|
+
n_fft,
|
|
114
|
+
hop_length=hop_size,
|
|
115
|
+
win_length=win_size,
|
|
116
|
+
window=hann_window,
|
|
117
|
+
center=center,
|
|
118
|
+
pad_mode="reflect",
|
|
119
|
+
normalized=False,
|
|
120
|
+
onesided=True,
|
|
121
|
+
return_complex=True,
|
|
122
|
+
)
|
|
123
|
+
spec = torch.sqrt(torch.view_as_real(spec).pow(2).sum(-1) + 1e-9)
|
|
124
|
+
|
|
125
|
+
mel_spec = torch.matmul(mel_basis, spec)
|
|
126
|
+
mel_spec = spectral_normalize_torch(mel_spec)
|
|
127
|
+
|
|
128
|
+
return mel_spec
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
def get_mel_spectrogram(wav, h):
|
|
132
|
+
"""
|
|
133
|
+
Generate mel spectrogram from a waveform using given hyperparameters.
|
|
134
|
+
|
|
135
|
+
Args:
|
|
136
|
+
wav (torch.Tensor): Input waveform.
|
|
137
|
+
h: Hyperparameters object with attributes n_fft, num_mels, sampling_rate, hop_size, win_size, fmin, fmax.
|
|
138
|
+
|
|
139
|
+
Returns:
|
|
140
|
+
torch.Tensor: Mel spectrogram.
|
|
141
|
+
"""
|
|
142
|
+
return mel_spectrogram(
|
|
143
|
+
wav,
|
|
144
|
+
h.n_fft,
|
|
145
|
+
h.num_mels,
|
|
146
|
+
h.sampling_rate,
|
|
147
|
+
h.hop_size,
|
|
148
|
+
h.win_size,
|
|
149
|
+
h.fmin,
|
|
150
|
+
h.fmax,
|
|
151
|
+
)
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
def get_dataset_filelist(a):
|
|
155
|
+
training_files = []
|
|
156
|
+
validation_files = []
|
|
157
|
+
list_unseen_validation_files = []
|
|
158
|
+
|
|
159
|
+
with open(a.input_training_file, "r", encoding="utf-8") as fi:
|
|
160
|
+
training_files = [
|
|
161
|
+
os.path.join(a.input_wavs_dir, x.split("|")[0] + ".wav")
|
|
162
|
+
for x in fi.read().split("\n")
|
|
163
|
+
if len(x) > 0
|
|
164
|
+
]
|
|
165
|
+
print(f"first training file: {training_files[0]}")
|
|
166
|
+
|
|
167
|
+
with open(a.input_validation_file, "r", encoding="utf-8") as fi:
|
|
168
|
+
validation_files = [
|
|
169
|
+
os.path.join(a.input_wavs_dir, x.split("|")[0] + ".wav")
|
|
170
|
+
for x in fi.read().split("\n")
|
|
171
|
+
if len(x) > 0
|
|
172
|
+
]
|
|
173
|
+
print(f"first validation file: {validation_files[0]}")
|
|
174
|
+
|
|
175
|
+
for i in range(len(a.list_input_unseen_validation_file)):
|
|
176
|
+
with open(a.list_input_unseen_validation_file[i], "r", encoding="utf-8") as fi:
|
|
177
|
+
unseen_validation_files = [
|
|
178
|
+
os.path.join(a.list_input_unseen_wavs_dir[i], x.split("|")[0] + ".wav")
|
|
179
|
+
for x in fi.read().split("\n")
|
|
180
|
+
if len(x) > 0
|
|
181
|
+
]
|
|
182
|
+
print(
|
|
183
|
+
f"first unseen {i}th validation fileset: {unseen_validation_files[0]}"
|
|
184
|
+
)
|
|
185
|
+
list_unseen_validation_files.append(unseen_validation_files)
|
|
186
|
+
|
|
187
|
+
return training_files, validation_files, list_unseen_validation_files
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
class MelDataset(torch.utils.data.Dataset):
|
|
191
|
+
def __init__(
|
|
192
|
+
self,
|
|
193
|
+
training_files,
|
|
194
|
+
hparams,
|
|
195
|
+
segment_size,
|
|
196
|
+
n_fft,
|
|
197
|
+
num_mels,
|
|
198
|
+
hop_size,
|
|
199
|
+
win_size,
|
|
200
|
+
sampling_rate,
|
|
201
|
+
fmin,
|
|
202
|
+
fmax,
|
|
203
|
+
split=True,
|
|
204
|
+
shuffle=True,
|
|
205
|
+
n_cache_reuse=1,
|
|
206
|
+
device=None,
|
|
207
|
+
fmax_loss=None,
|
|
208
|
+
fine_tuning=False,
|
|
209
|
+
base_mels_path=None,
|
|
210
|
+
is_seen=True,
|
|
211
|
+
):
|
|
212
|
+
self.audio_files = training_files
|
|
213
|
+
random.seed(1234)
|
|
214
|
+
if shuffle:
|
|
215
|
+
random.shuffle(self.audio_files)
|
|
216
|
+
self.hparams = hparams
|
|
217
|
+
self.is_seen = is_seen
|
|
218
|
+
if self.is_seen:
|
|
219
|
+
self.name = pathlib.Path(self.audio_files[0]).parts[0]
|
|
220
|
+
else:
|
|
221
|
+
self.name = "-".join(pathlib.Path(self.audio_files[0]).parts[:2]).strip("/")
|
|
222
|
+
|
|
223
|
+
self.segment_size = segment_size
|
|
224
|
+
self.sampling_rate = sampling_rate
|
|
225
|
+
self.split = split
|
|
226
|
+
self.n_fft = n_fft
|
|
227
|
+
self.num_mels = num_mels
|
|
228
|
+
self.hop_size = hop_size
|
|
229
|
+
self.win_size = win_size
|
|
230
|
+
self.fmin = fmin
|
|
231
|
+
self.fmax = fmax
|
|
232
|
+
self.fmax_loss = fmax_loss
|
|
233
|
+
self.cached_wav = None
|
|
234
|
+
self.n_cache_reuse = n_cache_reuse
|
|
235
|
+
self._cache_ref_count = 0
|
|
236
|
+
self.device = device
|
|
237
|
+
self.fine_tuning = fine_tuning
|
|
238
|
+
self.base_mels_path = base_mels_path
|
|
239
|
+
|
|
240
|
+
print("[INFO] checking dataset integrity...")
|
|
241
|
+
for i in tqdm(range(len(self.audio_files))):
|
|
242
|
+
assert os.path.exists(
|
|
243
|
+
self.audio_files[i]
|
|
244
|
+
), f"{self.audio_files[i]} not found"
|
|
245
|
+
|
|
246
|
+
def __getitem__(self, index):
|
|
247
|
+
filename = self.audio_files[index]
|
|
248
|
+
if self._cache_ref_count == 0:
|
|
249
|
+
audio, sampling_rate = load_wav(filename, self.sampling_rate)
|
|
250
|
+
audio = audio / MAX_WAV_VALUE
|
|
251
|
+
if not self.fine_tuning:
|
|
252
|
+
audio = normalize(audio) * 0.95
|
|
253
|
+
self.cached_wav = audio
|
|
254
|
+
if sampling_rate != self.sampling_rate:
|
|
255
|
+
raise ValueError(
|
|
256
|
+
f"{sampling_rate} SR doesn't match target {self.sampling_rate} SR"
|
|
257
|
+
)
|
|
258
|
+
self._cache_ref_count = self.n_cache_reuse
|
|
259
|
+
else:
|
|
260
|
+
audio = self.cached_wav
|
|
261
|
+
self._cache_ref_count -= 1
|
|
262
|
+
|
|
263
|
+
audio = torch.FloatTensor(audio)
|
|
264
|
+
audio = audio.unsqueeze(0)
|
|
265
|
+
|
|
266
|
+
if not self.fine_tuning:
|
|
267
|
+
if self.split:
|
|
268
|
+
if audio.size(1) >= self.segment_size:
|
|
269
|
+
max_audio_start = audio.size(1) - self.segment_size
|
|
270
|
+
audio_start = random.randint(0, max_audio_start)
|
|
271
|
+
audio = audio[:, audio_start : audio_start + self.segment_size]
|
|
272
|
+
else:
|
|
273
|
+
audio = torch.nn.functional.pad(
|
|
274
|
+
audio, (0, self.segment_size - audio.size(1)), "constant"
|
|
275
|
+
)
|
|
276
|
+
|
|
277
|
+
mel = mel_spectrogram(
|
|
278
|
+
audio,
|
|
279
|
+
self.n_fft,
|
|
280
|
+
self.num_mels,
|
|
281
|
+
self.sampling_rate,
|
|
282
|
+
self.hop_size,
|
|
283
|
+
self.win_size,
|
|
284
|
+
self.fmin,
|
|
285
|
+
self.fmax,
|
|
286
|
+
center=False,
|
|
287
|
+
)
|
|
288
|
+
else: # Validation step
|
|
289
|
+
# Match audio length to self.hop_size * n for evaluation
|
|
290
|
+
if (audio.size(1) % self.hop_size) != 0:
|
|
291
|
+
audio = audio[:, : -(audio.size(1) % self.hop_size)]
|
|
292
|
+
mel = mel_spectrogram(
|
|
293
|
+
audio,
|
|
294
|
+
self.n_fft,
|
|
295
|
+
self.num_mels,
|
|
296
|
+
self.sampling_rate,
|
|
297
|
+
self.hop_size,
|
|
298
|
+
self.win_size,
|
|
299
|
+
self.fmin,
|
|
300
|
+
self.fmax,
|
|
301
|
+
center=False,
|
|
302
|
+
)
|
|
303
|
+
assert (
|
|
304
|
+
audio.shape[1] == mel.shape[2] * self.hop_size
|
|
305
|
+
), f"audio shape {audio.shape} mel shape {mel.shape}"
|
|
306
|
+
|
|
307
|
+
else:
|
|
308
|
+
mel = np.load(
|
|
309
|
+
os.path.join(
|
|
310
|
+
self.base_mels_path,
|
|
311
|
+
os.path.splitext(os.path.split(filename)[-1])[0] + ".npy",
|
|
312
|
+
)
|
|
313
|
+
)
|
|
314
|
+
mel = torch.from_numpy(mel)
|
|
315
|
+
|
|
316
|
+
if len(mel.shape) < 3:
|
|
317
|
+
mel = mel.unsqueeze(0)
|
|
318
|
+
|
|
319
|
+
if self.split:
|
|
320
|
+
frames_per_seg = math.ceil(self.segment_size / self.hop_size)
|
|
321
|
+
|
|
322
|
+
if audio.size(1) >= self.segment_size:
|
|
323
|
+
mel_start = random.randint(0, mel.size(2) - frames_per_seg - 1)
|
|
324
|
+
mel = mel[:, :, mel_start : mel_start + frames_per_seg]
|
|
325
|
+
audio = audio[
|
|
326
|
+
:,
|
|
327
|
+
mel_start
|
|
328
|
+
* self.hop_size : (mel_start + frames_per_seg)
|
|
329
|
+
* self.hop_size,
|
|
330
|
+
]
|
|
331
|
+
else:
|
|
332
|
+
mel = torch.nn.functional.pad(
|
|
333
|
+
mel, (0, frames_per_seg - mel.size(2)), "constant"
|
|
334
|
+
)
|
|
335
|
+
audio = torch.nn.functional.pad(
|
|
336
|
+
audio, (0, self.segment_size - audio.size(1)), "constant"
|
|
337
|
+
)
|
|
338
|
+
|
|
339
|
+
mel_loss = mel_spectrogram(
|
|
340
|
+
audio,
|
|
341
|
+
self.n_fft,
|
|
342
|
+
self.num_mels,
|
|
343
|
+
self.sampling_rate,
|
|
344
|
+
self.hop_size,
|
|
345
|
+
self.win_size,
|
|
346
|
+
self.fmin,
|
|
347
|
+
self.fmax_loss,
|
|
348
|
+
center=False,
|
|
349
|
+
)
|
|
350
|
+
|
|
351
|
+
return (mel.squeeze(), audio.squeeze(0), filename, mel_loss.squeeze())
|
|
352
|
+
|
|
353
|
+
def __len__(self):
|
|
354
|
+
return len(self.audio_files)
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# Adapted from https://github.com/jik876/hifi-gan under the MIT license.
|
|
2
|
+
# LICENSE is in incl_licenses directory.
|
|
3
|
+
|
|
4
|
+
import glob
|
|
5
|
+
import os
|
|
6
|
+
import matplotlib
|
|
7
|
+
import torch
|
|
8
|
+
from torch.nn.utils import weight_norm
|
|
9
|
+
|
|
10
|
+
matplotlib.use("Agg")
|
|
11
|
+
import matplotlib.pylab as plt
|
|
12
|
+
from .meldataset import MAX_WAV_VALUE
|
|
13
|
+
from scipy.io.wavfile import write
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def plot_spectrogram(spectrogram):
|
|
17
|
+
fig, ax = plt.subplots(figsize=(10, 2))
|
|
18
|
+
im = ax.imshow(spectrogram, aspect="auto", origin="lower", interpolation="none")
|
|
19
|
+
plt.colorbar(im, ax=ax)
|
|
20
|
+
|
|
21
|
+
fig.canvas.draw()
|
|
22
|
+
plt.close()
|
|
23
|
+
|
|
24
|
+
return fig
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def plot_spectrogram_clipped(spectrogram, clip_max=2.0):
|
|
28
|
+
fig, ax = plt.subplots(figsize=(10, 2))
|
|
29
|
+
im = ax.imshow(
|
|
30
|
+
spectrogram,
|
|
31
|
+
aspect="auto",
|
|
32
|
+
origin="lower",
|
|
33
|
+
interpolation="none",
|
|
34
|
+
vmin=1e-6,
|
|
35
|
+
vmax=clip_max,
|
|
36
|
+
)
|
|
37
|
+
plt.colorbar(im, ax=ax)
|
|
38
|
+
|
|
39
|
+
fig.canvas.draw()
|
|
40
|
+
plt.close()
|
|
41
|
+
|
|
42
|
+
return fig
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def init_weights(m, mean=0.0, std=0.01):
|
|
46
|
+
classname = m.__class__.__name__
|
|
47
|
+
if classname.find("Conv") != -1:
|
|
48
|
+
m.weight.data.normal_(mean, std)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def apply_weight_norm(m):
|
|
52
|
+
classname = m.__class__.__name__
|
|
53
|
+
if classname.find("Conv") != -1:
|
|
54
|
+
weight_norm(m)
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def get_padding(kernel_size, dilation=1):
|
|
58
|
+
return int((kernel_size * dilation - dilation) / 2)
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def load_checkpoint(filepath, device):
|
|
62
|
+
assert os.path.isfile(filepath)
|
|
63
|
+
print(f"Loading '{filepath}'")
|
|
64
|
+
checkpoint_dict = torch.load(filepath, map_location=device)
|
|
65
|
+
print("Complete.")
|
|
66
|
+
return checkpoint_dict
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def save_checkpoint(filepath, obj):
|
|
70
|
+
print(f"Saving checkpoint to {filepath}")
|
|
71
|
+
torch.save(obj, filepath)
|
|
72
|
+
print("Complete.")
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
def scan_checkpoint(cp_dir, prefix, renamed_file=None):
|
|
76
|
+
# Fallback to original scanning logic first
|
|
77
|
+
pattern = os.path.join(cp_dir, prefix + "????????")
|
|
78
|
+
cp_list = glob.glob(pattern)
|
|
79
|
+
|
|
80
|
+
if len(cp_list) > 0:
|
|
81
|
+
last_checkpoint_path = sorted(cp_list)[-1]
|
|
82
|
+
print(f"[INFO] Resuming from checkpoint: '{last_checkpoint_path}'")
|
|
83
|
+
return last_checkpoint_path
|
|
84
|
+
|
|
85
|
+
# If no pattern-based checkpoints are found, check for renamed file
|
|
86
|
+
if renamed_file:
|
|
87
|
+
renamed_path = os.path.join(cp_dir, renamed_file)
|
|
88
|
+
if os.path.isfile(renamed_path):
|
|
89
|
+
print(f"[INFO] Resuming from renamed checkpoint: '{renamed_file}'")
|
|
90
|
+
return renamed_path
|
|
91
|
+
|
|
92
|
+
return None
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
def save_audio(audio, path, sr):
|
|
96
|
+
# wav: torch with 1d shape
|
|
97
|
+
audio = audio * MAX_WAV_VALUE
|
|
98
|
+
audio = audio.cpu().numpy().astype("int16")
|
|
99
|
+
write(path, sr, audio)
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
# Copyright 3D-Speaker (https://github.com/alibaba-damo-academy/3D-Speaker). All Rights Reserved.
|
|
2
|
+
# Licensed under the Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
|
|
3
|
+
|
|
4
|
+
from collections import OrderedDict
|
|
5
|
+
|
|
6
|
+
import torch
|
|
7
|
+
from torch import nn
|
|
8
|
+
import torch.nn.functional as F
|
|
9
|
+
|
|
10
|
+
from indextts.s2mel.modules.campplus.layers import DenseLayer, StatsPool, TDNNLayer, CAMDenseTDNNBlock, TransitLayer, BasicResBlock, get_nonlinear
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class FCM(nn.Module):
|
|
14
|
+
def __init__(self,
|
|
15
|
+
block=BasicResBlock,
|
|
16
|
+
num_blocks=[2, 2],
|
|
17
|
+
m_channels=32,
|
|
18
|
+
feat_dim=80):
|
|
19
|
+
super(FCM, self).__init__()
|
|
20
|
+
self.in_planes = m_channels
|
|
21
|
+
self.conv1 = nn.Conv2d(1, m_channels, kernel_size=3, stride=1, padding=1, bias=False)
|
|
22
|
+
self.bn1 = nn.BatchNorm2d(m_channels)
|
|
23
|
+
|
|
24
|
+
self.layer1 = self._make_layer(block, m_channels, num_blocks[0], stride=2)
|
|
25
|
+
self.layer2 = self._make_layer(block, m_channels, num_blocks[1], stride=2)
|
|
26
|
+
|
|
27
|
+
self.conv2 = nn.Conv2d(m_channels, m_channels, kernel_size=3, stride=(2, 1), padding=1, bias=False)
|
|
28
|
+
self.bn2 = nn.BatchNorm2d(m_channels)
|
|
29
|
+
self.out_channels = m_channels * (feat_dim // 8)
|
|
30
|
+
|
|
31
|
+
def _make_layer(self, block, planes, num_blocks, stride):
|
|
32
|
+
strides = [stride] + [1] * (num_blocks - 1)
|
|
33
|
+
layers = []
|
|
34
|
+
for stride in strides:
|
|
35
|
+
layers.append(block(self.in_planes, planes, stride))
|
|
36
|
+
self.in_planes = planes * block.expansion
|
|
37
|
+
return nn.Sequential(*layers)
|
|
38
|
+
|
|
39
|
+
def forward(self, x):
|
|
40
|
+
x = x.unsqueeze(1)
|
|
41
|
+
out = F.relu(self.bn1(self.conv1(x)))
|
|
42
|
+
out = self.layer1(out)
|
|
43
|
+
out = self.layer2(out)
|
|
44
|
+
out = F.relu(self.bn2(self.conv2(out)))
|
|
45
|
+
|
|
46
|
+
shape = out.shape
|
|
47
|
+
out = out.reshape(shape[0], shape[1]*shape[2], shape[3])
|
|
48
|
+
return out
|
|
49
|
+
|
|
50
|
+
class CAMPPlus(nn.Module):
|
|
51
|
+
def __init__(self,
|
|
52
|
+
feat_dim=80,
|
|
53
|
+
embedding_size=512,
|
|
54
|
+
growth_rate=32,
|
|
55
|
+
bn_size=4,
|
|
56
|
+
init_channels=128,
|
|
57
|
+
config_str='batchnorm-relu',
|
|
58
|
+
memory_efficient=True):
|
|
59
|
+
super(CAMPPlus, self).__init__()
|
|
60
|
+
|
|
61
|
+
self.head = FCM(feat_dim=feat_dim)
|
|
62
|
+
channels = self.head.out_channels
|
|
63
|
+
|
|
64
|
+
self.xvector = nn.Sequential(
|
|
65
|
+
OrderedDict([
|
|
66
|
+
|
|
67
|
+
('tdnn',
|
|
68
|
+
TDNNLayer(channels,
|
|
69
|
+
init_channels,
|
|
70
|
+
5,
|
|
71
|
+
stride=2,
|
|
72
|
+
dilation=1,
|
|
73
|
+
padding=-1,
|
|
74
|
+
config_str=config_str)),
|
|
75
|
+
]))
|
|
76
|
+
channels = init_channels
|
|
77
|
+
for i, (num_layers, kernel_size,
|
|
78
|
+
dilation) in enumerate(zip((12, 24, 16), (3, 3, 3), (1, 2, 2))):
|
|
79
|
+
block = CAMDenseTDNNBlock(num_layers=num_layers,
|
|
80
|
+
in_channels=channels,
|
|
81
|
+
out_channels=growth_rate,
|
|
82
|
+
bn_channels=bn_size * growth_rate,
|
|
83
|
+
kernel_size=kernel_size,
|
|
84
|
+
dilation=dilation,
|
|
85
|
+
config_str=config_str,
|
|
86
|
+
memory_efficient=memory_efficient)
|
|
87
|
+
self.xvector.add_module('block%d' % (i + 1), block)
|
|
88
|
+
channels = channels + num_layers * growth_rate
|
|
89
|
+
self.xvector.add_module(
|
|
90
|
+
'transit%d' % (i + 1),
|
|
91
|
+
TransitLayer(channels,
|
|
92
|
+
channels // 2,
|
|
93
|
+
bias=False,
|
|
94
|
+
config_str=config_str))
|
|
95
|
+
channels //= 2
|
|
96
|
+
|
|
97
|
+
self.xvector.add_module(
|
|
98
|
+
'out_nonlinear', get_nonlinear(config_str, channels))
|
|
99
|
+
|
|
100
|
+
self.xvector.add_module('stats', StatsPool())
|
|
101
|
+
self.xvector.add_module(
|
|
102
|
+
'dense',
|
|
103
|
+
DenseLayer(channels * 2, embedding_size, config_str='batchnorm_'))
|
|
104
|
+
|
|
105
|
+
for m in self.modules():
|
|
106
|
+
if isinstance(m, (nn.Conv1d, nn.Linear)):
|
|
107
|
+
nn.init.kaiming_normal_(m.weight.data)
|
|
108
|
+
if m.bias is not None:
|
|
109
|
+
nn.init.zeros_(m.bias)
|
|
110
|
+
|
|
111
|
+
def forward(self, x):
|
|
112
|
+
x = x.permute(0, 2, 1) # (B,T,F) => (B,F,T)
|
|
113
|
+
x = self.head(x)
|
|
114
|
+
x = self.xvector(x)
|
|
115
|
+
return x
|