This file contains 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
import torch | |
import torch.nn as nn | |
import torch.optim as optim | |
from itertools import chain | |
# Parts of the code are modifications of Pytorch's AdamW optimizer | |
# Parts of the code are modifications of code from https://github.com/jiaweizzhao/GaLore/blob/master/galore_torch/galore_projector.py | |
This file contains 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
probe () { | |
ffprobe -v error -show_entries $1 -of default=noprint_wrappers=1:nokey=1 $2 | |
} | |
get_bitrate (){ | |
original=$1 | |
filesize=$2 | |
max_audio_bitrate=${3:-64000} | |
seconds=`probe format=duration $original` | |
total_bitrate=`echo "scale=0; (8 * $filesize/$seconds)" | bc` # filesize in byte, bitrate in bit |
This file contains 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
probe () { | |
ffprobe -v error -show_entries $1 -of default=noprint_wrappers=1:nokey=1 $2 | |
} | |
get_bitrate (){ | |
original=$1 | |
filesize=$2 | |
max_audio_bitrate=${3:-64000} | |
seconds=`probe format=duration $original` | |
total_bitrate=`echo "scale=0; (8 * $filesize/$seconds)" | bc` # filesize in byte, bitrate in bit |