Run this model with HF Jobs

Run AlexeyNe/kitten-tts-2-mini-coreml on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.

Paste one of these prompts into your coding agent:

Fine-tune on my dataset

Use HF Jobs to fine-tune https://huggingface.co/AlexeyNe/kitten-tts-2-mini-coreml. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.

Run batch inference

Use HF Jobs to run batch inference with https://huggingface.co/AlexeyNe/kitten-tts-2-mini-coreml on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
File size: 1,548 Bytes
e66a8be
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# Графы Kitten TTS 2 Mini гибкой длины: длительности с кодировщиками текста и
# интонация с началом декодера. Генератор — generator_buckets.py.
#   python kitten_graphs.py <папка>
import sys, os, numpy as np, torch, coremltools as ct
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
import network as ek

OUT = sys.argv[1]
os.makedirs(OUT, exist_ok=True)
T, Fr = 40, 120
jobs = [
    ('kitten_duration', ek.Duration(), (torch.randint(1, 170, (1, T), dtype=torch.int32), torch.randn(1, 256), torch.ones(1)),
     [ct.TensorType('input_ids', shape=(1, ct.RangeDim(3, 256, default=T)), dtype=np.int32), ct.TensorType('ref_s', shape=(1, 256)), ct.TensorType('speed', shape=(1,))],
     ['duration', 'd', 't_en']),
    ('kitten_prosody', ek.Prosody(), (torch.randn(1, 640, Fr), torch.randn(1, 512, Fr), torch.randn(1, 256)),
     [ct.TensorType('en', shape=(1, 640, ct.RangeDim(2, 1200, default=Fr))), ct.TensorType('asr', shape=(1, 512, ct.RangeDim(2, 1200, default=Fr))), ct.TensorType('ref_s', shape=(1, 256))],
     ['f0', 'x_pre']),
]
for name, mod, ex, inputs, outs in jobs:
    with torch.no_grad(): traced = torch.jit.trace(mod.eval(), ex, check_trace=False)
    m = ct.convert(traced, inputs=inputs, outputs=[ct.TensorType(o) for o in outs], minimum_deployment_target=ct.target.iOS18,
                   compute_precision=ct.precision.FLOAT16, convert_to='mlprogram')
    m.save(f'{OUT}/{name}.mlpackage'); print('saved', name, flush=True)