Skip to content

Instantly share code, notes, and snippets.

{# Temporary MiniMax-M3 override.
Keep MiniMax-M2's PEG-compatible tool-call wrapper, but use M3 thinking tags. #}
{%- set toolcall_begin_token = '<minimax:tool_call>' -%}
{%- set toolcall_end_token = '</minimax:tool_call>' -%}
{%- set think_begin_token = '<mm:think>' -%}
{%- set think_end_token = '</mm:think>' -%}
{#- Tool Rendering Functions ============================================== -#}
{%- macro render_tool_namespace(namespace_name, tool_list) -%}
{%- for tool in tool_list -%}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Sentdex
Sentdex / multi_image_stablediff_video.py
Created September 16, 2022 01:39
example for making stable diffusion video w/ interpolation
from stable_diffusion_videos.stable_diffusion_walk import walk
prompt_n_seed = {
"1965 Porsche 911": 743,
"1975 Porsche 911": 140,
"1985 Porsche 911": 40,
"1995 Porsche 911": 560,
"2005 Porsche 911 directly facing camera": 996,
"2015 Porsche 911": 283,
"2020 Porsche 911": 116,
@Sentdex
Sentdex / imagery_create.py
Created September 16, 2022 01:38
Creating images with Stable Diffusion to find a good seed to go with prompt
import torch
from diffusers import StableDiffusionPipeline
from torch import autocast
import random
import matplotlib.pyplot as plt
import os
prompts = [
"1965 Porsche 911",
#https://cs231n.github.io/neural-networks-case-study/
def spiral_data(points, classes):
X = np.zeros((points*classes, 2))
y = np.zeros(points*classes, dtype='uint8')
for class_number in range(classes):
ix = range(points*class_number, points*(class_number+1))
r = np.linspace(0.0, 1, points) # radius
t = np.linspace(class_number*4, (class_number+1)*4, points) + np.random.randn(points)*0.2
X[ix] = np.c_[r*np.sin(t*2.5), r*np.cos(t*2.5)]
y[ix] = class_number
from pylsl import StreamInlet, resolve_stream
import numpy as np
import time
import matplotlib.pyplot as plt
from matplotlib import style
from collections import deque
last_print = time.time()
fps_counter = deque(maxlen=150)
import random
hm_samples = 300000
max_val = 100000
options = ["add", "sub", "mul", "div"]
def generate_pair(action):
x = random.randrange(1, max_val)
y = random.randrange(1, max_val)
from collections import Counter
files = ['train.to','train.from']
for name in files:
words = []
save_name = "vocab.{}".format(name.split('.')[1])
print(save_name)
with open(name, 'r') as f:
data = f.read().split('\n')