This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from fish_speech.models.text2semantic.inference import * | |
text: str = ["Что? Он никогда не работал?", "Никогда бы о таком не подумал раньше"] | |
prompt_text: Optional[list[str]] = ["Что он никогда вот не работал, но стоит ему где-то пристроиться, он тут же идёт в гору очень быстро"] * 2 | |
prompt_tokens: Optional[list[Path]] = [Path("prompt_ORD_1.npy"), ] * 2 | |
num_samples: int = 1 | |
max_new_tokens: int = 256 | |
top_p: int = 0.7 | |
repetition_penalty: float = 1.2 | |
temperature: float = 0.7 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cd ~ && find . -name "*:Zone.Identifier" -type f -delete && cd - > /dev/null |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
x = torch.ones(bs, 784) * 0.5 + 0.02 * torch.randn(bs, 784) | |
x.requires_grad_(True).retain_grad() | |
for i in range(0, n//bs): | |
preds = model(x) | |
loss = loss_func(preds, y) | |
loss.backward() | |
with torch.no_grad(): | |
x -= x.grad * lr | |
if x.grad.grad_fn is not None: | |
x.grad.detach_() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_data_to_buffer(train_config): | |
buffer = list() | |
text = process_text(train_config.data_path) | |
audio_files = sorted(Path(train_config.audio_path).iterdir()) | |
spec = Spectrogram(512) | |
start = time.perf_counter() | |
for i, file in tqdm(zip(range(len(text)), audio_files)): | |
mel_gt_name = os.path.join( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_data_to_buffer(train_config): | |
buffer = list() | |
text = process_text(train_config.data_path) | |
audio_files = sorted(Path(train_config.audio_path).iterdir()) | |
hop_length = 256 | |
frame_period = hop_length / 22_050 * 1000 | |
start = time.perf_counter() | |
for i, file in tqdm(zip(range(len(text)), audio_files)): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CORR = {'h#': "", | |
'sh': "ʃ", | |
'iy': "i", | |
'hv': "ɦ", | |
'ae': "æ", | |
'dcl': "d̚", | |
'd': "d", | |
'y': "j", | |
'er': "ɝ", | |
'aa': "ɑ", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def replace_slashes(s:str): | |
return s.replace('\\', '/') | |
df.path = df.path.map(replace_slashes) |