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
@thomwolf
thomwolf / fast_speech_text_speech.py
Last active July 21, 2024 18:37
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 July 11, 2024 15:11
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 <alex@hoo.la>
# 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.

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns                     on recent CPU
L2 cache reference ........................... 7 ns                     14x L1 cache
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns                     20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs 4X memory