Skip to content

Instantly share code, notes, and snippets.

View knbknb's full-sized avatar
💭
🙅‍♀️💡💤😴🛌🤪🧔

Knut Behrends knbknb

💭
🙅‍♀️💡💤😴🛌🤪🧔
View GitHub Profile

Okay, I need to write a story using only the vowel 'o'. Let me start by brainstorming possible words. Words with 'o' as the only vowel. Hmm. Let's see. First, the characters. Maybe a protagonist named Tom? Wait, no, 'Tom' has 'o' as the vowel. That works. Or maybe 'Bob'? Yes, Bob is good. Let's go with Bob. Now, setting. Maybe a small town? 'Town' is okay. Or a forest? 'Woods' has 'o' and 'o', so that's good.

Plot: Bob needs to solve a problem. Maybe he's looking for something. A lost dog? 'Dog' works. So Bob's dog, maybe named Spot? No, 'Spot' has 'o' as the vowel. Wait, 'Spot' has an 'o' and a 'o'? No, 'S' 'p' 'o' 't'—only 'o' as vowel. So Spot is okay. So Bob's dog Spot is lost. He goes to look for him. Maybe he goes through the woods, meets a fox? 'Fox' is good. The fox helps him. Then they find Spot. But how to structure sentences without other vowels.

Let me list some words. Nouns: Bob, dog, Spot, fox, log, rock, pond, frog, box, sock, clock, shop, top, fog, moss, lot, job, cot, lock, drop, plot, trot

Draziw.Button.Mines
ag.video_solutions.wedotv
ahf.dummynation
ai.socialapps.speakmaster
air.com.beachbumgammon
air.com.freshplanet.games.SongPop2
air.com.gamesys.mobile.slots.jpj
air.com.goodgamestudios.empirefourkingdoms
air.com.kitchenscramble.goo
air.com.lalaplay.rummy45
@rdivyanshu
rdivyanshu / hat.rkt
Last active May 16, 2024 08:15
Hat tiling
#lang racket
(require metapict)
(require metapict/pict)
(struct M-edge (turn) #:transparent)
(struct X+ M-edge () #:transparent)
(struct X- M-edge () #:transparent)
(struct A+ M-edge () #:transparent)
@jthomasmock
jthomasmock / guess_keyword.R
Created September 13, 2023 01:36
Guess the Keyword of the day with R!
library(tidyverse)
library(jsonlite)
library(shiny)
# get_json_data(date)
# score_letters(letters)
# read_keywords() on mac
# split_char(word) into words
# limit_words(words, str_length) to specific length and lower case
# top_words(word, words_in, top_n = 50) - combo of split_char, limit_words
@jthomasmock
jthomasmock / copilot_keyword.R
Created September 13, 2023 01:35
Solving the Keyword game with R, with a little help from RStudio and Copilot!
library(tidyverse)
library(stringr)
library(jsonlite)
# create a function to solve the Keyword game
# this game uses a 6 letter horizontal word at the
# intersection of 6 other words, where a missing letter from each of the vertical words
# accounts for one letter of the mystery 6 letter length horizontal word
# how to play

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

@knbknb
knbknb / ubuntu-custom-setup.sh
Last active March 8, 2023 14:13 — forked from riccardopedrielli/ubuntu-workstation-setup.sh
Ubuntu workstation setup
#!/usr/bin/env bash
set -Eeu
trap 'STATUS=${?}; echo "${0}: Error on line ${LINENO}: ${BASH_COMMAND}"; exit ${STATUS}' ERR
trap 'rm -rf ${tempDir}' EXIT
readonly supportedUbuntuVersion="22.04"
readonly tempDir="/tmp/setup"
readonly devDir="${HOME}/dev"
readonly scriptsDir="${devDir}/scripts"
@georgestagg
georgestagg / mandeldrop.R
Created July 26, 2022 19:03
Mandelbrot set, transformed into a teardrop shape, in R and Rcpp
Rcpp::sourceCpp("mandeldrop.cpp")
xlims=c(-0.65,0.65)
ylims=c(-0.6,2.2)
m <- mandeldrop(xlims[[1]], xlims[[2]], ylims[[1]], ylims[[2]], 1560, 2160, 512)
# Colour palette from https://stackoverflow.com/q/48069990
rainbow=c(rgb(0.47,0.11,0.53),rgb(0.27,0.18,0.73),rgb(0.25,0.39,0.81),rgb(0.30,0.57,0.75),rgb(0.39,0.67,0.60),rgb(0.51,0.73,0.44),rgb(0.67,0.74,0.32),rgb(0.81,0.71,0.26),rgb(0.89,0.60,0.22),rgb(0.89,0.39,0.18),rgb(0.86,0.13,0.13))
cols=c(colorRampPalette(rainbow)(100),rev(colorRampPalette(rainbow)(100)),"black")
@wch
wch / pluck_recursive.R
Created March 10, 2022 04:21
From a tree, recursively pluck all elements with a particular name
# @drob's version from https://twitter.com/drob/status/1501747414780239879
pluck_recursive <- function(lst, name) {
if (is.list(lst)) {
if (!is.null(lst[[name]])) {
return(lst[[name]])
}
return(unname(unlist(purrr::map(lst, pluck_recursive, name))))
}
}
# What's the most natural way to express this code in base R?
library(dplyr, warn.conflicts = FALSE)
mtcars %>%
group_by(cyl) %>%
summarise(mean = mean(disp), n = n())
#> # A tibble: 3 x 3
#> cyl mean n
#> <dbl> <dbl> <int>
#> 1 4 105. 11
#> 2 6 183. 7