Skip to content

Instantly share code, notes, and snippets.

View muellerzr's full-sized avatar

Zach Mueller muellerzr

View GitHub Profile
@muellerzr
muellerzr / script.py
Created August 28, 2025 00:47
mlx issue part 2
# Copyright © 2024 Apple Inc.
"""
Run with:
```
OMPI_MCA_mpi_abort_print_stack=1 mlx.launch --hostfile hosts.json --backend mpi --mpi-arg "--mca btl_tcp_if_exclude lo0,169.254.0.0/16,fe80::/10 --mca mpi_show_mca_params all --mca coll_base_verbose 100 --mca btl_base_verbose 100" script.py
```
Make sure you can run MLX over MPI on two hosts. For more information see the
[balthasar.local:04124] btl:tcp: would block, so allowing background progress
[balthasar.local:04124] btl:tcp: now connected to 192.168.68.53, process [[49579,1],1]
[balthasar.local:04124] btl:tcp: connect() to 192.168.68.53:1024 completed (complete_connect), sending connect ACK
[melchior.local:01946] btl:tcp: now connected to 192.168.68.80, process [[49579,1],0]
[melchior.local:01946] btl: tcp: attempting to connect() to [[49579,1],0] address fdcd:ee7b:759e:1744:414:41e7:3d97:1761 on port 1024
[melchior.local:01946] btl:tcp: would block, so allowing background progress
[melchior.local:01946] btl:tcp: connect() to fdcd:ee7b:759e:1744:414:41e7:3d97:1761:1024 completed (complete_connect), sending connect ACK
[balthasar.local:04124] btl:tcp: now connected to fdcd:ee7b:759e:1744:f700:ca71:db72:f19a, process [[49579,1],1]
[melchior:01946] [0] func:0 libopen-pal.80.dylib 0x000000011a4c776c opal_backtrace_buffer + 56
[melchior:01946] [1] func:1 libmpi.40.dylib 0x000000011a69222
(mlx-stuff) balthasar:mlx_stuff muellerzr$ mlx.launch --hostfile hosts.json kimi_pipeline.py
Traceback (most recent call last):
File "/Users/muellerzr/mlx_stuff/kimi_pipeline.py", line 82, in <module>
model, tokenizer = shard_and_load(model_path)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/muellerzr/mlx_stuff/kimi_pipeline.py", line 56, in shard_and_load
tokenizer = load_tokenizer(
^^^^^^^^^^^^^^^
File "/Users/muellerzr/mlx_stuff/.venv/lib/python3.11/site-packages/mlx_lm/tokenizer_utils.py", line 453, in load_tokenizer
AutoTokenizer.from_pretrained(model_path, **tokenizer_config_extra),
https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts
https://raw.githubusercontent.com/PolishFiltersTeam/KADhosts/master/KADhosts.txt
https://raw.githubusercontent.com/FadeMind/hosts.extras/master/add.Spam/hosts
https://v.firebog.net/hosts/static/w3kbl.txt
https://adaway.org/hosts.txt
https://v.firebog.net/hosts/AdguardDNS.txt
https://v.firebog.net/hosts/Admiral.txt
https://raw.githubusercontent.com/anudeepND/blacklist/master/adservers.txt
https://v.firebog.net/hosts/Easylist.txt
https://pgl.yoyo.org/adservers/serverlist.php?hostformat=hosts&showintro=0&mimetype=plaintext
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@muellerzr
muellerzr / pyproject.toml
Created June 7, 2025 08:53
pyproject template
[project]
name = "my_project"
version = "0.1.0"
description = "A simple Python project"
authors = [
{ name = "Your Name", email = "[email protected]" }
]
readme = "README.md"
license = { text = "MIT" }
requires-python = ">=3.8"
import torch
from torch.utils.data import DataLoader
from transformers import AutoTokenizer, AutoModelForCausalLM, Trainer, TrainingArguments, DataCollatorForLanguageModeling
from datasets import load_from_disk
import torch.nn.functional as F
from torch.nn import CrossEntropyLoss
import numpy as np
import logging
import time
from datetime import datetime
@muellerzr
muellerzr / journal.py
Last active May 6, 2025 13:58
Quick journal entry maker in Python
import json
import os
from datetime import datetime
import argparse
from typing import Dict, List, Optional
"""
Quick Journal is a simple CLI journal that allows you to write, search, and export journal entries.
Specialized for ML experiment tracking with predefined fields.
import torch.nn as nn
from datasets import load_dataset
from transformers import (
AutoModelForCausalLM,
AutoTokenizer,
DataCollatorForLanguageModeling,
Trainer,
TrainingArguments,
set_seed,
)
# Copyright 2024 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,