Skip to content

Instantly share code, notes, and snippets.

lewtun /
Last active June 19, 2024 13:48
Fine-tuning Mistral 7B with TRL & DeepSpeed ZeRO-3
# This is a modified version of TRL's `SFTTrainer` example (,
# adapted to run with DeepSpeed ZeRO-3 and Mistral-7B-V1.0. The settings below were run on 1 node of 8 x A100 (80GB) GPUs.
# Usage:
# - Install the latest transformers & accelerate versions: `pip install -U transformers accelerate`
# - Install deepspeed: `pip install deepspeed==0.9.5`
# - Install TRL from main: pip install git+
# - Clone the repo: git clone
# - Copy this Gist into trl/examples/scripts
# - Run from root of trl repo with: accelerate launch --config_file=examples/accelerate_configs/deepspeed_zero3.yaml --gradient_accumulation_steps 8 examples/scripts/
seratch /
Last active March 31, 2024 13:43
Sign in with Slack - the simplest example

You can run this app by following the steps below:

Set up your Slack app

  • Create a new Slack app from
  • Go to OAuth & Permissions
    • Add identity.basic & to User Token Scopes
    • Add OAuth Redirect URL
  • Go to Basic Information
  • Grab the Client ID & Client Secret in the page
qwesda / hash_large_file.html
Last active September 22, 2022 00:52
asmcrypto - example - hash large file
<!DOCTYPE html>
<meta charset="utf-8" />
<title>Hash large File Example</title>
<script src=""></script>
<script type="text/javascript" language="javascript">
function on_hash_done(hash, time_elapsed_seconds) {
document.getElementById('progress').innerText = '';
#!/usr/bin/env sh
# I've adapted this from the following, which was in turn adapted from the link
# below it:
# *
# *
echo "Enable full keyboard access for all controls (e.g. enable Tab in modal dialogs)"
# defaults write NSGlobalDomain AppleKeyboardUIMode -int 3
marianogappa / backpressure.go
Created December 4, 2016 04:53
Example backpressure implementation in Go
This snippet is an example of backpressure implementation in Go.
It doesn't run in Go Playground, because it starts an HTTP Server.
The example starts an HTTP server and sends multiple requests to it. The server starts denying
requests by replying an "X" (i.e. a 502) when its buffered channel reaches capacity.
This is not the same as rate-limiting; you might be interested in
borgar / .block
Last active April 20, 2017 19:38
William Playfair's Price of Wheat
license: gpl-3.0
height: 515
border: no
Vestride /
Last active June 5, 2024 14:38
Encoding video for the web

Encoding Video


Install FFmpeg with homebrew. You'll need to install it with a couple flags for webm and the AAC audio codec.

brew install ffmpeg --with-libvpx --with-libvorbis --with-fdk-aac --with-opus
mbostock / .block
Last active February 9, 2016 01:56
Accelerate, Then Coast
license: gpl-3.0

Stackoverflow to Elasticsearch

This script will load any stackoverflow site from the XML dump (retrievable at via torrent) into Elasticsearch.

To use just call:

python PATH
karmi / .gitignore
Last active December 24, 2015 14:53
Build a virtual machine with Elasticsearch from scratch with Vagrant