Using local LLMs anywhere (in text editor) - example below with Obsidian
inspired by and adopted from LLM-automator.
Code example with
mixtral
Using local LLMs anywhere (in text editor) - example below with Obsidian
inspired by and adopted from LLM-automator.
Code example with
mixtral
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. |
# 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") |
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 |
# -*- 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 |
<!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"> |
# -- 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 |
#!/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). |