Skip to content

Instantly share code, notes, and snippets.

View trappedinspacetime's full-sized avatar
🏠
Working from home

Kenn trappedinspacetime

🏠
Working from home
  • For Personal Use
  • Istanbul
View GitHub Profile
@trappedinspacetime
trappedinspacetime / llama-home.md
Created May 14, 2023 19:56 — forked from rain-1/llama-home.md
How to run Llama 13B with a 6GB graphics card

This worked on 14/May/23. The instructions will probably require updating in the future.

llama is a text prediction model similar to GPT-2, and the version of GPT-3 that has not been fine tuned yet. It is also possible to run fine tuned versions (like alpaca or vicuna with this. I think. Those versions are more focused on answering questions)

Note: I have been told that this does not support multiple GPUs. It can only use a single GPU.

It is possible to run LLama 13B with a 6GB graphics card now! (e.g. a RTX 2060). Thanks to the amazing work involved in llama.cpp. The latest change is CUDA/cuBLAS which allows you pick an arbitrary number of the transformer layers to be run on the GPU. This is perfect for low VRAM.

  • Clone llama.cpp from git, I am on commit 08737ef720f0510c7ec2aa84d7f70c691073c35d.
@trappedinspacetime
trappedinspacetime / diarise.py
Created November 10, 2022 15:06 — forked from lmmx/diarise.py
Python commands to create speaker diarisation
# ffmpeg -i foo.m4a foo.wav
from pyannote.audio import Pipeline
pipeline = Pipeline.from_pretrained("pyannote/speaker-diarization")
diarization = pipeline("foo.wav")
# RTTM format https://catalog.ldc.upenn.edu/docs/LDC2004T12/RTTM-format-v13.pdf
with open("foo.rttm", "w") as rttm:
diarization.write_rttm(rttm)
@trappedinspacetime
trappedinspacetime / Makefile
Created November 5, 2022 15:04 — forked from mertyildiran/Makefile
transregion: X11 SHAPE extension input region demo
# Makefile for transregion
CFLAGS = -g
LDFLAGS = -L/usr/X11R6/lib -lXpm -lXext -lX11 -lm
all: transregion
transregion: transregion.o
$(CC) -o transregion transregion.o $(LDFLAGS)
@trappedinspacetime
trappedinspacetime / cairo_example.c
Created October 21, 2022 17:05 — forked from ryanflannery/cairo_example.c
Problem in cairo + xcb where alpha blending is cumulative (becoming more opaque with each render)
/*
* NOTE: This is a little long because I'm including all XCB setup I have
* (including handling tiling window managers). It's below the main cairo logic
* for ease, but included for posterity. This is a subset of a larger program
* I'm working on.
*
* WHAT THIS IS:
* A sample program illustrating a problem I'm having with cairo/xcb, where I
* want to have a window that supports transparency (alpha channel) for the
* background color, and other components, with a regular re-draw cycle
@trappedinspacetime
trappedinspacetime / build_lm.sh
Created October 16, 2022 19:57 — forked from goodmami/build_lm.sh
Ngrams, LMs, and Perplexity in AWK and sed
#!/bin/bash
ngram_count_file="$1"
lm_file="$2"
awk -v f="$ngram_count_file"\
'function log10(x){ return log(x)/log(10.0) }
BEGIN {
while (getline < f) {
if(/[0-9]+\t[^ ]+$/) { type[1]++; token[1]=token[1]+$1 }
@trappedinspacetime
trappedinspacetime / cal.lua
Created April 3, 2022 14:17 — forked from meskarune/cal.lua
conky calendar and weather
#!/usr/bin/env lua
conky_color = "${color1}%2d${color}"
t = os.date('*t', os.time())
year, month, currentday = t.year, t.month, t.day
daystart = os.date("*t",os.time{year=year,month=month,day=01}).wday
month_name = os.date("%B")
#!/usr/bin/env -S bash -e
# REPO='https://gitlab.gnome.org/GNOME/vte.git'
REPO='https://github.com/GNOME/vte.git'
LIBPATH='/usr/local/lib/x86_64-linux-gnu'
LDCONFPATH='/etc/ld.so.conf'
# See Deps:
# https://github.com/GNOME/vte/blob/master/meson.build
# On Ubuntu 21.04, GNOME-Terminal 3.38.1:
// gcc test.c -lX11 -lXext
/* Some clumsy app to test X11 Shape extension.
*
* The app window consists of three zones:
* +-------+
* | A |
* +---+---+
* | B | C |
* +---+---+
*
watch --difference=cummulative --interval=1 '(echo device read_IOs read_merges read_sectors read_ticks write_IOs write_merges write_sectors write_ticks in_flight io_ticks time_in_queue; for file in /sys/block/*/stat; do echo -n $file; cat $file; done) | column -t'
# OUTPUTS:
#device read_IOs read_merges read_sectors read_ticks write_IOs write_merges write_sectors write_ticks in_flight io_ticks time_in_queue
#/sys/block/dm-0/stat 116962 0 2212746 314096 7705653 0 150218536 609670232 0 644428 610921004
#/sys/block/dm-1/stat 116479 0 2208882 313324 7686986 0 150218536 609676068 0 644616 611418072
#/sys/block/dm-2/stat 302 0 2416 780 0 0 0 0 0 148 780
#/sys/block/sda/stat 91181 26273 2217246 74876 7314854 388030 150261802 16954364
@trappedinspacetime
trappedinspacetime / gist:8eb3c26e1028a1c2fbb6a8d6998710af
Created May 16, 2021 20:06 — forked from kui/gist:2622504
get the active window on X window system.
// -*- coding:utf-8-unix; mode:c; -*-
//
// get the active window on X window system
//
#include <stdlib.h>
#include <stdio.h>
#include <locale.h>
#include <X11/Xlib.h> // `apt-get install libx11-dev`