Skip to content

Instantly share code, notes, and snippets.

View iamaziz's full-sized avatar
🎲

Aziz Alto iamaziz

🎲
View GitHub Profile

Using local LLMs anywhere (in text editor) - example below with Obsidian

inspired by and adopted from LLM-automator.

Code example with mixtral

image
automator-llm-code.mp4
@iamaziz
iamaziz / list_local_ollama_models.py
Created January 14, 2024 07:03
List all Ollama model names installed on the local machine.
import re
import subprocess
def _parse_names(data: str) -> list[str]:
"""
Parses names from a multi-line string where each line contains a name and other details.
Parameters:
data (str): A multi-line string containing names and other details.
@iamaziz
iamaziz / trying_crewai-arabic-llm.py
Created January 13, 2024 02:01
Trying out Agents/Tools with Arabic LLMs
# basedk on: https://github.com/joaomdmoura/crewAI#getting-started
from crewai import Agent, Task, Crew
from langchain_community.llms import Ollama
from langchain_community.tools import DuckDuckGoSearchRun
# -- model
# ollama_llm = Ollama(model="arabic_deepseek-llm")
# ollama_llm = Ollama(model="arabic_notux")
ollama_llm = Ollama(model="arabic_mixtral")
@iamaziz
iamaziz / Jais-LLM-GettingStarted.ipynb
Created December 30, 2023 17:16
Running Jais LLM on M3 Max chip with 64GB - for some reason it's very slow and too big for a 13b model
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@iamaziz
iamaziz / pytorch_device.py
Created December 30, 2023 06:57
Enable MacOS M-series chip for PyTorch
import torch
# Check if CUDA is available, else check for MPS, otherwise default to CPU
if torch.cuda.is_available():
device = torch.device("cuda") # GPU
elif torch.backends.mps.is_available():
device = torch.device("mps") # MacOS M-series chip
else:
device = torch.device("cpu") # CPU
@iamaziz
iamaziz / entropy_gain.py
Last active November 14, 2023 02:41
Calculate Entropy and Information Gain for Decision Tree Learning
# -*- coding: utf-8 -*-
# calculating the Entropy and Information Gain for: Learning with Trees
# by: Aziz Alto
# see Information Gain:
# http://www.autonlab.org/tutorials/infogain.html
from __future__ import division
@iamaziz
iamaziz / weather.html
Last active December 3, 2022 12:11
Open Weather Map API.
<!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery-3.1.1.js"></script>
<title>Weather API</title>
<!-- to be in a script.js -->
<script type="text/javascript">
@iamaziz
iamaziz / read_csv_files_in_tar_gz_from_s3_bucket.py
Last active November 22, 2022 14:45
Read csv files from tar.gz in S3 into pandas dataframes without untar or download (using with S3FS, tarfile, io, and pandas)
# -- read csv files from tar.gz in S3 with S3FS and tarfile (https://s3fs.readthedocs.io/en/latest/)
bucket = 'mybucket'
key = 'mycompressed_csv_files.tar.gz'
import s3fs
import tarfile
import io
import pandas as pd
@iamaziz
iamaziz / cipynb.py
Created February 16, 2015 01:01
Convert all ipython notebook(s) in a given directory into the selected format and place output in a separate folder. Using: ipython nbconvert and find command (Unix-like OS).
#!/usr/bin/env python
__author__ = 'Aziz'
"""
Convert all ipython notebook(s) in a given directory into the selected format and place output in a separate folder.
usages: python cipynb.py `directory` [-to FORMAT]
Using: ipython nbconvert and find command (Unix-like OS).
@iamaziz
iamaziz / videocolorizercolab.ipynb
Last active April 4, 2022 03:57
VideoColorizerColab.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.