Skip to content

Instantly share code, notes, and snippets.

View sheosi's full-sized avatar
👋

Sergio Tortosa sheosi

👋
View GitHub Profile
@sheosi
sheosi / gist:deee2ec9fe568f20c682812df6054fcf
Created August 22, 2021 17:56
Tensorflow to onnx conversion
python3 -m tf2onnx.convert --graphdef jarvis_S_B.pb --output model.onnx --inputs net_input:0 --outputs net_output:0
2021-08-22 12:08:05.619203: W tensorflow/stream_executor/platform/default/dso_loader.cc:59] Could not load dynamic library 'libcudart.so.10.1'; dlerror: libcudart.so.10.1: cannot open shared object file: No such file or directory
2021-08-22 12:08:05.619240: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
/usr/lib/python3.6/runpy.py:125: RuntimeWarning: 'tf2onnx.convert' found in sys.modules after import of package 'tf2onnx', but prior to execution of 'tf2onnx.convert'; this may result in unpredictable behaviour
warn(RuntimeWarning(msg))
2021-08-22 12:08:06.808733: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcuda.so.1
2021-08-22 12:08:06.838681: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:982] successful NUMA node read from SysFS had negative

Para usar DeepSpeech neceesitas, el native client que puedes encontrar en: https://github.com/mozilla/DeepSpeech/releases, (hay tres versiones, Gpu, Cpu y TfLite. Gpu no la he probado). Descarga la versión de CPU para Linux amd64.

Luego necesitas el archivo de modelo de ejemplo: 'deepspeech-0.7.3-models.pbmm'.

Desempaqueta el native client donde quieras, y añade la carpeta a las variables LIBRARY_PATH y LD_LIBRARY_PATH (export LIBRARY_PATH "$LIBRARY_PATH:/ruta/a/la/carpeta", lo mismo con LD_LIBRARY_PATH)

Copia el archivo de modelo a resources/stt/deepspeech/

(Nota: Si va lento puedes bajar la versión de Tensorflow Lite (tflite) tanto para el modelo, que tendrás que renombrar como .pbmm para que el programa lo coja, como el native client que deberás borrar las variables de antes, puedes cerrar la terminal, i poner las nuevas)

@sheosi
sheosi / 01-prime-render.conf
Created June 7, 2020 15:24
Enable prime render, put into /etc/X11/xorg.conf.d/
Section "ServerLayout"
Identifier "layout"
Screen 0 "iGPU"
EndSection
Section "Screen"
Identifier "iGPU"
Device "iGPU"
EndSection
QString randomToken(int minLength, int maxLength)
{
Q_ASSERT(minLength <= maxLength);
const static char* chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
const static int charl = strlen(chars);
const int length = minLength + ((int)qrand() % (maxLength - minLength + 1));
QString token;
token.reserve(length);
for (int i = 0; i < length; ++i)
{
error[E0495]: cannot infer an appropriate lifetime for autoref due to conflicting requirements
--> src/tts.rs:158:14
|
158 | .create_voice("TestVoice")
| ^^^^^^^^^^^^
|
note: first, the lifetime cannot outlive the anonymous lifetime #2 defined on the body at 156:32...
--> src/tts.rs:156:32
|
156 | let mut tts = PicoTts::new(|sys, ta_res, sg_res|{
@sheosi
sheosi / self_ref_pico.rs
Created November 19, 2019 15:48
Self reference in structs
struct PicoTts<'a> {
sys: Rc<RefCell<pico::System>>,
ta_res: ttspico::Resource<'a>,
sg_res: ttspico::Resource<'a>,
voice: pico::Voice<'a>,
engine: pico::Engine<'a>
}
impl<'a> PicoTts<'a> {
@sheosi
sheosi / sandbox.lua
Created November 19, 2016 16:49
Howl sandbox
-- Configuration. File to be processed
processedFile = "/path/to/file"
-- Program:
--
local moon = require "moonscript"
-- An empty proxy which just replicates itself when a value is needed
@sheosi
sheosi / gist:3b6bf01a4fc878c1f7a3
Created June 20, 2015 10:36
Obbg errors 32bits with SDL2
In file included from src/main.c:14:0:
src/stb_gl.h: In function ‘stbgl_rand’:
src/stb_gl.h:431:4: warning: this decimal constant is unsigned only in ISO C90 [enabled by default]
static unsigned int stbgl__rand_seed = 3248980923; // random typing
^
src/glext_list.h: At top level:
src/stb_gl.h:1086:37: error: ‘glActiveTextureARB’ redeclared as different kind of symbol
#define GLE(a,b) PFNGL##b##PROC gl##a;
^
src/stb_gl.h:1037:20: note: in expansion of macro ‘GLE’
In file included from src/main.c:9:0:
stb/stb.h: In function ‘stb_hashptr’:
stb/stb.h:3283:21: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
unsigned int x = (unsigned int) p;
^
stb/stb.h: In function ‘stb_rehash_improved’:
stb/stb.h:3300:23: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
return stb_hashptr((void *) v);
^
stb/stb.h: In function ‘stb_hash_fast’: