Skip to content

Instantly share code, notes, and snippets.

View alonsosilvaallende's full-sized avatar

Alonso Silva alonsosilvaallende

View GitHub Profile
@jbwhit
jbwhit / example-ruff-formatting.ipynb
Last active May 4, 2025 00:37
Steps to use `ruff` in JupyterLab with the `jupyterlab_code_formatter` plugin.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sientifiko
sientifiko / guia_desigualdad1.R
Last active December 19, 2023 08:53
Script para la nota 1 sobre guía de desigualdad en medium
library(tidyverse)
theme_set(theme_bw(base_size = 21))
options(scipen = 999)
dat <- read.csv("dataregionesChile.csv")
# filtrar el año 2020
y2020 <- dat %>% filter(year == 2020)
# generar histograma
import numpy as np
import openai
import scipy.special
import tiktoken
def get_top_chat_logprobs(
model: str,
messages: list[dict[str, str]],
@balouf
balouf / ttt_llm.ipynb
Last active August 8, 2024 14:41
TTT - IPywidgets and LLMs
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@vgel
vgel / r1.py
Last active June 1, 2025 08:44
script to run deepseek-r1 with a min-thinking-tokens parameter, replacing </think> with a random continuation string to extend the model's chain of thought
import argparse
import random
import sys
from transformers import AutoModelForCausalLM, AutoTokenizer, DynamicCache
import torch
parser = argparse.ArgumentParser()
parser.add_argument("question", type=str)
parser.add_argument(
@willccbb
willccbb / grpo_demo.py
Last active July 18, 2025 11:36
GRPO Llama-1B
# train_grpo.py
#
# See https://github.com/willccbb/verifiers for ongoing developments
#
"""
citation:
@misc{brown2025grpodemo,
title={Granular Format Rewards for Eliciting Mathematical Reasoning Capabilities in Small Language Models},
author={Brown, William},