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
#!/bin/bash | |
# Script to control the fan speed automatically | |
setFanSpeed() { | |
eval "nvidia-settings -a GPUFanControlState=1 -a [fan:0]/GPUCurrentFanSpeed=$1 > /dev/null" | |
} | |
cleanup() { | |
eval "nvidia-settings -a GPUFanControlState=0" |
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
""" | |
Takes two files produced by fastText's print-word-vectors or print-sentence-vectors and compares the vectors by similarity. | |
(See https://github.com/facebookresearch/fastText.) | |
This can be useful for benchmarking output or even generating benchmark data. | |
For example: |
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
# See https://github.com/facebookresearch/fastText/blob/master/get-wikimedia.sh | |
# | |
# From https://github.com/facebookresearch/fastText/issues/161: | |
# | |
# We now have a script called 'get-wikimedia.sh', that you can use to download and | |
# process a recent wikipedia dump of any language. This script applies the preprocessing | |
# we used to create the published word vectors. | |
# | |
# The parameters we used to build the word vectors are the default skip-gram settings, | |
# except with a dimensionality of 300 as indicated on the top of the list of word |
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
def f1_loss(y_true:torch.Tensor, y_pred:torch.Tensor, is_training=False) -> torch.Tensor: | |
'''Calculate F1 score. Can work with gpu tensors | |
The original implmentation is written by Michal Haltuf on Kaggle. | |
Returns | |
------- | |
torch.Tensor | |
`ndim` == 1. 0 <= val <= 1 | |