Skip to content

Instantly share code, notes, and snippets.

@f0ster
f0ster / .tmux.conf
Last active May 12, 2024 01:22
modern osx tmux conf
# ~/.tmux.conf
# General settings
set -g default-terminal "screen-256color" # Use 256-color terminal
set -g history-limit 5000 # Increase scrollback buffer size
set -g base-index 0 # Start window indexes at 0
set -g mouse on # Enable mouse control (pane selection, resizing, scrolling)
# Restore original prefix key
set-option -g prefix C-b # Set prefix to Ctrl-b
@f0ster
f0ster / inspect_git_repos.py
Last active May 11, 2024 18:46
Summarize git repositories
# script to provide a summary of the repositories by only listing each one's name
# along with its status (public, public with changes, or private)
import os
import subprocess
import json
from concurrent.futures import ThreadPoolExecutor, as_completed
def execute_command(command, cwd):
"""Executes a shell command in a specified directory and returns the output."""
@f0ster
f0ster / mixtral_demo.py
Created April 28, 2024 15:30
Running mistralai mixtral locally
import time
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
def load_model_and_tokenizer(model_id):
"""
Load the tokenizer and model based on the specified model ID.
Model is set to use float16 for computation to reduce memory usage and improve performance.
"""
tokenizer = AutoTokenizer.from_pretrained(model_id)
@f0ster
f0ster / accelerate_presharder.py
Created April 28, 2024 14:08
CLI for sharding and publishing models to huggingface
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
from accelerate import Accelerator
import os
import argparse
def main():
# Parse command line arguments
args = parse_args()
@f0ster
f0ster / big_sharder.py
Created April 28, 2024 04:28
Shard Large LLM models
import os
import json
import sys
import torch
import glob
def load_parameters(directory):
""" Load model parameters from a JSON file. """
with open(os.path.join(directory, 'params.json'), 'r') as file:
return json.load(file)
@f0ster
f0ster / finetune_dance_diffusion.ipynb
Created February 19, 2024 01:44
Finetune_Dance_Diffusion.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@f0ster
f0ster / basic-llm-call.json
Last active February 15, 2024 20:32
comfyUI-llama basic LLM worfklow
{
"last_node_id": 3,
"last_link_id": 2,
"nodes": [
{
"id": 2,
"type": "Call LLM Basic",
"pos": [
42,
190
@f0ster
f0ster / comfyui_colab.ipynb
Created January 16, 2024 15:44
comfyui_colab.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@f0ster
f0ster / comfyui_colab.ipynb
Created January 16, 2024 00:47
comfyui_colab.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@f0ster
f0ster / main.py
Created August 17, 2020 14:40
quantconnect wheel strategy example
# QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
# Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
#
# 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,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.