This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { formatPromptLines, polymer, Step } from "@thesephist/polymer"; | |
import { z } from "zod"; | |
import { zodToJsonSchema } from "zod-to-json-schema"; | |
import { partition, PartitionBatch, unpartition } from "./partition"; | |
import { ChatMessage, isAssistantMessage } from "./types"; | |
export function mergeConsecutiveSpeakerMessages<T extends ChatMessage>( | |
messages: T[] | |
): T[] { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Implementation of a naïve retrieval-based question answering LLM program. | |
*/ | |
import { | |
Document, | |
formatPromptLines, | |
getCompletionImpl, | |
loggers, | |
polymer, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
anysphere.pyright | |
apollographql.vscode-apollo | |
bradlc.vscode-tailwindcss | |
dbaeumer.vscode-eslint | |
denoland.vscode-deno | |
eamodio.gitlens | |
esbenp.prettier-vscode | |
github.vscode-pull-request-github | |
ms-azuretools.vscode-docker | |
ms-python.black-formatter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import torch | |
from diffusers import FluxPipeline, AutoencoderKL | |
from diffusers.image_processor import VaeImageProcessor | |
from transformers import T5EncoderModel, T5TokenizerFast, CLIPTokenizer, CLIPTextModel | |
ckpt_id = "black-forest-labs/FLUX.1-dev" | |
revision = "refs/pr/1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(()=>{let a=document.querySelectorAll('.bigmarker-cg-agenda-card-talk-name');for(const e of a)Object.assign(e.style,{overflow:'initial',display:'initial'})})() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { cascade } from "../src/cascade.ts"; | |
export const summarize = cascade | |
.chatCompletion("summarize", { | |
model: "gpt-3.5-turbo", | |
renderPrompt: (context: { title: string; content: string }) => [ | |
{ | |
type: "user", | |
content: [ | |
`Write a one sentence summary about ${context.title}.\n\n${context.content}.`, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; pull-all | |
; | |
; Run "git pull" en masse on all git repositories with a default remote under a | |
; specific directory. | |
(defn indent (s bit) | |
(-> s | |
(split '\n') | |
(map (fn (line) | |
(if (empty? line) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import torch | |
import torch.nn as nn | |
import torch.nn.functional as F | |
from transformers import GPT2Tokenizer, GPT2LMHeadModel | |
ppl_model_name = 'gpt2-xl' if device == 'cuda' else 'gpt2' | |
ppl_tokenizer = GPT2Tokenizer.from_pretrained(ppl_model_name) | |
load_opts = { | |
'device_map': 'auto', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Code to measure selection rects | |
// NOTE: this isn't actually JS... it's Oak. But I think the code is readable if you know JS :/ | |
// NOTE: I *think* this event listener only works when attached to `document`. | |
with document.addEventListener('selectionchange') fn handleSelectionChange { | |
if active := document.activeElement { | |
? -> ? | |
_ -> if active.classList.contains('textarea-itself') { | |
false -> ? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import os | |
import json | |
from tqdm import tqdm | |
from transformers import GPT2TokenizerFast | |
os.environ['TOKENIZERS_PARALLELISM'] = 'false' | |
FILENAME = './thesephist.jsonl' |
NewerOlder