Skip to content

Instantly share code, notes, and snippets.

import datetime
from pathlib import Path
import torch
import torchaudio
from torchaudio.transforms import MelSpectrogram
from einops import rearrange
from vocos import Vocos
There appears to be a string encoded in the binary payload:
https://gist.github.com/q3k/af3d93b6a1f399de28fe194add452d01#file-hashes-txt-L115
Which functions as a killswitch:
https://piaille.fr/@zeno/112185928685603910
Thus, one workaround for affected systems might be to add this to `/etc/environment`:
```
@smx-smx
smx-smx / XZ Backdoor Analysis
Last active February 26, 2025 01:17
[WIP] XZ Backdoor Analysis and symbol mapping
XZ Backdoor symbol deobfuscation. Updated as i make progress
@OrionReed
OrionReed / dom3d.js
Last active April 19, 2025 12:06
3D DOM viewer, copy-paste this into your console to visualise the DOM topographically.
// 3D Dom viewer, copy-paste this into your console to visualise the DOM as a stack of solid blocks.
// You can also minify and save it as a bookmarklet (https://www.freecodecamp.org/news/what-are-bookmarklets/)
(() => {
const SHOW_SIDES = false; // color sides of DOM nodes?
const COLOR_SURFACE = true; // color tops of DOM nodes?
const COLOR_RANDOM = false; // randomise color?
const COLOR_HUE = 190; // hue in HSL (https://hslpicker.com)
const MAX_ROTATION = 180; // set to 360 to rotate all the way round
const THICKNESS = 20; // thickness of layers
const DISTANCE = 10000; // ¯\\_(ツ)_/¯
@thomwolf
thomwolf / fast_speech_text_speech.py
Last active January 14, 2025 12:13
speech to text to speech
""" To use: install LLM studio (or Ollama), clone OpenVoice, run this script in the OpenVoice directory
git clone https://github.com/myshell-ai/OpenVoice
cd OpenVoice
git clone https://huggingface.co/myshell-ai/OpenVoice
cp -r OpenVoice/* .
pip install whisper pynput pyaudio
"""
from openai import OpenAI
import time
@ehartford
ehartford / gist:5d8452c1f2e8395398e86106388660df
Created January 1, 2024 07:09
convert yayi2-30b to llama. All the credit to Charles Goddard and Weyaxi
import copy
import os
import safetensors.torch
import glob
import json
def transform_st(path: str, out_dir: str):
data = safetensors.torch.load_file(path)
old_keys = list(data.keys())
@abacaj
abacaj / humaneval_m7x8.jsonl
Created December 9, 2023 01:04
Results from running "mistral-8x7B" on humaneval (code benchmark)
{"task_id": "HumanEval/0", "prompt": "from typing import List\n\n\ndef has_close_elements(numbers: List[float], threshold: float) -> bool:\n \"\"\" Check if in given list of numbers, are any two numbers closer to each other than\n given threshold.\n >>> has_close_elements([1.0, 2.0, 3.0], 0.5)\n False\n >>> has_close_elements([1.0, 2.8, 3.0, 4.0, 5.0, 2.0], 0.3)\n True\n \"\"\"\n", "canonical_solution": " for idx, elem in enumerate(numbers):\n for idx2, elem2 in enumerate(numbers):\n if idx != idx2:\n distance = abs(elem - elem2)\n if distance < threshold:\n return True\n\n return False\n", "test": "\n\nMETADATA = {\n 'author': 'jt',\n 'dataset': 'test'\n}\n\n\ndef check(candidate):\n assert candidate([1.0, 2.0, 3.9, 4.0, 5.0, 2.2], 0.3) == True\n assert candidate([1.0, 2.0, 3.9, 4.0, 5.0, 2.2], 0.05) == False\n assert candidate([1.0, 2.0, 5.9, 4.0, 5.0], 0.95) == True\n assert candidate([1.0, 2.0,
@cgfarmer4
cgfarmer4 / AudioSessionManager.swift
Last active September 16, 2024 05:38
Poor mans streaming using AVCaptureSession
class AudioSessionManager: NSObject, ObservableObject {
@Published var microphones: [AVCaptureDevice] = []
var captureSession: AVCaptureSession = .init()
var audioOutput: AVCaptureAudioDataOutput?
var configured: Bool = false
private var audioInput: AVCaptureDeviceInput?
let dataOutputQueue = DispatchQueue(label: "audio_queue",
qos: .userInteractive,
@ChrisHayduk
ChrisHayduk / merge_qlora_with_quantized_model.py
Last active April 18, 2025 08:23
Merging QLoRA weights with quantized model
"""
The code below combines approaches published by both @eugene-yh and @jinyongyoo on Github.
Thanks for the contributions guys!
"""
import torch
import peft
# This script was adapted from merge.py from the KoboldAI discord server.
# I believe the original author is concedo
import os
import gc
import json
import shutil
import resource
import torch