Skip to content

Instantly share code, notes, and snippets.

@VictorTaelin
VictorTaelin / gpt4_abbreviations.md
Last active June 18, 2024 15:03
Notes on the GPT-4 abbreviations tweet

Notes on this tweet.

  • The screenshots were taken on different sessions.

  • The entire sessions are included on the screenshots.

  • I lost the original prompts, so I had to reconstruct them, and still managed to reproduce.

  • The "compressed" version is actually longer! Emojis and abbreviations use more tokens than common words.

@crosstyan
crosstyan / swap_attn.py
Last active July 29, 2023 19:42
swap attn layer for stable diffusion model
# some code is from https://github.com/CCRcmcpe/scal-sdt
from typing import Any, Literal, Optional
from pathlib import Path
import warnings
import torch
import click
DType = Literal["fp16", "fp32", "bf16"]
LayerName = Literal["attn", "ff"]
StateDict = dict[str, Any]
@Miraculix200
Miraculix200 / gist:e0fc7c02e7911d840f3abe3c7cdae6f9
Created October 31, 2022 18:52
Dreambooth on SageMaker Studio Lab (save as .ipynb notebook)
This file has been truncated, but you can view the full file.
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"cellView": "form",
"colab": {
"base_uri": "https://localhost:8080/"
},
@woyin
woyin / autosign.php
Created August 10, 2021 03:22
Auto Sign for Discuz DSU
<?php
header("Content-type:text/html;charset=utf-8");
// 设定cookie和网址
// 通过Chrome 或者Edge 找到对应的Cookie值,找到以saltkey和auth 结尾的Cookie 名称和值,填在这里
$cookie = 'xxxxxxx_saltkey=XXXXXXXX;xxxxxxxx_auth=XXXXXX';
// 获取formhash
$URL = "http://bbs.abc.com/forum.php"; //论坛地址
$str = loadcode($cookie,$URL);
@muink
muink / 3.5lo2balance.md
Last active June 14, 2024 13:28
关于3.5单端和2.5 3.5 4.4 平衡间互相转换的几条定理

关于3.5单端和2.5 3.5 4.4 平衡间互相转换的几条定理

3.5立体声与典型平衡口定义

ddt pht

互转定理

  1. 平衡设备之间可以完全地互相转换,只要接口线序一一对应不出错
@fabtho
fabtho / save_screenshot.py
Last active December 12, 2022 08:07
make full screenshot with selenium in python
#!/usr/bin/python
from selenium import webdriver
from PIL import Image
from cStringIO import StringIO
verbose = 1
browser = webdriver.Firefox()
browser.get('http://stackoverflow.com/questions/37906704/taking-a-whole-page-screenshot-with-selenium-marionette-in-python')
{
"presets": [
{
"Name": "Major",
"Value": "1;3;5;6;8;10;12",
"Group": "Common"
},
{
"Name": "Minor",
"Value": "1;3;4;6;8;9;11",
@samidhtalsania
samidhtalsania / bintree.py
Last active October 28, 2022 14:28
Binary tree in Python
class Node():
def __init__(self,key):
self.key = key
self.left = None
self.right = None
self.parent = None
class Tree():
@bistaumanga
bistaumanga / kMeans.py
Last active December 7, 2020 10:16
KMeans Clustering Implemented in python with numpy
'''Implementation and of K Means Clustering
Requires : python 2.7.x, Numpy 1.7.1+'''
import numpy as np
def kMeans(X, K, maxIters = 10, plot_progress = None):
centroids = X[np.random.choice(np.arange(len(X)), K), :]
for i in range(maxIters):
# Cluster Assignment step
C = np.array([np.argmin([np.dot(x_i-y_k, x_i-y_k) for y_k in centroids]) for x_i in X])