Skip to content

Instantly share code, notes, and snippets.

View sugatoray's full-sized avatar
🎯
Focusing

Sugato Ray sugatoray

🎯
Focusing
View GitHub Profile

MLX LM with the OpenAI Python Package

1. Install

Install MLX LM and openai:

pip install mlx-lm openai

MLX LM with the OpenAI Python Package

1. Install

Install MLX LM and openai:

pip install mlx-lm openai

Clone the model

This can take a little while:

# Make sure you have git-lfs installed (https://git-lfs.com)
git lfs install

git clone https://huggingface.co/black-forest-labs/FLUX.1-schnell
@sugatoray
sugatoray / chunking-regex.ts
Created August 15, 2024 12:04 — forked from hanxiao/testRegex.js
Use regex to do chunking by using all semantic cues
// Used in https://jina.ai/tokenizer (Aug. 14th version)
// Define variables for magic numbers
const MAX_HEADING_LENGTH = 6;
const MAX_HEADING_CONTENT_LENGTH = 200;
const MAX_HEADING_UNDERLINE_LENGTH = 200;
const MAX_HTML_HEADING_ATTRIBUTES_LENGTH = 100;
const MAX_LIST_ITEM_LENGTH = 200;
const MAX_NESTED_LIST_ITEMS = 5;
const MAX_LIST_INDENT_SPACES = 7;
const MAX_BLOCKQUOTE_LINE_LENGTH = 200;
@sugatoray
sugatoray / demo-whisper-medusa.ipynb
Created August 6, 2024 05:16
demo-whisper-medusa
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sugatoray
sugatoray / great_tables_co2.py
Created May 1, 2024 04:44 — forked from chalg/great_tables_co2.py
Showcase electricity consumption data for 2023 from ElectricityMaps via Python great_tables
from great_tables import GT, md, html, system_fonts
import pandas as pd
power_cie_prepared_tbl = pd.read_csv("./data/2023_cie_power_cons.csv")
# Create a Great Tables object
ciep_gt_tbl = GT(data=power_cie_prepared_tbl)
# Apply wider color ranges & formatting
gt_tbl = ciep_gt_tbl \
@sugatoray
sugatoray / .gitconfig
Created August 1, 2023 17:56 — forked from johnpolacek/.gitconfig
My current .gitconfig aliases
[alias]
co = checkout
cob = checkout -b
coo = !git fetch && git checkout
br = branch
brd = branch -d
brD = branch -D
merged = branch --merged
st = status
aa = add -A .
@sugatoray
sugatoray / .gitconfig
Created July 31, 2023 22:19 — forked from 0livare/.gitconfig
My git alias list. Running 'git alias' will pretty-print these commands to the terminal.
# Some options that may or may not be applicable to you
[user]
name = Zach Olivare
email = [email protected]
[push]
default = upstream
[core]
autocrlf = input # Force replacing CRLF line endings with LF
ignorecase = false
[merge]
@sugatoray
sugatoray / .gitconfig
Created July 31, 2023 22:19 — forked from 0livare/.gitconfig
My git alias list. Running 'git alias' will pretty-print these commands to the terminal.
# Some options that may or may not be applicable to you
[user]
name = Zach Olivare
email = [email protected]
[push]
default = upstream
[core]
autocrlf = input # Force replacing CRLF line endings with LF
ignorecase = false
[merge]
@sugatoray
sugatoray / howto_extract_and_install_multiple_vscode_extensions.md
Last active June 10, 2022 10:57
Managing VS Code Extensions: Extract and Import + Install

VS Code Extensions Management

The following examples assume that the list of extensions is saved as a file (extensions.txt) inside .vscode folder.

How to install a given VS Code extension from the Marketplace?

code --install-extension <extauthor.extname>