cuda = torch.device('cuda') # Default CUDA device, In our case it's Nvidia RTX 3090
cuda0 = torch.device('cuda:0') # specifies the CUDA device to be NVIDIA GeForce RTX 3090
cuda1 = torch.device('cuda:1') # specifies the CUDA device to be NVIDIA GeForce RTX 3080
Example:
x = torch.tensor([1., 2.], device=cuda0)
# x.device is device(type='cuda', index=0)
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
some very long text afowngewngoewtg2w, | |
agnuwrgnuwrgwrgwrhwnu. wgnwoguwe w hgr3g, | |
wgorgunrugnm3w[wrgw, | |
ewgwignwginweiuwengwingien, | |
ewrgiuewrbgoyiweynvn, | |
wqgwqgnin gq3-9nugq-gqg 3g93ugn2q-, | |
giqwnbbwiopngaowgnqwgqoghqprubq, | |
eboginwerobwienqq, |
- To convert to tflite, clone the TensorflowASR repository and build its dependencies
git clone https://github.com/TensorSpeech/TensorFlowASR.git
cd TensorFlowASR
pip3 install -e ".[tf2.8]"
- Download the model weights and config file from here (https://drive.google.com/drive/folders/1rYpiYF0F9JIsAKN2DCFFtEdfNzVbBLHe?usp=sharing)
- Add the downloaded config file to the same directory as the conversion file. ie to
./TensorFlowASR/examples/rnn_transducer/inference/
- Change the code in
gen_tflite_model.py
to the code below
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
import torch | |
import torch.nn as nn | |
import torch.nn.functional as F | |
from typing import Optional | |
class WeightedKappaLoss(nn.Module): | |
""" | |
Implements Weighted Kappa Loss. Weighted Kappa Loss was introduced in the | |
[Weighted kappa loss function for multi-class classification |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.