Skip to content

Instantly share code, notes, and snippets.

View rasbt's full-sized avatar

Sebastian Raschka rasbt

View GitHub Profile
@rasbt
rasbt / whisper-audio-to-text.py
Created January 26, 2023 17:46
Transcribes audio files using OpenAI Whisper
# Setup:
# conda create -n whisper python=3.9
# conda activate whisper
# https://github.com/openai/whisper
# pip install git+https://github.com/openai/whisper.git
# Usage:
# python whisper-audio-to-text.py --audio_dir my_files --out_dir texts
import argparse
@rasbt
rasbt / chatgpt-summarize.py
Created May 6, 2023 13:02
Script using the ChatGPT API to summarize text
# pip install openai
import openai
import os
# export API key environment variable before
# running this script (see https://platform.openai.com/account/api-keys)
# E.g.,
#
# export OPENAI_API_KEY=copy_paste_key_from_your_account
@rasbt
rasbt / transformer-outline.py
Created January 21, 2024 00:01
Transformer PyTorch Pseudo Code
import torch.nn as nn
class Transformer(nn.Module):
def __init__(self, ...):
super().__init__()
...
self.encoder_layers = nn.ModuleList(...)
self.decoder_layers = nn.ModuleList(...)
...
@rasbt
rasbt / llama-vs-gemma.py
Created March 13, 2025 15:51
Compute memory usage for various LLMs like Gemma, Llama, etc.
# Sebastian Raschka 2025
#
#
# Usage:
# python llama-vs-gemma.py \
# --auth_token hf_... \
# --model_name meta-llama/Llama-3.2-1B \
# --prompt medium
import argparse
@rasbt
rasbt / reasoning-inference-scaling-gh-models-examples.ipynb
Created April 3, 2025 17:23
Reasoning Model Inference Scaling Example with DeepSeek and GitHub Models
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.