Skip to content

Instantly share code, notes, and snippets.

View swairshah's full-sized avatar

swairshah swairshah

  • mode.ai
  • Palo Alto, CA
View GitHub Profile
@sayakpaul
sayakpaul / inference.md
Last active October 21, 2024 01:38
Not so rigorously validated FP8 training of Flux (dev) DreamBooth LoRA
from diffusers import AutoPipelineForText2Image
import torch
pipeline = AutoPipelineForText2Image.from_pretrained(
    "black-forest-labs/FLUX.1-dev", torch_dtype=torch.bfloat16
).to("cuda")
pipeline.load_lora_weights("sayakpaul/yarn_art_lora_flux", weight_name="pytorch_lora_weights.safetensors")
image = pipeline("a puppy in a pond, yarn art style", guidance_scale=3.5, height=768).images[0]
image.save("yarn.png")
@thomwolf
thomwolf / fast_speech_text_speech.py
Last active October 18, 2024 21:06
speech to text to speech
""" To use: install LLM studio (or Ollama), clone OpenVoice, run this script in the OpenVoice directory
git clone https://github.com/myshell-ai/OpenVoice
cd OpenVoice
git clone https://huggingface.co/myshell-ai/OpenVoice
cp -r OpenVoice/* .
pip install whisper pynput pyaudio
"""
from openai import OpenAI
import time
@danielgross
danielgross / mathpix2gpt.py
Last active October 21, 2024 05:51
mathpix2gpt.py
import requests
import time
import os
import sys
import openai
import tiktoken
from termcolor import colored
openai.api_key = open(os.path.expanduser('~/.openai')).read().strip()
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
using Distributions
using Plots; pyplot()
using ForwardDiff
using LaTeXStrings
λ = 3.0
μ = 2.0
s = 0.8
# α = Exponential(λ) # Measure alpha the starting point
α = Laplace(μ, s + 1.0)
@daveluo
daveluo / cifar10-darknet-gist0509.ipynb
Last active May 13, 2019 16:35
Demo of CPU-only Predictions and Pytorch Model Saving/Loading, 5/9/2018
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@EderSantana
EderSantana / sliding_widget.ipynb
Last active June 18, 2017 18:51
jupyter notebook: slide to change images
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@dimi-tree
dimi-tree / 01-02.py
Last active February 2, 2022 20:41
Udacity: Machine Learning for Trading
# Working with multiple stocks
"""
SPY is used for reference - it's the market
Normalize by the first day's price to plot on "equal footing"
"""
import os
import pandas as pd
import matplotlib.pyplot as plt
@astocko
astocko / tls.py
Created November 9, 2015 15:17
Total Least Squares using PCA
"""Total Least Squares using PCA"""
# Copyright (c) 2015 Alexander Stocko <[email protected]>
# License: BSD 3 Clause
import numpy as np
import sklearn.decomposition
def tls_ratio(x, y):
A = np.stack([x, y]).T
Sorry, this is too big to display.