Skip to content

Instantly share code, notes, and snippets.

@secemp9
secemp9 / poormano1.py
Created January 22, 2025 10:03 — forked from vgel/r1.py
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
defo = ["\nWait, let's look at this from a system thinking approach:", "\nHmm let's look at this from a step by step approach:"]
# ~ defo = ["\nWait, but", "\nHmm", "\nSo", "\nActually"]
parser = argparse.ArgumentParser()
parser.add_argument("question", type=str)