echogarden 0.12.2 → 1.0.0
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.
- package/README.md +15 -14
- package/data/schemas/options.json +398 -111
- package/dist/alignment/DTWMfccSequenceAlignment.d.ts +1 -1
- package/dist/alignment/DTWMfccSequenceAlignment.js +8 -8
- package/dist/alignment/DTWSequenceAlignment.d.ts +1 -1
- package/dist/alignment/DTWSequenceAlignment.js +1 -1
- package/dist/alignment/DTWSequenceAlignmentWindowed.d.ts +1 -1
- package/dist/alignment/DTWSequenceAlignmentWindowed.js +2 -2
- package/dist/alignment/LevenshteinSequenceAlignment.d.ts +1 -1
- package/dist/alignment/LevenshteinSequenceAlignment.js +1 -1
- package/dist/alignment/SpeechAlignment.d.ts +9 -10
- package/dist/alignment/SpeechAlignment.js +136 -105
- package/dist/alignment/SpeechAlignment.js.map +1 -1
- package/dist/api/API.d.ts +13 -12
- package/dist/api/API.js +14 -13
- package/dist/api/API.js.map +1 -1
- package/dist/api/APIOptions.d.ts +5 -4
- package/dist/api/Alignment.d.ts +15 -9
- package/dist/api/Alignment.js +88 -74
- package/dist/api/Alignment.js.map +1 -1
- package/dist/api/Common.js +1 -1
- package/dist/api/Denoising.d.ts +6 -6
- package/dist/api/Denoising.js +23 -23
- package/dist/api/Denoising.js.map +1 -1
- package/dist/api/LanguageDetection.d.ts +19 -12
- package/dist/api/LanguageDetection.js +88 -38
- package/dist/api/LanguageDetection.js.map +1 -1
- package/dist/api/Recognition.d.ts +16 -6
- package/dist/api/Recognition.js +129 -55
- package/dist/api/Recognition.js.map +1 -1
- package/dist/api/SourceSeparation.d.ts +17 -0
- package/dist/api/SourceSeparation.js +61 -0
- package/dist/api/SourceSeparation.js.map +1 -0
- package/dist/api/Synthesis.d.ts +18 -18
- package/dist/api/Synthesis.js +191 -164
- package/dist/api/Synthesis.js.map +1 -1
- package/dist/api/Translation.d.ts +19 -8
- package/dist/api/Translation.js +132 -35
- package/dist/api/Translation.js.map +1 -1
- package/dist/api/Vad.d.ts +10 -5
- package/dist/api/Vad.js +76 -38
- package/dist/api/Vad.js.map +1 -1
- package/dist/audio/AudioBufferConversion.d.ts +1 -1
- package/dist/audio/AudioBufferConversion.js +4 -4
- package/dist/audio/AudioPlayer.d.ts +1 -1
- package/dist/audio/AudioPlayer.js +26 -26
- package/dist/audio/AudioPlayer.js.map +1 -1
- package/dist/audio/AudioRecorder.d.ts +1 -1
- package/dist/audio/AudioRecorder.js +5 -5
- package/dist/audio/AudioUtilities.d.ts +13 -9
- package/dist/audio/AudioUtilities.js +86 -24
- package/dist/audio/AudioUtilities.js.map +1 -1
- package/dist/cli/CLI.d.ts +3 -3
- package/dist/cli/CLI.js +271 -162
- package/dist/cli/CLI.js.map +1 -1
- package/dist/cli/CLIConfigFile.js +8 -8
- package/dist/cli/CLILauncher.js +6 -6
- package/dist/cli/CLIOptionsSchema.js +2 -2
- package/dist/cli/CLIParser.js +5 -5
- package/dist/cli/CLIStarter.js +4 -4
- package/dist/codecs/FFMpegTranscoder.d.ts +2 -2
- package/dist/codecs/FFMpegTranscoder.js +37 -37
- package/dist/codecs/FFMpegTranscoder.js.map +1 -1
- package/dist/codecs/TIMITCodec.js +5 -5
- package/dist/codecs/WaveCodec.d.ts +1 -1
- package/dist/codecs/WaveCodec.js +22 -22
- package/dist/denoising/RNNoise.d.ts +1 -1
- package/dist/denoising/RNNoise.js +9 -9
- package/dist/dsp/BiquadFilter.d.ts +3 -2
- package/dist/dsp/BiquadFilter.js +18 -11
- package/dist/dsp/BiquadFilter.js.map +1 -1
- package/dist/dsp/DecayingPeakEstimator.d.ts +16 -0
- package/dist/dsp/DecayingPeakEstimator.js +23 -0
- package/dist/dsp/DecayingPeakEstimator.js.map +1 -0
- package/dist/dsp/FFT.d.ts +8 -4
- package/dist/dsp/FFT.js +76 -30
- package/dist/dsp/FFT.js.map +1 -1
- package/dist/dsp/KWeightingFilter.d.ts +9 -0
- package/dist/dsp/KWeightingFilter.js +40 -0
- package/dist/dsp/KWeightingFilter.js.map +1 -0
- package/dist/dsp/LoudnessEstimator.d.ts +21 -0
- package/dist/dsp/LoudnessEstimator.js +47 -0
- package/dist/dsp/LoudnessEstimator.js.map +1 -0
- package/dist/dsp/MFCC.d.ts +2 -2
- package/dist/dsp/MFCC.js +15 -15
- package/dist/dsp/MelSpectogram.d.ts +1 -1
- package/dist/dsp/MelSpectogram.js +6 -6
- package/dist/dsp/Rubberband.d.ts +11 -11
- package/dist/dsp/Rubberband.js +27 -27
- package/dist/dsp/Sonic.d.ts +1 -1
- package/dist/dsp/Sonic.js +3 -3
- package/dist/dsp/SpeexResampler.d.ts +1 -1
- package/dist/dsp/SpeexResampler.js +2 -2
- package/dist/math/VectorMath.d.ts +12 -8
- package/dist/math/VectorMath.js +35 -32
- package/dist/math/VectorMath.js.map +1 -1
- package/dist/nlp/ChineseSegmentation.js +2 -2
- package/dist/nlp/CompromiseNLP.js +3 -3
- package/dist/nlp/EspeakPhonemizer.js +30 -30
- package/dist/nlp/IPA.js +20 -20
- package/dist/nlp/JapaneseSegmentation.js +6 -6
- package/dist/nlp/Lexicon.d.ts +1 -1
- package/dist/nlp/Lexicon.js +7 -7
- package/dist/nlp/Segmentation.d.ts +3 -0
- package/dist/nlp/Segmentation.js +21 -14
- package/dist/nlp/Segmentation.js.map +1 -1
- package/dist/nlp/TextNormalizer.js +16 -16
- package/dist/recognition/AmazonTranscribeSTT.d.ts +2 -2
- package/dist/recognition/AmazonTranscribeSTT.js +13 -14
- package/dist/recognition/AmazonTranscribeSTT.js.map +1 -1
- package/dist/recognition/AzureCognitiveServicesSTT.js +5 -6
- package/dist/recognition/AzureCognitiveServicesSTT.js.map +1 -1
- package/dist/recognition/GoogleCloudSTT.d.ts +3 -3
- package/dist/recognition/GoogleCloudSTT.js +18 -18
- package/dist/recognition/OpenAICloudSTT.d.ts +19 -0
- package/dist/recognition/OpenAICloudSTT.js +81 -0
- package/dist/recognition/OpenAICloudSTT.js.map +1 -0
- package/dist/recognition/SileroSTT.d.ts +2 -2
- package/dist/recognition/SileroSTT.js +25 -25
- package/dist/recognition/VoskSTT.d.ts +2 -2
- package/dist/recognition/VoskSTT.js +8 -8
- package/dist/recognition/WhisperCppSTT.d.ts +88 -0
- package/dist/recognition/WhisperCppSTT.js +332 -0
- package/dist/recognition/WhisperCppSTT.js.map +1 -0
- package/dist/recognition/WhisperSTT.d.ts +49 -25
- package/dist/recognition/WhisperSTT.js +626 -481
- package/dist/recognition/WhisperSTT.js.map +1 -1
- package/dist/server/Client.d.ts +1 -1
- package/dist/server/Client.js +22 -22
- package/dist/server/Server.js +9 -9
- package/dist/server/Server.js.map +1 -1
- package/dist/server/Worker.d.ts +22 -22
- package/dist/server/Worker.js +36 -36
- package/dist/server/Worker.js.map +1 -1
- package/dist/server/WorkerStarter.js +2 -2
- package/dist/source-separation/MDXNetSourceSeparation.d.ts +11 -0
- package/dist/source-separation/MDXNetSourceSeparation.js +161 -0
- package/dist/source-separation/MDXNetSourceSeparation.js.map +1 -0
- package/dist/speech-language-detection/SileroLanguageDetection.d.ts +1 -1
- package/dist/speech-language-detection/SileroLanguageDetection.js +7 -7
- package/dist/subtitles/Subtitles.d.ts +10 -0
- package/dist/subtitles/Subtitles.js +2 -2
- package/dist/subtitles/Subtitles.js.map +1 -1
- package/dist/synthesis/AwsPollyTTS.d.ts +1 -1
- package/dist/synthesis/AwsPollyTTS.js +12 -12
- package/dist/synthesis/AzureCognitiveServicesTTS.js +7 -7
- package/dist/synthesis/CoquiServerTTS.js +10 -10
- package/dist/synthesis/CoquiServerTTS.js.map +1 -1
- package/dist/synthesis/ElevenlabsTTS.d.ts +23 -0
- package/dist/synthesis/ElevenlabsTTS.js +103 -0
- package/dist/synthesis/ElevenlabsTTS.js.map +1 -0
- package/dist/synthesis/EspeakTTS.d.ts +6 -5
- package/dist/synthesis/EspeakTTS.js +81 -69
- package/dist/synthesis/EspeakTTS.js.map +1 -1
- package/dist/synthesis/FliteTTS.d.ts +3 -3
- package/dist/synthesis/FliteTTS.js +154 -154
- package/dist/synthesis/FliteTTS.js.map +1 -1
- package/dist/synthesis/GoogleCloudTTS.d.ts +3 -3
- package/dist/synthesis/GoogleCloudTTS.js +17 -17
- package/dist/synthesis/GoogleCloudTTS.js.map +1 -1
- package/dist/synthesis/GoogleTranslateTTS.d.ts +1 -1
- package/dist/synthesis/GoogleTranslateTTS.js +103 -103
- package/dist/synthesis/MicrosoftEdgeTTS.d.ts +2 -2
- package/dist/synthesis/MicrosoftEdgeTTS.js +74 -74
- package/dist/synthesis/OpenAICloudTTS.d.ts +13 -0
- package/dist/synthesis/OpenAICloudTTS.js +169 -0
- package/dist/synthesis/OpenAICloudTTS.js.map +1 -0
- package/dist/synthesis/SamTTS.js +3 -3
- package/dist/synthesis/SapiTTS.d.ts +3 -3
- package/dist/synthesis/SapiTTS.js +26 -26
- package/dist/synthesis/StreamlabsPollyTTS.d.ts +2 -2
- package/dist/synthesis/StreamlabsPollyTTS.js +27 -27
- package/dist/synthesis/SvoxPicoTTS.d.ts +2 -2
- package/dist/synthesis/SvoxPicoTTS.js +65 -65
- package/dist/synthesis/SvoxPicoTTS.js.map +1 -1
- package/dist/synthesis/VitsTTS.d.ts +3 -3
- package/dist/synthesis/VitsTTS.js +378 -378
- package/dist/synthesis/VitsTTS.js.map +1 -1
- package/dist/tests/Test.js +2 -2
- package/dist/utilities/Compression.d.ts +5 -0
- package/dist/utilities/Compression.js +29 -13
- package/dist/utilities/Compression.js.map +1 -1
- package/dist/utilities/FileDownloader.d.ts +1 -1
- package/dist/utilities/FileDownloader.js +16 -16
- package/dist/utilities/FileSystem.js +7 -7
- package/dist/utilities/Locale.d.ts +7 -7
- package/dist/utilities/Locale.js +15 -15
- package/dist/utilities/Logger.js +3 -3
- package/dist/utilities/ObjectUtilities.js +19 -19
- package/dist/utilities/OpenPromise.js +2 -2
- package/dist/utilities/OpenPromise.js.map +1 -1
- package/dist/utilities/PackageManager.js +31 -0
- package/dist/utilities/PackageManager.js.map +1 -1
- package/dist/utilities/PathUtilities.js +8 -8
- package/dist/utilities/RandomGenerator.js +2 -2
- package/dist/utilities/SmoothEstimator.d.ts +8 -0
- package/dist/utilities/SmoothEstimator.js +25 -0
- package/dist/utilities/SmoothEstimator.js.map +1 -0
- package/dist/utilities/TarballMaker.js +8 -8
- package/dist/utilities/Timeline.d.ts +3 -2
- package/dist/utilities/Timeline.js +11 -11
- package/dist/utilities/Timeline.js.map +1 -1
- package/dist/utilities/Timer.js +4 -4
- package/dist/utilities/Utilities.d.ts +4 -0
- package/dist/utilities/Utilities.js +38 -15
- package/dist/utilities/Utilities.js.map +1 -1
- package/dist/utilities/WasmMemoryManager.js +7 -7
- package/dist/utilities/WebReader.js +23 -23
- package/dist/utilities/WikipediaReader.js +2 -2
- package/dist/voice-activity-detection/AdaptiveGateVAD.d.ts +28 -0
- package/dist/voice-activity-detection/AdaptiveGateVAD.js +138 -0
- package/dist/voice-activity-detection/AdaptiveGateVAD.js.map +1 -0
- package/dist/voice-activity-detection/SileroVAD.d.ts +1 -1
- package/dist/voice-activity-detection/SileroVAD.js +5 -5
- package/dist/voice-activity-detection/SileroVAD.js.map +1 -1
- package/dist/voice-activity-detection/WebRtcVAD.d.ts +1 -1
- package/dist/voice-activity-detection/WebRtcVAD.js +4 -4
- package/docs/API.md +29 -11
- package/docs/CLI.md +31 -7
- package/docs/Contributing.md +38 -0
- package/docs/Development.md +93 -19
- package/docs/Engines.md +28 -16
- package/docs/Licenses.md +4 -1
- package/docs/Options.md +158 -78
- package/docs/Releases.md +262 -0
- package/docs/Server.md +7 -7
- package/docs/Tasklist.md +95 -76
- package/docs/Technical.md +4 -4
- package/package.json +13 -14
- package/src/alignment/DTWMfccSequenceAlignment.ts +9 -9
- package/src/alignment/DTWSequenceAlignment.ts +2 -2
- package/src/alignment/DTWSequenceAlignmentWindowed.ts +3 -3
- package/src/alignment/LevenshteinSequenceAlignment.ts +2 -2
- package/src/alignment/SpeechAlignment.ts +204 -119
- package/src/api/API.ts +14 -13
- package/src/api/APIOptions.ts +12 -11
- package/src/api/Alignment.ts +147 -90
- package/src/api/Common.ts +1 -1
- package/src/api/Denoising.ts +28 -28
- package/src/api/LanguageDetection.ts +135 -48
- package/src/api/Recognition.ts +198 -59
- package/src/api/SourceSeparation.ts +99 -0
- package/src/api/Synthesis.ts +217 -181
- package/src/api/Translation.ts +193 -40
- package/src/api/Vad.ts +110 -41
- package/src/audio/AudioBufferConversion.ts +4 -4
- package/src/audio/AudioPlayer.ts +27 -27
- package/src/audio/AudioRecorder.ts +5 -5
- package/src/audio/AudioUtilities.ts +107 -24
- package/src/cli/CLI.ts +313 -164
- package/src/cli/CLIConfigFile.ts +8 -8
- package/src/cli/CLILauncher.ts +6 -6
- package/src/cli/CLIOptionsSchema.ts +2 -2
- package/src/cli/CLIParser.ts +5 -5
- package/src/cli/CLIStarter.ts +4 -4
- package/src/codecs/FFMpegTranscoder.ts +38 -38
- package/src/codecs/TIMITCodec.ts +5 -5
- package/src/codecs/WaveCodec.ts +22 -22
- package/src/denoising/RNNoise.ts +9 -9
- package/src/dsp/BiquadFilter.ts +19 -11
- package/src/dsp/DecayingPeakEstimator.ts +35 -0
- package/src/dsp/FFT.ts +103 -35
- package/src/dsp/KWeightingFilter.ts +43 -0
- package/src/dsp/LoudnessEstimator.ts +74 -0
- package/src/dsp/MFCC.ts +15 -15
- package/src/dsp/MelSpectogram.ts +7 -7
- package/src/dsp/Rubberband.ts +38 -38
- package/src/dsp/Sonic.ts +4 -4
- package/src/dsp/SpeexResampler.ts +2 -2
- package/src/math/VectorMath.ts +42 -33
- package/src/nlp/ChineseSegmentation.ts +3 -3
- package/src/nlp/CompromiseNLP.ts +3 -3
- package/src/nlp/EspeakPhonemizer.ts +30 -30
- package/src/nlp/IPA.ts +20 -20
- package/src/nlp/JapaneseSegmentation.ts +6 -6
- package/src/nlp/Lexicon.ts +8 -8
- package/src/nlp/Segmentation.ts +23 -14
- package/src/nlp/TextNormalizer.ts +16 -16
- package/src/recognition/AmazonTranscribeSTT.ts +16 -17
- package/src/recognition/AzureCognitiveServicesSTT.ts +8 -6
- package/src/recognition/GoogleCloudSTT.ts +21 -21
- package/src/recognition/OpenAICloudSTT.ts +142 -0
- package/src/recognition/SileroSTT.ts +26 -26
- package/src/recognition/VoskSTT.ts +10 -10
- package/src/recognition/WhisperCppSTT.ts +555 -0
- package/src/recognition/WhisperSTT.ts +760 -507
- package/src/server/Client.ts +23 -23
- package/src/server/Server.ts +9 -9
- package/src/server/Worker.ts +53 -53
- package/src/server/WorkerStarter.ts +2 -2
- package/src/source-separation/MDXNetSourceSeparation.ts +228 -0
- package/src/speech-language-detection/SileroLanguageDetection.ts +8 -8
- package/src/subtitles/Subtitles.ts +3 -3
- package/src/synthesis/AwsPollyTTS.ts +14 -14
- package/src/synthesis/AzureCognitiveServicesTTS.ts +10 -10
- package/src/synthesis/CoquiServerTTS.ts +10 -10
- package/src/synthesis/ElevenlabsTTS.ts +137 -0
- package/src/synthesis/EspeakTTS.ts +90 -71
- package/src/synthesis/FliteTTS.ts +157 -157
- package/src/synthesis/GoogleCloudTTS.ts +19 -19
- package/src/synthesis/GoogleTranslateTTS.ts +104 -104
- package/src/synthesis/MicrosoftEdgeTTS.ts +80 -80
- package/src/synthesis/OpenAICloudTTS.ts +196 -0
- package/src/synthesis/SamTTS.ts +3 -3
- package/src/synthesis/SapiTTS.ts +29 -29
- package/src/synthesis/StreamlabsPollyTTS.ts +29 -29
- package/src/synthesis/SvoxPicoTTS.ts +67 -67
- package/src/synthesis/VitsTTS.ts +380 -380
- package/src/tests/Test.ts +4 -4
- package/src/utilities/Compression.ts +34 -13
- package/src/utilities/FileDownloader.ts +19 -19
- package/src/utilities/FileSystem.ts +7 -7
- package/src/utilities/Locale.ts +22 -22
- package/src/utilities/Logger.ts +4 -4
- package/src/utilities/ObjectUtilities.ts +19 -19
- package/src/utilities/OpenPromise.ts +2 -2
- package/src/utilities/PackageManager.ts +40 -0
- package/src/utilities/PathUtilities.ts +8 -8
- package/src/utilities/RandomGenerator.ts +3 -3
- package/src/utilities/SmoothEstimator.ts +35 -0
- package/src/utilities/TarballMaker.ts +9 -9
- package/src/utilities/Timeline.ts +15 -13
- package/src/utilities/Timer.ts +4 -4
- package/src/utilities/Utilities.ts +49 -15
- package/src/utilities/WasmMemoryManager.ts +7 -7
- package/src/utilities/WebReader.ts +23 -23
- package/src/utilities/WikipediaReader.ts +2 -2
- package/src/voice-activity-detection/AdaptiveGateVAD.ts +202 -0
- package/src/voice-activity-detection/SileroVAD.ts +5 -5
- package/src/voice-activity-detection/WebRtcVAD.ts +5 -5
- package/dist/synthesis/ElevenLabsTTS.d.ts +0 -8
- package/dist/synthesis/ElevenLabsTTS.js +0 -82
- package/dist/synthesis/ElevenLabsTTS.js.map +0 -1
- package/src/synthesis/ElevenLabsTTS.ts +0 -104
package/src/tests/Test.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { getRepetitionScoreRelativeToFirstSubstring, logToStderr, setupProgramTerminationListeners } from
|
|
2
|
-
import { makeTarballsForInstalledPackages } from
|
|
3
|
-
import { testEspeakSynthesisWithPrePhonemizedInputs, testKirshenbaumPhonemization } from
|
|
1
|
+
import { getRepetitionScoreRelativeToFirstSubstring, logToStderr, setupProgramTerminationListeners } from '../utilities/Utilities.js'
|
|
2
|
+
import { makeTarballsForInstalledPackages } from '../utilities/TarballMaker.js'
|
|
3
|
+
import { testEspeakSynthesisWithPrePhonemizedInputs, testKirshenbaumPhonemization } from '../synthesis/EspeakTTS.js'
|
|
4
4
|
|
|
5
5
|
const log = logToStderr
|
|
6
6
|
|
|
7
7
|
setupProgramTerminationListeners()
|
|
8
8
|
//process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'
|
|
9
|
-
//process.env.http_proxy =
|
|
9
|
+
//process.env.http_proxy = 'http://localhost:8080'
|
|
10
10
|
|
|
11
11
|
//const testText = `After a while, finding that nothing more happened, she decided on going into the garden at once; but, alas for poor Alice! when she got to the door, she found she had forgotten the little golden key, and when she went back to the table for it, she found she could not possibly reach it: she could see it quite plainly through the glass, and she tried her best to climb up one of the legs of the table, but it was too slippery; and when she had tired herself out with trying, the poor little thing sat down and cried.`
|
|
12
12
|
|
|
@@ -2,7 +2,7 @@ import path from 'node:path'
|
|
|
2
2
|
import { Logger } from './Logger.js'
|
|
3
3
|
import { readdir, stat } from './FileSystem.js'
|
|
4
4
|
|
|
5
|
-
export async function createTarball(filePath: string, outputFile: string, prefixPath =
|
|
5
|
+
export async function createTarball(filePath: string, outputFile: string, prefixPath = '') {
|
|
6
6
|
const pathStat = await stat(filePath)
|
|
7
7
|
|
|
8
8
|
if (pathStat.isDirectory()) {
|
|
@@ -12,12 +12,12 @@ export async function createTarball(filePath: string, outputFile: string, prefix
|
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
export async function createTarballForFile(filePath: string, outputFile: string, prefixPath =
|
|
15
|
+
export async function createTarballForFile(filePath: string, outputFile: string, prefixPath = '') {
|
|
16
16
|
const logger = new Logger()
|
|
17
17
|
|
|
18
18
|
logger.start(`Creating ${prefixPath || path.basename(outputFile)}`)
|
|
19
19
|
|
|
20
|
-
const {
|
|
20
|
+
const { create } = await import('tar')
|
|
21
21
|
|
|
22
22
|
const inputFileStat = await stat(filePath)
|
|
23
23
|
|
|
@@ -28,15 +28,17 @@ export async function createTarballForFile(filePath: string, outputFile: string,
|
|
|
28
28
|
const filename = path.basename(filePath)
|
|
29
29
|
const dirname = path.dirname(filePath)
|
|
30
30
|
|
|
31
|
-
await
|
|
32
|
-
gzip: { level: 9
|
|
31
|
+
await create({
|
|
32
|
+
gzip: { level: 9 },
|
|
33
33
|
file: outputFile,
|
|
34
34
|
cwd: dirname,
|
|
35
35
|
prefix: prefixPath,
|
|
36
36
|
mode: 0o775,
|
|
37
37
|
|
|
38
38
|
filter: (path, stat) => {
|
|
39
|
-
stat.mode
|
|
39
|
+
if (stat.mode) {
|
|
40
|
+
stat.mode |= 0o775
|
|
41
|
+
}
|
|
40
42
|
|
|
41
43
|
return true
|
|
42
44
|
}
|
|
@@ -46,12 +48,12 @@ export async function createTarballForFile(filePath: string, outputFile: string,
|
|
|
46
48
|
logger.end()
|
|
47
49
|
}
|
|
48
50
|
|
|
49
|
-
export async function createTarballForDir(inputDir: string, outputFile: string, prefixPath =
|
|
51
|
+
export async function createTarballForDir(inputDir: string, outputFile: string, prefixPath = '') {
|
|
50
52
|
const logger = new Logger()
|
|
51
53
|
|
|
52
54
|
logger.start(`Creating ${prefixPath || path.basename(outputFile)}`)
|
|
53
55
|
|
|
54
|
-
const {
|
|
56
|
+
const { create } = await import('tar')
|
|
55
57
|
|
|
56
58
|
const inputDirStat = await stat(inputDir)
|
|
57
59
|
|
|
@@ -61,15 +63,17 @@ export async function createTarballForDir(inputDir: string, outputFile: string,
|
|
|
61
63
|
|
|
62
64
|
const filesInBaseDir = await readdir(inputDir)
|
|
63
65
|
|
|
64
|
-
await
|
|
65
|
-
gzip: { level: 9
|
|
66
|
+
await create({
|
|
67
|
+
gzip: { level: 9 },
|
|
66
68
|
file: outputFile,
|
|
67
69
|
cwd: inputDir,
|
|
68
70
|
prefix: prefixPath,
|
|
69
71
|
mode: 0o775,
|
|
70
72
|
|
|
71
73
|
filter: (path, stat) => {
|
|
72
|
-
stat.mode
|
|
74
|
+
if (stat.mode) {
|
|
75
|
+
stat.mode |= 0o775
|
|
76
|
+
}
|
|
73
77
|
|
|
74
78
|
return true
|
|
75
79
|
}
|
|
@@ -80,12 +84,29 @@ export async function createTarballForDir(inputDir: string, outputFile: string,
|
|
|
80
84
|
}
|
|
81
85
|
|
|
82
86
|
export async function extractTarball(filepath: string, outputDir: string) {
|
|
83
|
-
const {
|
|
87
|
+
const { extract } = await import('tar')
|
|
84
88
|
|
|
85
|
-
await
|
|
89
|
+
await extract({
|
|
86
90
|
file: filepath,
|
|
87
91
|
cwd: outputDir,
|
|
88
92
|
preserveOwner: false,
|
|
89
93
|
//noChmod: true
|
|
90
94
|
})
|
|
91
95
|
}
|
|
96
|
+
|
|
97
|
+
export async function getDeflateCompressionMetricsForString(str: string) {
|
|
98
|
+
const zlib = await import('node:zlib')
|
|
99
|
+
const { promisify } = await import('node:util')
|
|
100
|
+
|
|
101
|
+
const originalStringBytes = Buffer.from(str, 'utf-8')
|
|
102
|
+
|
|
103
|
+
const deflateRaw = promisify(zlib.deflateRaw)
|
|
104
|
+
|
|
105
|
+
const compressedStringBytes = await deflateRaw(originalStringBytes)
|
|
106
|
+
|
|
107
|
+
return {
|
|
108
|
+
originalSize: originalStringBytes.length,
|
|
109
|
+
compressedSize: compressedStringBytes.length,
|
|
110
|
+
ratio: compressedStringBytes.length / originalStringBytes.length
|
|
111
|
+
}
|
|
112
|
+
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { GaxiosOptions, request } from
|
|
2
|
-
import { Readable } from
|
|
3
|
-
import { getRandomHexString, writeToStderr } from
|
|
4
|
-
import { OpenPromise } from
|
|
5
|
-
|
|
6
|
-
import { Timer } from
|
|
7
|
-
import { Logger } from
|
|
8
|
-
import path from
|
|
9
|
-
import { extractTarball } from
|
|
10
|
-
import { createWriteStream, move, remove, readdir, ensureDir } from
|
|
11
|
-
import chalk from
|
|
12
|
-
|
|
13
|
-
export async function downloadAndExtractTarball(options: GaxiosOptions, targetDir: string, baseTempPath: string, displayName =
|
|
1
|
+
import { GaxiosOptions, request } from 'gaxios'
|
|
2
|
+
import { Readable } from 'stream'
|
|
3
|
+
import { getRandomHexString, writeToStderr } from './Utilities.js'
|
|
4
|
+
import { OpenPromise } from './OpenPromise.js'
|
|
5
|
+
|
|
6
|
+
import { Timer } from './Timer.js'
|
|
7
|
+
import { Logger } from './Logger.js'
|
|
8
|
+
import path from 'node:path'
|
|
9
|
+
import { extractTarball } from './Compression.js'
|
|
10
|
+
import { createWriteStream, move, remove, readdir, ensureDir } from './FileSystem.js'
|
|
11
|
+
import chalk from 'chalk'
|
|
12
|
+
|
|
13
|
+
export async function downloadAndExtractTarball(options: GaxiosOptions, targetDir: string, baseTempPath: string, displayName = 'archive') {
|
|
14
14
|
const logger = new Logger()
|
|
15
15
|
|
|
16
16
|
const randomID = getRandomHexString(16).toLowerCase()
|
|
@@ -39,7 +39,7 @@ export async function downloadAndExtractTarball(options: GaxiosOptions, targetDi
|
|
|
39
39
|
logger.end()
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
export async function downloadFile(options: GaxiosOptions, targetFilePath: string, prompt =
|
|
42
|
+
export async function downloadFile(options: GaxiosOptions, targetFilePath: string, prompt = 'Downloading') {
|
|
43
43
|
const write = writeToStderr
|
|
44
44
|
|
|
45
45
|
const downloadPromise = new OpenPromise<void>()
|
|
@@ -140,13 +140,13 @@ export async function downloadFile(options: GaxiosOptions, targetFilePath: strin
|
|
|
140
140
|
}
|
|
141
141
|
|
|
142
142
|
const partialFilePath = `${targetFilePath}.${getRandomHexString(16)}.partial`
|
|
143
|
-
const fileWriteStream = createWriteStream(partialFilePath, { encoding:
|
|
143
|
+
const fileWriteStream = createWriteStream(partialFilePath, { encoding: 'binary', autoClose: true })
|
|
144
144
|
|
|
145
145
|
let statusInterval = setInterval(() => {
|
|
146
146
|
updateStatus()
|
|
147
147
|
}, statusUpdateInterval)
|
|
148
148
|
|
|
149
|
-
response.data.on(
|
|
149
|
+
response.data.on('data', (chunk: Uint8Array) => {
|
|
150
150
|
try {
|
|
151
151
|
const contentLengthString = response.headers['content-length']
|
|
152
152
|
|
|
@@ -168,14 +168,14 @@ export async function downloadFile(options: GaxiosOptions, targetFilePath: strin
|
|
|
168
168
|
}
|
|
169
169
|
})
|
|
170
170
|
|
|
171
|
-
response.data.on(
|
|
171
|
+
response.data.on('end', async () => {
|
|
172
172
|
try {
|
|
173
173
|
clearInterval(statusInterval)
|
|
174
174
|
updateStatus()
|
|
175
175
|
|
|
176
176
|
fileWriteStream.end()
|
|
177
177
|
|
|
178
|
-
write(
|
|
178
|
+
write('\n')
|
|
179
179
|
|
|
180
180
|
await move(partialFilePath, targetFilePath)
|
|
181
181
|
|
|
@@ -186,7 +186,7 @@ export async function downloadFile(options: GaxiosOptions, targetFilePath: strin
|
|
|
186
186
|
}
|
|
187
187
|
})
|
|
188
188
|
|
|
189
|
-
response.data.on(
|
|
189
|
+
response.data.on('error', async (err: any) => {
|
|
190
190
|
try {
|
|
191
191
|
clearInterval(statusInterval)
|
|
192
192
|
|
|
@@ -86,7 +86,7 @@ export async function computeFileSha256Hex(filePath: string) {
|
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
export async function readAndParseJsonFile(jsonFilePath: string, useJson5 = false) {
|
|
89
|
-
const fileContent = await readFile(jsonFilePath, { encoding:
|
|
89
|
+
const fileContent = await readFile(jsonFilePath, { encoding: 'utf-8' })
|
|
90
90
|
|
|
91
91
|
if (useJson5) {
|
|
92
92
|
const { default: JSON5 } = await import('json5')
|
|
@@ -116,12 +116,12 @@ export function getAppDataDir(appName: string) {
|
|
|
116
116
|
const platform = process.platform
|
|
117
117
|
const homeDir = os.homedir()
|
|
118
118
|
|
|
119
|
-
if (platform ==
|
|
120
|
-
dataDir = path.join(homeDir,
|
|
121
|
-
} else if (platform ==
|
|
122
|
-
dataDir = path.join(homeDir,
|
|
123
|
-
} else if (platform ==
|
|
124
|
-
dataDir = path.join(homeDir,
|
|
119
|
+
if (platform == 'win32') {
|
|
120
|
+
dataDir = path.join(homeDir, 'AppData', 'Local', appName)
|
|
121
|
+
} else if (platform == 'darwin') {
|
|
122
|
+
dataDir = path.join(homeDir, 'Library', 'Application Support', appName)
|
|
123
|
+
} else if (platform == 'linux') {
|
|
124
|
+
dataDir = path.join(homeDir, '.local', 'share', appName)
|
|
125
125
|
} else {
|
|
126
126
|
throw new Error(`Unsupport platform ${platform}`)
|
|
127
127
|
}
|
package/src/utilities/Locale.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { readAndParseJsonFile } from
|
|
2
|
-
import { resolveToModuleRootDir } from
|
|
1
|
+
import { readAndParseJsonFile } from './FileSystem.js'
|
|
2
|
+
import { resolveToModuleRootDir } from './PathUtilities.js'
|
|
3
3
|
|
|
4
4
|
export function languageCodeToName(languageCode: string) {
|
|
5
5
|
const languageNames = new Intl.DisplayNames(['en'], { type: 'language' })
|
|
@@ -11,7 +11,7 @@ export function languageCodeToName(languageCode: string) {
|
|
|
11
11
|
} catch (e) {
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
return translatedLanguageName ||
|
|
14
|
+
return translatedLanguageName || 'Unknown'
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
export function formatLanguageCodeWithName(languageCode: string, styleId: 1 | 2 = 1) {
|
|
@@ -23,7 +23,7 @@ export function formatLanguageCodeWithName(languageCode: string, styleId: 1 | 2
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
export function getShortLanguageCode(langCode: string) {
|
|
26
|
-
const dashIndex = langCode.indexOf(
|
|
26
|
+
const dashIndex = langCode.indexOf('-')
|
|
27
27
|
|
|
28
28
|
if (dashIndex == -1) {
|
|
29
29
|
return langCode
|
|
@@ -35,7 +35,7 @@ export function getShortLanguageCode(langCode: string) {
|
|
|
35
35
|
export function normalizeLanguageCode(langCode: string) {
|
|
36
36
|
langCode = langCode.trim()
|
|
37
37
|
|
|
38
|
-
const parts = langCode.split(
|
|
38
|
+
const parts = langCode.split('-')
|
|
39
39
|
|
|
40
40
|
const result = [parts[0].toLowerCase()]
|
|
41
41
|
|
|
@@ -43,7 +43,7 @@ export function normalizeLanguageCode(langCode: string) {
|
|
|
43
43
|
result.push(parts[i].toUpperCase())
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
return result.join(
|
|
46
|
+
return result.join('-')
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
const isoToLcidLookup = new Map<string, number>()
|
|
@@ -67,7 +67,7 @@ async function loadLcidLookupIfNeeded() {
|
|
|
67
67
|
return lcidEntries
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
const lcidLookup: LCIDLookup = await readAndParseJsonFile(resolveToModuleRootDir(
|
|
70
|
+
const lcidLookup: LCIDLookup = await readAndParseJsonFile(resolveToModuleRootDir('data/tables/lcid-table.json'))
|
|
71
71
|
|
|
72
72
|
for (const isoName in lcidLookup) {
|
|
73
73
|
const lcidEntry = lcidLookup[isoName]
|
|
@@ -97,24 +97,24 @@ export function getDefaultDialectForLanguageCodeIfPossible(langCode: string) {
|
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
export const defaultDialectForLanguageCode: { [lang: string]: string } = {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
100
|
+
'en': 'en-US',
|
|
101
|
+
'zh': 'zh-CN',
|
|
102
|
+
'ar': 'ar-EG',
|
|
103
|
+
'fr': 'fr-FR',
|
|
104
|
+
'de': 'de-DE',
|
|
105
|
+
'pt': 'pt-BR',
|
|
106
|
+
'es': 'es-ES',
|
|
107
|
+
'nl': 'nl-NL'
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
type LCIDLookup = { [isoLangCode: string]: LCIDEntry }
|
|
111
111
|
|
|
112
112
|
export interface LCIDEntry {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
113
|
+
'LCID': number
|
|
114
|
+
'Name': string
|
|
115
|
+
'TwoLetterISOLanguageName': string,
|
|
116
|
+
'ThreeLetterISOLanguageName': string,
|
|
117
|
+
'ThreeLetterWindowsLanguageName': string,
|
|
118
|
+
'EnglishName': string
|
|
119
|
+
'ANSICodePage': string
|
|
120
120
|
}
|
package/src/utilities/Logger.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import chalk from
|
|
2
|
-
import { Timer } from
|
|
3
|
-
import { logToStderr, writeToStderr, yieldToEventLoop } from
|
|
1
|
+
import chalk from 'chalk'
|
|
2
|
+
import { Timer } from './Timer.js'
|
|
3
|
+
import { logToStderr, writeToStderr, yieldToEventLoop } from './Utilities.js'
|
|
4
4
|
|
|
5
5
|
let currentActiveLogger: Logger | null = null
|
|
6
6
|
|
|
@@ -26,7 +26,7 @@ export class Logger {
|
|
|
26
26
|
writeToStderr(`${titleColor(title)}.. `)
|
|
27
27
|
|
|
28
28
|
this.setAsActiveLogger()
|
|
29
|
-
|
|
29
|
+
|
|
30
30
|
this.timer.restart()
|
|
31
31
|
}
|
|
32
32
|
|
|
@@ -30,7 +30,7 @@ export function deepClone<T>(val: T) {
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
function clone<T>(val: T, deep = true, seenObjects: any[] = []): T {
|
|
33
|
-
if (val == null || typeof val !==
|
|
33
|
+
if (val == null || typeof val !== 'object') {
|
|
34
34
|
return val
|
|
35
35
|
}
|
|
36
36
|
|
|
@@ -38,9 +38,9 @@ function clone<T>(val: T, deep = true, seenObjects: any[] = []): T {
|
|
|
38
38
|
const prototypeIdentifier = toString.call(obj)
|
|
39
39
|
|
|
40
40
|
switch (prototypeIdentifier) {
|
|
41
|
-
case
|
|
41
|
+
case '[object Array]': {
|
|
42
42
|
if (seenObjects.includes(obj)) {
|
|
43
|
-
throw new Error(
|
|
43
|
+
throw new Error('deepClone: encountered a cyclic object')
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
seenObjects.push(obj)
|
|
@@ -60,81 +60,81 @@ function clone<T>(val: T, deep = true, seenObjects: any[] = []): T {
|
|
|
60
60
|
return <any>clonedArray
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
case
|
|
63
|
+
case '[object ArrayBuffer]': {
|
|
64
64
|
const clonedArray = new Uint8Array(obj.byteLength)
|
|
65
65
|
clonedArray.set(new Uint8Array(obj))
|
|
66
66
|
return <any>clonedArray.buffer
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
case
|
|
69
|
+
case '[object Int8Array]': {
|
|
70
70
|
const clonedArray = new Int8Array(obj.length)
|
|
71
71
|
clonedArray.set(obj)
|
|
72
72
|
return <any>clonedArray
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
case
|
|
75
|
+
case '[object Uint8Array]': {
|
|
76
76
|
const clonedArray = new Uint8Array(obj.length)
|
|
77
77
|
clonedArray.set(obj)
|
|
78
78
|
return <any>clonedArray
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
case
|
|
81
|
+
case '[object Uint8ClampedArray]': {
|
|
82
82
|
const clonedArray = new Uint8ClampedArray(obj.length)
|
|
83
83
|
clonedArray.set(obj)
|
|
84
84
|
return <any>clonedArray
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
case
|
|
87
|
+
case '[object Int16Array]': {
|
|
88
88
|
const clonedArray = new Int16Array(obj.length)
|
|
89
89
|
clonedArray.set(obj)
|
|
90
90
|
return <any>clonedArray
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
-
case
|
|
93
|
+
case '[object Uint16Array]': {
|
|
94
94
|
const clonedArray = new Uint16Array(obj.length)
|
|
95
95
|
clonedArray.set(obj)
|
|
96
96
|
return <any>clonedArray
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
-
case
|
|
99
|
+
case '[object Int32Array]': {
|
|
100
100
|
const clonedArray = new Int32Array(obj.length)
|
|
101
101
|
clonedArray.set(obj)
|
|
102
102
|
return <any>clonedArray
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
-
case
|
|
105
|
+
case '[object Uint32Array]': {
|
|
106
106
|
const clonedArray = new Uint32Array(obj.length)
|
|
107
107
|
clonedArray.set(obj)
|
|
108
108
|
return <any>clonedArray
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
-
case
|
|
111
|
+
case '[object Float32Array]': {
|
|
112
112
|
const clonedArray = new Float32Array(obj.length)
|
|
113
113
|
clonedArray.set(obj)
|
|
114
114
|
return <any>clonedArray
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
-
case
|
|
117
|
+
case '[object Float64Array]': {
|
|
118
118
|
const clonedArray = new Float64Array(obj.length)
|
|
119
119
|
clonedArray.set(obj)
|
|
120
120
|
return <any>clonedArray
|
|
121
121
|
}
|
|
122
122
|
|
|
123
|
-
case
|
|
123
|
+
case '[object Date]': {
|
|
124
124
|
return <any>new Date(obj.valueOf())
|
|
125
125
|
}
|
|
126
126
|
|
|
127
|
-
case
|
|
127
|
+
case '[object RegExp]': {
|
|
128
128
|
return obj
|
|
129
129
|
}
|
|
130
130
|
|
|
131
|
-
case
|
|
131
|
+
case '[object Function]': {
|
|
132
132
|
return obj
|
|
133
133
|
}
|
|
134
134
|
|
|
135
|
-
case
|
|
135
|
+
case '[object Object]': {
|
|
136
136
|
if (seenObjects.includes(obj)) {
|
|
137
|
-
throw new Error(
|
|
137
|
+
throw new Error('deepClone: encountered a cyclic object')
|
|
138
138
|
}
|
|
139
139
|
|
|
140
140
|
seenObjects.push(obj)
|
|
@@ -165,5 +165,5 @@ function clone<T>(val: T, deep = true, seenObjects: any[] = []): T {
|
|
|
165
165
|
}
|
|
166
166
|
|
|
167
167
|
export function isPlainObject(val: any) {
|
|
168
|
-
return val != null && typeof val ===
|
|
168
|
+
return val != null && typeof val === 'object' && toString.call(val) === '[object Object]'
|
|
169
169
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export class OpenPromise<T = void>
|
|
2
2
|
{
|
|
3
3
|
promise: Promise<T>
|
|
4
|
-
resolve: (value: T) => void = () => { throw new Error(
|
|
5
|
-
reject: (reason?: any) => void = () => { throw new Error(
|
|
4
|
+
resolve: (value: T) => void = () => { throw new Error('Open promise resolved before initialization') }
|
|
5
|
+
reject: (reason?: any) => void = () => { throw new Error('Open promise rejected before initialization') }
|
|
6
6
|
|
|
7
7
|
constructor() {
|
|
8
8
|
this.promise = new Promise<T>((resolve, reject) => {
|
|
@@ -141,4 +141,44 @@ const packageVersionTagResolutionLookup: { [packageName: string]: string } = {
|
|
|
141
141
|
'vits-nl_NL-mls-medium': '20240316',
|
|
142
142
|
'vits-sl_SI-artur-medium': '20240316',
|
|
143
143
|
'vits-tr_TR-fettah-medium': '20240316',
|
|
144
|
+
|
|
145
|
+
'mdxnet-UVR_MDXNET_1_9703': '20240330',
|
|
146
|
+
'mdxnet-UVR_MDXNET_2_9682': '20240330',
|
|
147
|
+
'mdxnet-UVR_MDXNET_3_9662': '20240330',
|
|
148
|
+
'mdxnet-UVR_MDXNET_KARA': '20240330',
|
|
149
|
+
|
|
150
|
+
'whisper.cpp-tiny': '20240405',
|
|
151
|
+
'whisper.cpp-tiny-q5_1': '20240405',
|
|
152
|
+
'whisper.cpp-tiny.en': '20240405',
|
|
153
|
+
'whisper.cpp-tiny.en-q5_1': '20240405',
|
|
154
|
+
'whisper.cpp-tiny.en-q8_0': '20240405',
|
|
155
|
+
|
|
156
|
+
'whisper.cpp-base': '20240405',
|
|
157
|
+
'whisper.cpp-base-q5_1': '20240405',
|
|
158
|
+
'whisper.cpp-base.en': '20240405',
|
|
159
|
+
'whisper.cpp-base.en-q5_1': '20240405',
|
|
160
|
+
|
|
161
|
+
'whisper.cpp-small': '20240405',
|
|
162
|
+
'whisper.cpp-small-q5_1': '20240405',
|
|
163
|
+
'whisper.cpp-small.en': '20240405',
|
|
164
|
+
'whisper.cpp-small.en-q5_1': '20240405',
|
|
165
|
+
|
|
166
|
+
'whisper.cpp-medium': '20240405',
|
|
167
|
+
'whisper.cpp-medium-q5_0': '20240405',
|
|
168
|
+
'whisper.cpp-medium.en': '20240405',
|
|
169
|
+
'whisper.cpp-medium.en-q5_0': '20240405',
|
|
170
|
+
|
|
171
|
+
'whisper.cpp-large-v1': '20240405',
|
|
172
|
+
'whisper.cpp-large-v2': '20240405',
|
|
173
|
+
'whisper.cpp-large-v2-q5_0': '20240405',
|
|
174
|
+
'whisper.cpp-large-v3': '20240405',
|
|
175
|
+
'whisper.cpp-large-v3-q5_0': '20240405',
|
|
176
|
+
|
|
177
|
+
'whisper.cpp-binaries-linux-x64-cpu-latest-patched': '20240405',
|
|
178
|
+
'whisper.cpp-binaries-windows-x64-cpu-latest-patched': '20240409',
|
|
179
|
+
|
|
180
|
+
'whisper-tiktoken-data': '20240408',
|
|
181
|
+
|
|
182
|
+
'whisper.cpp-binaries-windows-x64-cublas-12.4.0-latest-patched': '20240409',
|
|
183
|
+
'whisper.cpp-binaries-windows-x64-cublas-11.8.0-latest-patched': '20240409',
|
|
144
184
|
}
|
|
@@ -12,10 +12,10 @@ export function resolveToModuleRootDir(relativePath: string) {
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
export function getLowercaseFileExtension(filename: string) {
|
|
15
|
-
const fileExtensionIndex = filename.lastIndexOf(
|
|
15
|
+
const fileExtensionIndex = filename.lastIndexOf('.')
|
|
16
16
|
|
|
17
17
|
if (fileExtensionIndex == -1) {
|
|
18
|
-
return
|
|
18
|
+
return ''
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
return filename.substring(fileExtensionIndex + 1).toLowerCase()
|
|
@@ -27,12 +27,12 @@ export function getAppTempDir(appName: string) {
|
|
|
27
27
|
const platform = process.platform
|
|
28
28
|
const homeDir = os.homedir()
|
|
29
29
|
|
|
30
|
-
if (platform ==
|
|
31
|
-
tempDir = path.join(homeDir,
|
|
32
|
-
} else if (platform ==
|
|
33
|
-
tempDir = path.join(homeDir,
|
|
34
|
-
} else if (platform ==
|
|
35
|
-
tempDir = path.join(homeDir,
|
|
30
|
+
if (platform == 'win32') {
|
|
31
|
+
tempDir = path.join(homeDir, 'AppData', 'Local', 'Temp', appName)
|
|
32
|
+
} else if (platform == 'darwin') {
|
|
33
|
+
tempDir = path.join(homeDir, 'Library', 'Caches', appName)
|
|
34
|
+
} else if (platform == 'linux') {
|
|
35
|
+
tempDir = path.join(homeDir, '.cache', appName)
|
|
36
36
|
} else {
|
|
37
37
|
throw new Error(`Unsupport platform ${platform}`)
|
|
38
38
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { sumVector } from
|
|
2
|
-
import { logToStderr } from
|
|
1
|
+
import { sumVector } from '../math/VectorMath.js'
|
|
2
|
+
import { logToStderr } from './Utilities.js'
|
|
3
3
|
|
|
4
4
|
export abstract class RandomGenerator {
|
|
5
5
|
getIntInRange(min: number, max: number) {
|
|
@@ -85,7 +85,7 @@ export abstract class RandomGenerator {
|
|
|
85
85
|
const randomTarget = this.getFloatInRange(0, sum)
|
|
86
86
|
|
|
87
87
|
let cumSum = 0
|
|
88
|
-
|
|
88
|
+
|
|
89
89
|
for (let i = 0; i < distribution.length; i++) {
|
|
90
90
|
const element = distribution[i]
|
|
91
91
|
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export class SmoothEstimator {
|
|
2
|
+
estimate: number
|
|
3
|
+
|
|
4
|
+
constructor(
|
|
5
|
+
public readonly positiveAdaptationRate: number,
|
|
6
|
+
public readonly negativeAdaptationRate: number,
|
|
7
|
+
initialEstimate = 0.0) {
|
|
8
|
+
|
|
9
|
+
this.estimate = initialEstimate
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
update(target: number, adaptaionRateFactor = 1.0) {
|
|
13
|
+
const residual = target - this.estimate
|
|
14
|
+
|
|
15
|
+
const adaptationRate = residual >= 0 ? this.positiveAdaptationRate : this.negativeAdaptationRate
|
|
16
|
+
|
|
17
|
+
const stepSize = residual * adaptationRate * adaptaionRateFactor
|
|
18
|
+
|
|
19
|
+
this.estimate += stepSize
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
updateDamped(target: number, dampingReference: number, dampingCurvature: number, adaptationRateFactor = 1.0) {
|
|
23
|
+
const residual = target - this.estimate
|
|
24
|
+
|
|
25
|
+
const scaledResidualMagnitude = Math.abs(residual) * dampingCurvature
|
|
26
|
+
|
|
27
|
+
const dampingFactor = (scaledResidualMagnitude) / (scaledResidualMagnitude + dampingReference)
|
|
28
|
+
|
|
29
|
+
const adaptationRate = residual >= 0 ? this.positiveAdaptationRate : this.negativeAdaptationRate
|
|
30
|
+
|
|
31
|
+
const stepSize = residual * adaptationRate * adaptationRateFactor * dampingFactor
|
|
32
|
+
|
|
33
|
+
this.estimate += stepSize
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import path from
|
|
2
|
-
import { createTarball } from
|
|
3
|
-
import { ensureDir, existsSync, move, readdir, stat } from
|
|
4
|
-
import { ensureAndGetPackagesDir } from
|
|
5
|
-
import { appName } from
|
|
6
|
-
import { getRandomHexString } from
|
|
7
|
-
import { getAppTempDir } from
|
|
8
|
-
|
|
9
|
-
const tarballDir =
|
|
1
|
+
import path from 'path'
|
|
2
|
+
import { createTarball } from './Compression.js'
|
|
3
|
+
import { ensureDir, existsSync, move, readdir, stat } from './FileSystem.js'
|
|
4
|
+
import { ensureAndGetPackagesDir } from './PackageManager.js'
|
|
5
|
+
import { appName } from '../api/Common.js'
|
|
6
|
+
import { getRandomHexString } from './Utilities.js'
|
|
7
|
+
import { getAppTempDir } from './PathUtilities.js'
|
|
8
|
+
|
|
9
|
+
const tarballDir = '../resources/tarballs'
|
|
10
10
|
|
|
11
11
|
export async function makeTarballsForInstalledPackages(skipIfExists = false) {
|
|
12
12
|
const packagesDir = await ensureAndGetPackagesDir()
|