Skip to content

Instantly share code, notes, and snippets.

View vlbosch's full-sized avatar

Vincent Bosch vlbosch

  • Poortvliet, Nederland
View GitHub Profile
@N8python
N8python / MORE.py
Last active December 7, 2024 22:01
faster every day
from mlx_lm import load
import mlx.core as mx
from mlx.utils import tree_flatten, tree_map, tree_unflatten
import numpy as np
# Copyright © 2023-2024 Apple Inc.
import contextlib
import copy
import glob
import importlib
@awni
awni / mlx_api_prompt.py
Created August 20, 2024 15:43
Meta Llama 3.1 with MLX LM and the MLX Python API as Context
import os
import mlx.core as mx
from mlx_lm import load, generate
filename = os.path.join(os.path.dirname(mx.__file__), "core/__init__.pyi")
with open(filename, 'r') as fid:
prompt = fid.read()
prompt += "\nHow do you write a self-attention layer using the above API in MLX?"
model, tokenizer = load("mlx-community/meta-Llama-3.1-8B-Instruct-4bit")
@philipturner
philipturner / UnifiedGEMMKernel.swift
Last active October 8, 2024 05:26
Single shader source that supports every hardware architecture, problem size, and precision
//
// main.swift
// UnifiedGEMMKernel
//
// Created by Philip Turner on 5/29/24.
//
import Metal
#if os(macOS)
import IOKit