Skip to content

Instantly share code, notes, and snippets.

View levitation's full-sized avatar
💭
I may be slow to respond.

Roland Pihlakas levitation

💭
I may be slow to respond.
View GitHub Profile
@whjms
whjms / kobold-8bit.md
Last active April 7, 2023 16:35
Instructions for running KoboldAI in 8-bit mode

Running KoboldAI in 8-bit mode

tl;dr use Linux, install bitsandbytes (either globally or in KAI's conda env, add load_in_8bit=True, device_map="auto" in model pipeline creation calls)

Many people are unable to load models due to their GPU's limited VRAM. These models contain billions of parameters (model weights and biases), each of which is a 32 (or 16) bit float. Thanks to the hard work of some researchers [1], it's possible to run these models using 8-bit numbers, which halves the required amount of VRAM compared to running in half-precision. E.g. if a model requires 16GB of VRAM, running with 8-bit inference only requires 8GB.

This guide was written for KoboldAI 1.19.1, and tested with Ubuntu 20.04. These instructions are based on work by Gmin in KoboldAI's Discord server, and Huggingface's efficient LM inference guide.

Requirements

@noseratio
noseratio / DebugSyncContext.cs
Last active November 9, 2023 19:16
A simple helper SynchronizationContext to debug deadlocks
// A helper SynchronizationContext to debug deadlocks by @noseratio
// If you install DebugSyncContext at the very beginning of your console app and run it under debugger,
// it should stop where the deadlock is happening, with a better access to the stack frame.
using System.Diagnostics;
SynchronizationContext.SetSynchronizationContext(new DebugSyncContext());
Console.WriteLine("Hello!");
@noseratio
noseratio / remove-unwanted-windows11-apps.ps1
Last active April 13, 2024 04:57
Windows 11 autorun resident apps that I have to remove manually
# Teams 2.0 (no work account support yet)
winget uninstall MicrosoftTeams_8wekyb3d8bbwe
# Your Phone
winget uninstall Microsoft.YourPhone_8wekyb3d8bbwe
# Widgets (Web Experience Pack)
winget uninstall MicrosoftWindows.Client.WebExperience_cw5n1h2txyewy
# Cortana
@drakodev
drakodev / free-disposable-email-providers.txt
Last active April 13, 2024 05:38
16413 Free or Disposable Email Providers Domains - Collected and combined from various resources primarily built on top of lists provided by Okutbay & frankwarwick
0-00.usa.cc
0-mail.com
0.pl
001.igg.biz
0039.cf
0039.ga
0039.gq
0039.ml
007addict.com
00b2bcr51qv59xst2.cf
@noseratio
noseratio / TaskSchedulerAwaiter.cs
Created September 16, 2020 11:29
Continue on the specified task scheduler, which becomes the current one
// by @noseratio
#nullable enable
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Threading;
using System.Threading.Tasks;
namespace Noseratio.Experimental
// This app initially started from Flavio Copes analytics example
// but diverged quite a bit to generate images as well as track views
// https://flaviocopes.com/count-visits-static-site/
const express = require('express')
const app = express()
// no db - so global var to keep track of count
let counter = 0
@BigSully
BigSully / DNS over TLS for unbound
Last active December 14, 2023 10:54
DNS over TLS configuration for unbound, including Google DNS, Cloudflare DNS and Quad9 DNS
server:
logfile: ""
# verbosity: 2
username: "nobody"
interface: 0.0.0.0
access-control: 0.0.0.0/0 allow
prefetch: yes
# include: "/opt/unbound/local.conf"
# include: "/opt/unbound/customize.conf"
@kripod
kripod / murmur3a.ts
Last active August 2, 2020 14:56
MurmurHash3_x86_32 in TypeScript
// Inspired by: https://github.com/levitation/murmurhash-js
function murmur3a(data: string, seed: number = 0): number {
const len = data.length;
const nBlocks = len >>> 2;
const tailOffset = nBlocks << 2;
let k1;
/* Body */
@pknowledge
pknowledge / opencv_Background_Subtraction.py
Created December 9, 2019 23:15
How to Use Background Subtraction Methods in Python Opencv
import numpy as np
import cv2 as cv
cap = cv.VideoCapture('vtest.avi')
#kernel = cv.getStructuringElement(cv.MORPH_ELLIPSE, (3,3))
fgbg = cv.bgsegm.createBackgroundSubtractorMOG()
#fgbg = cv.bgsegm.BackgroundSubtractorGMG()
#fgbg = cv.createBackgroundSubtractorMOG2(detectShadows=True)
#fgbg = cv.createBackgroundSubtractorKNN(detectShadows=True)
while True:
ret, frame = cap.read()
@smitpatel
smitpatel / MultiLevelIncludeQueries.cs
Last active October 15, 2021 17:39
This app shows how to do split queries for multiple levels of collection include in EF Core 3.0
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.EntityFrameworkCore;
namespace EFSampleApp
{
public class Program
{
public static void Main(string[] args)