Skip to content

Instantly share code, notes, and snippets.

View jph00's full-sized avatar
🦘

Jeremy Howard jph00

🦘
View GitHub Profile
@rbiswasfc
rbiswasfc / minai.md
Created September 6, 2024 08:41
Minai

Introduction

Minai is a flexible and lightweight deep learning training framework developed interactively in the part 2 of fast.ai's 2022-23 course.

The core of minai is the Learner class, which orchestrates the training process through an extensive callback system, allowing users to easily modify or extend any part of the training loop.

Minai provides a set of utilities for data handling, device management, visualization, and performance optimization, making it suitable for both quick prototyping and advanced deep learning projects.


README.md

Hypermedia Systems: book summary

This is a summary of "Hypermedia Systems" by Carson Gross, Adam Stepinski, Deniz Akşimşek. Summary created by Jeremy Howard with AI help.

  • Website for the book
  • The revolutionary ideas that empowered the Web
  • A simpler approach to building applications on the Web and beyond with htmx and Hyperview
  • Enhancing web applications without using SPA frameworks

1: Hypermedia: A Reintroduction

@drscotthawley
drscotthawley / audio_data2url.py
Last active September 3, 2024 19:52
Move audio data in Jupyter notebooks to external urls stored on separate Git branch
#!/usr/bin/env python3
# audio_data2url.py
# Author: Scott H. Hawley
# License: MIT
# Date: Sep 2, 2024
# Description: This script will convert base64 audio src data in a Jupyter notebook to URLs of the same audio
# which is saved in a separate branch of the same GitHub repository. The script will save the audio files in a
# directory named 'audio_files' and commit them to the 'audio-storage' branch. The script will then replace the
# base64 data with the raw URL of the audio file in the notebook. The script can be run on a single notebook file
@audreyfeldroy
audreyfeldroy / jupyter_nbclassic_shortcuts.md
Last active August 23, 2024 07:07
Jupyter nbclassic keyboard shortcuts (copied from nbclassic > H)

Command Mode (press Esc to enable)

F : find and replace

: enter edit mode

⌘⇧F : open the command palette

⌘⇧P : open the command palette

@gnat
gnat / index.html
Last active July 7, 2024 01:55
3D Card (Surreal + CSS Scope Inline)
<html>
<head>
<script src="https://gnat.github.io/css-scope-inline/script.js"></script>
<script src="https://gnat.github.io/surreal/surreal.js"></script>
</head>
<body>
<style>
* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; display: flex; justify-content: center; align-items: center; }
body { font-family: system-ui, sans-serif; perspective: 1500px; background: linear-gradient(#666, #222); }
@tysam-code
tysam-code / discrete-action-backprop-bypass-hlb-cifar10-demo.py
Last active March 14, 2024 09:24
This is a network sketch. Network sketches aren't complete, released versions, but rather a (hopefully convincing) proof-of-concept of a particular idea. The intent of this network sketch is to show that traditional backprop is not required in order to learn and coordinate a network's dataflow structure over a simulated discrete, non-backproppab…
# Sketch-specific note: a roughly ~25 run battery for this code estimated a roughly ~93.11% accuracy in the same number of steps as the baseline network, ~1.7x runtime overhead (much of which goes to the torch.randn allocations and extra layer calculations).
# Note: The one change we need to make if we're in Colab is to uncomment this below block.
# If we are in an ipython session or a notebook, clear the state to avoid bugs
#"""
try:
_ = get_ipython().__class__.__name__
## we set -f below to avoid prompting the user before clearing the notebook state
%reset -f
except NameError:
@KeremTurgutlu
KeremTurgutlu / multipack_sampler_flash_attn.py
Last active October 7, 2023 04:44
Multipack Sampler x Flash Attention
"""
Testing flash attn with multipacking which essentially packs sequences using https://github.com/imoneoi/multipack_sampler,
and passes a single sequence of `1 x (bs x seqlen)` to the model to avoid padding.
An alternative is to use block diagonal attention as attention bias, but the following uses flash attention 2 which
is much faster.
Multipacking can be used to speed up both pretraining and finetuning.
"""
import os
import openai
from jinja2 import Template, meta, Environment
from dotenv import load_dotenv
load_dotenv() # add a .env file with the following
# setup is for azure, change accordingly for normal openai
openai.api_key = os.getenv("OPENAI_API_KEY")
openai.api_type = os.getenv("OPENAI_API_TYPE")
openai.api_version = os.getenv("OPENAI_API_VERSION")
openai.api_base = os.getenv("OPENAI_API_BASE")
import argparse
import copy
import torch
import datasets as hfds
import transformers
from tqdm.auto import tqdm
import wandb
@ChrisHayduk
ChrisHayduk / merge_qlora_with_quantized_model.py
Last active December 31, 2024 05:09
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