Spaces:
Runtime error
Runtime error
Download fish_speech/scheduler.py from codemo/fish-speech-1: direct link, hf CLI and curl.
- Browser
- Download file 570 Bytes
-
https://huggingface.co/spaces/codemo/fish-speech-1/resolve/d123d130b28d406b383f3fbbf5ebe2a6d598827c/fish_speech/scheduler.py
- Command line
-
hf download hf://spaces/codemo/fish-speech-1@d123d130b28d406b383f3fbbf5ebe2a6d598827c/fish_speech/scheduler.py
-
curl -L -o scheduler.py https://huggingface.co/spaces/codemo/fish-speech-1/resolve/d123d130b28d406b383f3fbbf5ebe2a6d598827c/fish_speech/scheduler.py
570 Bytes
| import math | |
| def get_cosine_schedule_with_warmup_lr_lambda( | |
| current_step: int, | |
| *, | |
| num_warmup_steps: int, | |
| num_training_steps: int, | |
| num_cycles: float = 0.5, | |
| final_lr_ratio: float = 0.0, | |
| ): | |
| if current_step < num_warmup_steps: | |
| return float(current_step) / float(max(1, num_warmup_steps)) | |
| progress = float(current_step - num_warmup_steps) / float( | |
| max(1, num_training_steps - num_warmup_steps) | |
| ) | |
| return max( | |
| final_lr_ratio, | |
| 0.5 * (1.0 + math.cos(math.pi * float(num_cycles) * 2.0 * progress)), | |
| ) | |