Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python3
import argparse
import os
import subprocess
def main(model, outbase, outdir):
llamabase = "/workspace/venv/git/llama.cpp"
ggml_version = "v3"
if not os.path.isdir(model):
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
import torch
import os
import argparse
def get_args():
parser = argparse.ArgumentParser()
parser.add_argument("--base_model_name_or_path", type=str)
@RhetTbull
RhetTbull / vision.py
Last active May 27, 2024 20:57
Use Apple's Vision framework from Python to detect text in images
""" Use Apple's Vision Framework via PyObjC to detect text in images
To use:
python3 -m pip install pyobjc-core pyobjc-framework-Quartz pyobjc-framework-Vision wurlitzer
"""
import pathlib
@claymcleod
claymcleod / controller.py
Last active December 15, 2022 21:40
Playstation 4 Controller Python
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# This file presents an interface for interacting with the Playstation 4 Controller
# in Python. Simply plug your PS4 controller into your computer using USB and run this
# script!
#
# NOTE: I assume in this script that the only joystick plugged in is the PS4 controller.
# if this is not the case, you will need to change the class accordingly.
#
@blue-ice
blue-ice / homebrew-opencv2-python
Last active November 16, 2020 01:45
Using Homebrew to install OpenCV2 for Python on Mac
Assuming that you have already installed ```brew``` and that you are logged into a non-root administrator account:
1. ```brew tap homebrew/science```
2. ```brew install opencv```
3. ```sudo su```
4. ```echo "/usr/local/lib/python2.7/site-packages/" > /Library/Python/2.7/site-packages/opencv.pth```
@BobNisco
BobNisco / osx_sleeptimer.py
Last active January 16, 2020 02:40 — forked from samliu/osx_sleeptimer.py
A Python script to turn off your music and optionally put your computer to sleep after a period of time!
#!/usr/bin/env python
import os
import sys
import time
from datetime import datetime, timedelta
def main():
if len(sys.argv) >= 3:
music_service = str(sys.argv[1])
minutes_to_wait = float(sys.argv[2])