Skip to content

Instantly share code, notes, and snippets.

View carlthome's full-sized avatar
🎼

Carl Thomé carlthome

🎼
View GitHub Profile
@mxkrn
mxkrn / metaphor-research-digest.py
Last active September 12, 2023 14:17
Metaphor Research Digest Slack App
"""
This script uses the Metaphor (https://metaphor.systems) API to fetch the latest research results for a query of choice.
Given the popularity of Slack as a communication channel, it also provides the option to forward this information
to Slack using a web hook URL.
Usage:
1. Set the environment variables METAPHOR_API_KEY and SLACK_URL
2. Create a python>=3.7 environment
3. Install dependencies: `pip install metaphor-python requests`
4. Run: `python metaphor-research-digest.py --days 7 --num-results 10 --publish-to-slack`

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

@rickhull
rickhull / configuration.nix
Last active September 2, 2024 16:17
Prometheus, Grafana, Loki, Promtail on NixOS
# MONITORING: services run on loopback interface
# nginx reverse proxy exposes services to network
# - grafana:3010
# - prometheus:3020
# - loki:3030
# - promtail:3031
# prometheus: port 3020 (8020)
#
services.prometheus = {
@JustinShenk
JustinShenk / idle-shutdown.sh
Last active August 15, 2024 13:17
Google Cloud Platform (GCP) instance idle shutdown
#!/bin/bash
# Add to instance metadata with `gcloud compute instances add-metadata \
# instance-name --metadata-from-file startup-script=idle-shutdown.sh` and reboot
# NOTE: requires `bc`, eg, sudo apt-get install bc
# Modified from https://stackoverflow.com/questions/30556920/how-can-i-automatically-kill-idle-gce-instances-based-on-cpu-usage
threshold=0.1
count=0
wait_minutes=60
while true
@Nicholas-Swift
Nicholas-Swift / astar.py
Last active November 1, 2024 11:04
A* pathfinding algorithm. Please see comments below for a fork of this gist that includes bug fixes!
class Node():
"""A node class for A* Pathfinding"""
def __init__(self, parent=None, position=None):
self.parent = parent
self.position = position
self.g = 0
self.h = 0
@kastnerkyle
kastnerkyle / audio_tools.py
Last active September 12, 2024 11:16
Audio tools for numpy/python. Constant work in progress.
raise ValueError("DEPRECATED/FROZEN - see https://github.com/kastnerkyle/tools for the latest")
# License: BSD 3-clause
# Authors: Kyle Kastner
# Harvest, Cheaptrick, D4C, WORLD routines based on MATLAB code from M. Morise
# http://ml.cs.yamanashi.ac.jp/world/english/
# MGC code based on r9y9 (Ryuichi Yamamoto) MelGeneralizedCepstrums.jl
# Pieces also adapted from SPTK
from __future__ import division
import numpy as np