Skip to content

Instantly share code, notes, and snippets.

View automata's full-sized avatar

Vilson Vieira automata

View GitHub Profile
@automata
automata / install_mlir_tutorial.sh
Created January 18, 2024 20:57
Install MLIR tutorial on Mac
brew install cmake cache ninja
git clone https://github.com/llvm/llvm-project.git
mkdir llvm-project/build
cd llvm-project/build
cmake -G Ninja ../llvm \
-DLLVM_ENABLE_PROJECTS=mlir \
-DLLVM_BUILD_EXAMPLES=ON \
-DLLVM_TARGETS_TO_BUILD="Native;ARM;X86" \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_ENABLE_ASSERTIONS=ON \
@automata
automata / run.py
Last active November 29, 2023 19:50
Running finetuned Mistral 7B on MacBook Air M2 (~7 tok/sec)
# Instead of using llama.cpp directly, interface it through llama-cpp-python.
#
# Run:
# python3 -m venv venv
# source venv/bin/activate
# CMAKE_ARGS="-DLLAMA_METAL=on" FORCE_CMAKE=1 pip install llama-cpp-python
#
from llama_cpp import Llama
if __name__ == "__main__":
@automata
automata / Dockerfile
Created September 7, 2023 17:58
Mojo Docker
FROM ubuntu:22.04
# Install initial dependencies
RUN apt-get update && apt-get install -y curl gpg
# Install modular
RUN apt-get install -y apt-transport-https && \
keyring_location=/usr/share/keyrings/modular-installer-archive-keyring.gpg && \
curl -1sLf 'https://dl.modular.com/bBNWiLZX5igwHXeu/installer/gpg.0E4925737A3895AD.key' | gpg --dearmor >> ${keyring_location} && \
curl -1sLf 'https://dl.modular.com/bBNWiLZX5igwHXeu/installer/config.deb.txt?distro=debian&codename=wheezy' > /etc/apt/sources.list.d/modular-installer.list && \
from random import random_float64
from math import tanh
@value
@register_passable("trivial")
struct Value:
var r: Pointer[Int]
var l: Pointer[Int]
var data: Float64
var grad: Float64
@automata
automata / launch.json
Created October 23, 2022 15:20
Launch config for Unity Debugger
{
"version": "0.2.0",
"configurations": [
{
"name": "Unity Editor",
"type": "unity",
"request": "launch"
},
{
"name": "OSX Player",
@automata
automata / quick-tmux-guide.md
Last active April 24, 2021 12:12
Recipe to configure a sweet tmux

Quick and dirty tmux manual ;-)

Install tmux:

sudo apt install tmux

Copy the tmux.conf file bellow to your home:

cp tmux.conf ~/.tmux.conf
@automata
automata / rising.py
Created June 5, 2020 20:22
Code poem published to http://code-poems.com/ at 2012
# Three.py ~ Rising
from time import sleep
from random import random
mom = open(__file__).read()
while True:
child = open(str(random()) + '.py', 'w')
child.write(mom)
@automata
automata / README.md
Created February 3, 2019 21:48
SCRIPT-8
@automata
automata / README.md
Created February 3, 2019 21:35
SCRIPT-8
@automata
automata / INSTALL.md
Last active November 20, 2018 17:56
Install Tensorflow 1.12 (CUDA 9.0 + cuDNN) on Ubuntu 16.04 (NVIDIA GTX1060)

Install NVIDIA drivers (they were already installed, but it should be as simple as):

sudo apt-get install nvidia-384 nvidia-modprobe

Install CUDA:

Get URL from https://developer.nvidia.com/cuda-downloads
mkdir ~/nvidia-install ; cd ~/nvidia-install
wget -c https://developer.nvidia.com/compute/cuda/9.0/Prod/local_installers/cuda_9.0.176_384.81_linux-run

chmod +x cuda_9.0.176_384.81_linux-run