Download models/helpers/utils.py from WestAI-SC/dcase24_challenge_task1_upbnt: direct link, hf CLI and curl.
- Browser
- Download file 371 Bytes
-
https://huggingface.co/WestAI-SC/dcase24_challenge_task1_upbnt/resolve/main/models/helpers/utils.py
- Command line
-
hf download hf://WestAI-SC/dcase24_challenge_task1_upbnt/models/helpers/utils.py
-
curl -L -o utils.py https://huggingface.co/WestAI-SC/dcase24_challenge_task1_upbnt/resolve/main/models/helpers/utils.py
371 Bytes
| from typing import Optional | |
| def make_divisible(v: float, divisor: int, min_value: Optional[int] = None) -> int: | |
| if min_value is None: | |
| min_value = divisor | |
| new_v = max(min_value, int(v + divisor / 2) // divisor * divisor) | |
| # Make sure that round down does not go down by more than 10%. | |
| if new_v < 0.9 * v: | |
| new_v += divisor | |
| return new_v | |