Skip to content

Instantly share code, notes, and snippets.

View atiorh's full-sized avatar

Atila Orhon atiorh

View GitHub Profile
@atiorh
atiorh / llm_activation_sparsity.py
Last active November 21, 2023 18:52
Activation Sparsity in LLMs
# !pip install transformers sentencepiece
import torch
import torch.nn as nn
torch.set_grad_enabled(False)
from transformers import AutoTokenizer, AutoModelForCausalLM
from transformers.activations import ReLUSquaredActivation
from collections import defaultdict, OrderedDict
@atiorh
atiorh / WhisperKit.swift
Created January 28, 2024 23:30
WhisperKit
let pipe = try await WhisperKit(model: "large-v3")
let result = try await pipe.transcribe(audioPath: "test.{wav/flac/mp3}")?.text