Skip to content

Instantly share code, notes, and snippets.

View vvolhejn's full-sized avatar

Václav Volhejn vvolhejn

View GitHub Profile
@vvolhejn
vvolhejn / useTts.ts
Created August 11, 2025 09:19
Kyutai TTS connection via React hook
// For context, see: https://kyutai.org/next/tts
// and https://github.com/kyutai-labs/delayed-streams-modeling/issues/111
import { useEffect, useState, useRef, useCallback } from "react";
import useWebSocket, { ReadyState } from "react-use-websocket";
import { encode, decode, decodeAsync } from "@msgpack/msgpack";
import ttsVoices from "@/assets/tts_voices.json";
const SAMPLE_RATE = 24000;
@vvolhejn
vvolhejn / torch_conv_layer_to_fully_connected.py
Last active December 8, 2024 16:10
Convert PyTorch convolutional layer to fully connected layer
"""
The function `torch_conv_layer_to_affine` takes a `torch.nn.Conv2d` layer `conv`
and produces an equivalent `torch.nn.Linear` layer `fc`.
Specifically, this means that the following holds for `x` of a valid shape:
torch.flatten(conv(x)) == fc(torch.flatten(x))
Or equivalently:
conv(x) == fc(torch.flatten(x)).reshape(conv(x).shape)
A/B testing, accuracy, action, activation function, active learning, AdaGrad, agent, agglomerative clustering, AR, area under the PR curve, area under the ROC curve, artificial general intelligence, artificial intelligence, attribute, AUC (Area under the ROC Curve), augmented reality, automation bias, average precision, backpropagation, bag of words, baseline, batch, batch normalization, batch size, Bayesian neural network, Bellman equation, bias (ethics/fairness), bias (math), bigram, binary classification, binning, boosting, bounding box, broadcasting, bucketing, calibration layer, candidate generation, candidate sampling, categorical data, centroid, centroid-based clustering, checkpoint, class, classification model, classification threshold, class-imbalanced dataset, clipping, Cloud TPU, clustering, co-adaptation, collaborative filtering, confirmation bias, confusion matrix, continuous feature, convenience sampling, convergence, convex function, convex optimization, convex set, convolution, convolutional f
@vvolhejn
vvolhejn / ukazka1.5.cpp
Created September 3, 2019 21:26
MO-P ukazkova uloha reseni 1.5
#include <iostream>
#include <vector>
using namespace std;
int main() {
int n, k;
cin >> n >> k;
vector<int> a(n);
for (int i = 0; i < n; i++) {
@vvolhejn
vvolhejn / ukazka2.cpp
Created August 14, 2019 20:29
MO-P ukazkova uloha reseni 2
#include <iostream>
#include <vector>
using namespace std;
int main() {
int n, k;
cin >> n >> k;
vector<int> a(n);
for (int i = 0; i < n; i++) {
@vvolhejn
vvolhejn / ukazka1.cpp
Last active August 22, 2019 06:41
MO-P ukazkova uloha reseni 1
#include <iostream>
#include <vector>
using namespace std;
int main() {
int n, k;
cin >> n >> k;
vector<int> a(n);
for (int i = 0; i < n; i++) {
@vvolhejn
vvolhejn / sifra.txt
Created December 23, 2017 21:04
Šifra
Ktfjfa, Wsjxjwqgt, Ejbtfpwt, Wsjxjwqgt, Gqxqgft Xjxwqg, Btekqgwt, Gqxqgft Xjxwqg, Klxj Zsijhqga
Pgthqbeowqgt, Pkjnzqgpwl ftystxj, Ft Wfjxlnj, Iqhtfjnwt xtzstyt, Ft Wfjxlnj, Tsilpqgq ftklphj, Cjstpwqgq ftklphj
Gehtgpwt, Ueqslfn, Ftsqyfj hsjyt, Phtsqklphpwt
Pjilejqgt, Hztwosqgt, Bstpfa kqph, Gjhlxfl ftklphj
Ftystxj Zqelpqgjnl, Bstxpwa zsty, Gaplzsty, Qeptfpwt, Ftystxj Zqelpqgjnl
@vvolhejn
vvolhejn / langs.txt
Last active January 28, 2023 08:14
Codeforces: Programming languages of red contestants
Handle Language Usage in last 50 submissions
--------------------------------------------------------------------
tourist GNU C++11 50
moejy0viiiiiv GNU C++14 49
W4yneb0t GNU C++11 50
Petr Java 8 49
TakanashiRikka GNU C++11 50
LHiC GNU C++11 50
izrak GNU C++14 48
anta GNU C++14 50