Skip to content

Instantly share code, notes, and snippets.

View rajivmehtaflex's full-sized avatar
🚀
smile

Rajiv Mehta rajivmehtaflex

🚀
smile
  • Bacancy Technology
  • Ahmedabad
View GitHub Profile
@rajivmehtaflex
rajivmehtaflex / .args
Created May 28, 2024 05:05
LLM Execution server
--model
/workspace/codesandbox-template-blank/llamafile/AutoCoder_S_6.gguf
--server
--host
0.0.0.0
-ngl
100
...
@rajivmehtaflex
rajivmehtaflex / hf_convert_gguf.txt
Last active May 27, 2024 14:03
huggingface to gguf conversion.
Converting HuggingFace Models to GGUF/GGML
Downloading a HuggingFace model
Running llama.cpp convert.py on the HuggingFace model
(Optionally) Uploading the model back to HuggingFace
Downloading a HuggingFace model
There are various ways to download models, but in my experience the huggingface_hub library has been the most reliable. The git clone method occasionally results in OOM errors for large models.
Install the huggingface_hub library:
pip install huggingface_hub
@rajivmehtaflex
rajivmehtaflex / ollama_ngrok_cloudflare.txt
Created May 23, 2024 16:53
How to use cloudeflare with ollama
#https://tcude.net/creating-cloudflare-tunnels-on-ubuntu/
#https://github.com/ollama/ollama/blob/main/docs/faq.md#how-can-i-use-ollama-with-ngrok
#------------------------------------
wget -q https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64.deb
dpkg -i cloudflared-linux-amd64.deb
cloudflared tunnel --url http://localhost:11434 --http-host-header="localhost:11434"
@rajivmehtaflex
rajivmehtaflex / mongos.txt
Last active May 28, 2024 11:10
Common mongo related Tasks list
Running a MongoDB container with data export
This script demonstrates how to set up and use a MongoDB container to export data.
Pull the mongo image:
docker pull mongo
docker volume create mymongodata
Activate docker Container
docker container run -d --name some-mongo -e MONGO_INITDB_ROOT_USERNAME=mongoadmin -e MONGO_INITDB_ROOT_PASSWORD=mongopasswd -v mymongodata:/data/db -p 27017:27017 mongo
@rajivmehtaflex
rajivmehtaflex / mysql_colab.txt
Last active May 20, 2024 13:01
using mysql server in colab.
apt install mysql-server
service mysql start
mysql -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH 'mysql_native_password' BY 'root';FLUSH PRIVILEGES;"
#username/password:root/root
mysql -u root -p
@rajivmehtaflex
rajivmehtaflex / conda+poetry+crewai.txt
Last active May 11, 2024 04:09
conda+poetry+crewai
curl https://gist.githubusercontent.com/rajivmehtaflex/a1e6de2355e7a16bcd9f38f43a58794b/raw/0636ecab2e4f83c441dbc1b55b562850c3e66859/conda_install.sh | sh
conda config --set auto_activate_base false
conda create --name crewexp python=3.10 -y
conda activate crewexp
pip install poetry
cd gdata/
@rajivmehtaflex
rajivmehtaflex / mistralrs.txt
Last active May 10, 2024 15:34
LLM on Fire
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source $HOME/.cargo/env
cargo --version
sudo apt install libssl-dev
sudo apt install pkg-config
mkdir ~/.cache/huggingface
touch ~/.cache/huggingface/token
echo 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 > ~/.cache/huggingface/token
git clone https://github.com/EricLBuehler/mistral.rs.git
cd mistral.rs
@rajivmehtaflex
rajivmehtaflex / upload_download_to_huggingface.txt
Created May 6, 2024 16:22
Download Split and upload to huggingface repo.
#——Install Package———
pip install -U "huggingface_hub[cli]"
huggingface-cli login
HF_HUB_ENABLE_HF_TRANSFER=1
#———Download Package———
huggingface-cli download QuantFactory/Meta-Llama-3-120B-Instruct-GGUF --local-dir . --local-dir-use-symlinks False --include='*Q4_K*gguf'
#————Merge it————————
@rajivmehtaflex
rajivmehtaflex / concurrent_task_executor.py
Created March 11, 2024 03:16 — forked from bhimrazy/concurrent_task_executor.py
This Python code defines a function concurrent_task_executor that allows executing tasks concurrently on a list of data objects using ThreadPoolExecutor from the concurrent.futures module. It includes a progress bar using tqdm to track the completion of tasks. The function is useful for processing data in parallel, improving efficiency when deal…
import concurrent.futures
from typing import Any, Callable, List
from tqdm import tqdm
def concurrent_task_executor(task: Callable[[Any], None], data_list: List[Any], max_workers: int = 32, description: str = None) -> None:
"""
Execute tasks concurrently on a list of data objects using ThreadPoolExecutor.
Args:
task (Callable): The function to apply to each data object.
@rajivmehtaflex
rajivmehtaflex / install_terraform.txt
Created February 17, 2024 15:31
Install terraform
# How to install terraform
brew tap hashicorp/tap
brew install hashicorp/tap/terraform
terraform -help
terraform --version