Skip to content

Instantly share code, notes, and snippets.

@davidhershey
davidhershey / full_draft_prompt_chatml.txt
Created December 4, 2023 23:18
Magic Draft Prompt (full assistant format)
{
"messages": [
{
"role": "system",
"content": "You are DraftGPT, a Magic the Gathering Hall of Famer and helpful AI assistant that helps players choose what card to pick during a draft. You are a master of the current draft set, and know every card well.\n\nWhen asked for a draft pick, respond with the card's name first."
},
{
"role": "user",
"content": "In our Magic the Gathering draft, we're on pack 2 pick 13. These are the contents of our pool so far:\n-------------------------\nEvolving Wilds -- (common)\nRat Out -- {B} (common)\nNot Dead After All -- {B} (common)\nHopeless Nightmare -- {B} (common)\nBarrow Naughty -- {1}{B} (common)\nUnassuming Sage -- {1}{W} (common)\nThe Witch's Vanity -- {1}{B} (uncommon)\nSpell Stutter -- {1}{U} (common)\nMintstrosity -- {1}{B} (common)\nWater Wings -- {1}{U} (common)\nBarrow Naughty -- {1}{B} (common)\nGadwick's First Duel -- {1}{U} (uncommon)\nBitter Chill -- {1}{U} (uncommon)\nThe Princess Takes Flight -- {2}{W} (uncommon)\n
@davidhershey
davidhershey / draft_prompt.txt
Created December 4, 2023 22:25
Magic Draft Prompt
In our Magic the Gathering draft, we're on pack 3 pick 1. These are the contents of our pool so far:
-------------------------
Evolving Wilds -- (common)
Brave the Wilds -- {G} (common)
Vampiric Rites -- {B} (uncommon)
Torch the Tower -- {R} (common)
Hopeless Nightmare -- {B} (common)
Harried Spearguard -- {R} (common)
Leaping Ambush -- {G} (common)
Questing Druid // Seek the Beast -- {1}{G} // {1}{R} (rare)
@veekaybee
veekaybee / normcore-llm.md
Last active April 26, 2024 09:36
Normcore LLM Reads

Anti-hype LLM reading list

Goals: Add links that are reasonable and good explanations of how stuff works. No hype and no vendor content if possible. Practical first-hand accounts of models in prod eagerly sought.

Foundational Concepts

Screenshot 2023-12-18 at 10 40 27 PM

Pre-Transformer Models

Reinforcement Learning for Language Models

Yoav Goldberg, April 2023.

Why RL?

With the release of the ChatGPT model and followup large language models (LLMs), there was a lot of discussion of the importance of "RLHF training", that is, "reinforcement learning from human feedback". I was puzzled for a while as to why RL (Reinforcement Learning) is better than learning from demonstrations (a.k.a supervised learning) for training language models. Shouldn't learning from demonstrations (or, in language model terminology "instruction fine tuning", learning to immitate human written answers) be sufficient? I came up with a theoretical argument that was somewhat convincing. But I came to realize there is an additional argumment which not only supports the case of RL training, but also requires it, in particular for models like ChatGPT. This additional argument is spelled out in (the first half of) a talk by John Schulman from OpenAI. This post pretty much

@joeddav
joeddav / chatgpt.py
Last active August 5, 2023 14:29
Simple ChatGPT
import openai
class ChatGPT:
""" A very simple wrapper around OpenAI's ChatGPT API. Makes it easy to create custom messages & chat. """
def __init__(self, model="gpt-3.5-turbo", completion_hparams=None):
self.model = model
self.completion_hparams = completion_hparams or {}
self.history = []
self._messages = []
@kesor
kesor / 1-voice-synthesis.js
Last active March 7, 2024 00:19
Making chat OpenAI use TTS
// paste this into your chrome dev console for Speech Synthesis
const originalFetch = window.fetch
const patchedFetch = (...args) => {
if (args[1].method == 'POST' && args[1].body.length > 0 && /moderations$/.test(args[0])) {
const aiResponse = JSON.parse(args[1].body)["input"].split("\n\n\n")
if (aiResponse.length > 1) {
const text = aiResponse.slice(1).join(". ").trim()
console.log(text)
@snejus
snejus / deps
Last active December 24, 2023 11:09
See python package's direct and reverse dependencies, and version changes between revisions in milliseconds
#!/bin/bash
# Read poetry.lock and display information about dependencies:
#
# * Project dependencies
# * Sub-dependencies and reverse dependencies of packages
# * Summary of updates, or change in dependency versions between two revisions of the project
#
# Author: Sarunas Nejus, 2021
# License: MIT
# custom IntelliJ IDEA properties
editor.zero.latency.typing=true
idea.max.intellisense.filesize=3500
idea.cycle.buffer.size=2048
@austospumanto
austospumanto / gist:6857f9bdbc5b3c8fb2c3a1f0d1bdae12
Created April 30, 2021 18:39 — forked from christofluethi/gist:646ae60d797a46a706a5
Convert m4a to mp3 on OS X command line using ffmpeg
brew update
brew link yasm
brew link x264
brew link lame
brew link xvid
brew install ffmpeg
ffmpeg wiki:
https://trac.ffmpeg.org/wiki/Encode/MP3
@progrium
progrium / README.md
Last active April 7, 2024 21:42
Setting up M1 Macs for x86 development with Homebrew

Key Points

  • In general, binaries built just for x86 architecture will automatically be run in x86 mode
  • You can force apps in Rosetta 2 / x86 mode by right-clicking app, click Get Info, check "Open using Rosetta"
  • You can force command-line apps by prefixing with arch -x86_64, for example arch -x86_64 go
  • Running a shell in this mode means you don't have to prefix commands: arch -x86_64 zsh then go or whatever
  • Don't just immediately install Homebrew as usual. It should most likely be installed in x86 mode.

Homebrew

Not all toolchains and libraries properly support M1 arm64 chips just yet. Although