Skip to content

Instantly share code, notes, and snippets.

@jamiephan
jamiephan / README.md
Last active April 19, 2025 19:22
A script to automatically add ALL items to your account in quixel

Script to add all items from quixel

As quixel is being removed, all items are free to aquire. This script is to automate the process to add items to your account (As of writing, a total of 18874 items)

Note: This script only tested in the latest version of Chrome.

How to use

  1. Copy the script from below (run.js)
  2. Login into https://quixel.com
@sayakpaul
sayakpaul / inference_with_torchao_serialized.py
Last active January 13, 2025 01:51
Shows how to run Flux schnell under 17GBs without bells and whistles. It additionally shows how to serialize the quantized checkpoint and load it back.
import torch
from huggingface_hub import hf_hub_download
from diffusers import FluxTransformer2DModel, DiffusionPipeline
dtype, device = torch.bfloat16, "cuda"
ckpt_id = "black-forest-labs/FLUX.1-schnell"
with torch.device("meta"):
config = FluxTransformer2DModel.load_config(ckpt_id, subfolder="transformer")
model = FluxTransformer2DModel.from_config(config).to(dtype)
@sayakpaul
sayakpaul / run_flux_with_limited_resources.md
Last active February 23, 2025 07:10
This document enlists resources that show how to run Black Forest Lab's Flux with Diffusers under limited resources.
@sayakpaul
sayakpaul / run_flux_under_24gbs.py
Last active April 7, 2025 21:44
This gist shows how to run Flux on a 24GB 4090 card with Diffusers.
from diffusers import FluxPipeline, AutoencoderKL
from diffusers.image_processor import VaeImageProcessor
from transformers import T5EncoderModel, T5TokenizerFast, CLIPTokenizer, CLIPTextModel
import torch
import gc
def flush():
gc.collect()
torch.cuda.empty_cache()
@hamelsmu
hamelsmu / webhook-circleback.py
Created April 25, 2024 04:59
Generate a project proposal automatically from a meeting transcript
from fastapi import Request, HTTPException
from pydantic import BaseModel, BaseModel, HttpUrl
from modal import Secret, App, web_endpoint, Image
from typing import Optional, List
from example import proposal
import os
app = App(name="circleback", image=Image.debian_slim().pip_install("openai", "pydantic", "fastapi"))
class Attendee(BaseModel):
@kevinbird15
kevinbird15 / DiffEdit Implementation.ipynb
Last active December 3, 2022 00:14
diffedit implementation
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@dienhoa
dienhoa / SSD.ipynb
Created August 21, 2022 08:27
SSD Implementation using fastai
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
# Start a SageMaker notebook instance (ml.p3.2xlarge) and open a terminal
# Upload the conda yml from here: https://gist.github.com/eugeneyan/3435e05dd675b9ee2af164214536752d
# Install NVTabular
conda env create -f=SageMaker/nvt_t4r.yml
# Activate conda env
source anaconda3/etc/profile.d/conda.sh
conda activate nvt_t4r
@phpdude
phpdude / clean.py
Created December 10, 2019 16:20
Efficent way to remove docstrings in python source code
import ast
import astor # read more at https://astor.readthedocs.io/en/latest/
parsed = ast.parse(open('source.py').read())
for node in ast.walk(parsed):
# let's work only on functions & classes definitions
if not isinstance(node, (ast.FunctionDef, ast.ClassDef, ast.AsyncFunctionDef)):
continue
@2E0PGS
2E0PGS / linux-usb-file-copy-fix.md
Last active February 20, 2025 20:55
Fix Ubuntu and other Linux slow/hanging file copying via USB.

If your running a x64 bit Ubuntu or other Linux and find USB transfers hang at the end apply this fix:

echo $((16*1024*1024)) > /proc/sys/vm/dirty_background_bytes
echo $((48*1024*1024)) > /proc/sys/vm/dirty_bytes

I suggest you edit your /etc/rc.local file to make this change persistant across reboots.

sudo nano /etc/rc.local