Skip to content

Instantly share code, notes, and snippets.

@Mistobaan
Mistobaan / together_async_inference.py
Created April 25, 2024 06:10
Query Together API using Async
from tqdm.auto import tqdm
import asyncio
import aiohttp
import json
import time
import os
import textwrap
TOGETHER_API_TOKEN = os.environ['TOGETHER_API_TOKEN']
@Mistobaan
Mistobaan / large_world_model.ipynb
Last active February 19, 2024 16:34
large_world_model.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Mistobaan
Mistobaan / merge_peft.py
Created February 1, 2024 05:12 — forked from mlabonne/merge_peft.py
Merge base model and peft adapter and push it to HF hub
# Example usage:
# python merge_peft.py --base_model=meta-llama/Llama-2-7b-hf --peft_model=./qlora-out --hub_id=alpaca-qlora
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
import torch
import argparse
def get_args():
@Mistobaan
Mistobaan / langchain_llamacpp_natural_functions.ipynb
Last active March 19, 2024 22:08
langchain_llamacpp_natural_functions.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Mistobaan
Mistobaan / eval-gsm8k-microsoft-phi-2-colab.ipynb
Last active January 28, 2024 01:31
eval-gsm8k-microsoft-phi-2-colab.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Mistobaan
Mistobaan / ngrok_util.py
Last active January 4, 2024 07:56
How to get current ngrok remote url
# from: https://stackoverflow.com/a/54088479/121687
import json
import requests
def get_ngrok_url():
url = "http://localhost:4040/api/tunnels/"
res = requests.get(url)
res_unicode = res.content.decode("utf-8")
res_json = json.loads(res_unicode)
@Mistobaan
Mistobaan / deploy_dolly_v2.ipynb
Created April 29, 2023 18:08 — forked from timesler/deploy_dolly_v2.ipynb
Deploy Dolly v2.0 to SageMaker
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
from graphviz import Digraph
import torch
from torch.autograd import Variable, Function
def iter_graph(root, callback):
queue = [root]
seen = set()
while queue:
fn = queue.pop()
if fn in seen:
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Mistobaan
Mistobaan / aws_mfa_login.py
Created August 11, 2021 23:17
Configure AWS default profile to use the MFA token enabled credentials
#!/bin/env python
import sys
import os
import shlex
import subprocess
import json
import configparser
import argparse