Skip to content

Instantly share code, notes, and snippets.

View CoffeeVampir3's full-sized avatar

Z CoffeeVampir3

View GitHub Profile
from langchain.llms.base import LLM
from langchain.callbacks.manager import CallbackManagerForLLMRun
from typing import Any, Dict, Generator, List, Optional
from pydantic import Field, root_validator
from model import ExLlama, ExLlamaCache, ExLlamaConfig
from tokenizer import ExLlamaTokenizer
from generator import ExLlamaGenerator
import os, glob, time, json, sys, logging
class Exllama(LLM):
@CoffeeVampir3
CoffeeVampir3 / clean_json.py
Last active July 8, 2023 21:52
dataset_chonker
import json
import re
import string
import sys
def clean_text(text):
# Strip leading and trailing white space
text = text.strip()
# Replace consecutive white space characters with a single space
@CoffeeVampir3
CoffeeVampir3 / generator.py
Last active June 19, 2023 21:10
exllama healing
import cuda_ext
from model import ExLlama, ExLlamaCache
from lora import ExLlamaLora
import torch
import torch.nn.functional as F
from healing import *
class ExLlamaGenerator:
class Settings:
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@CoffeeVampir3
CoffeeVampir3 / train_lora.ipynb
Last active June 28, 2023 05:12
train lora notebook
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@CoffeeVampir3
CoffeeVampir3 / maximal_context_splitter.py
Last active October 19, 2023 20:04
Maximal context splitting
import json
import argparse
import os
import re
from transformers import AutoTokenizer
from langchain.text_splitter import RecursiveCharacterTextSplitter
def l(tokenizer, txt):
return len(tokenizer.encode(txt))
@CoffeeVampir3
CoffeeVampir3 / batched.py
Created July 18, 2023 00:58
batched sdxl
import torch
from pipe import StableDiffusionXLPipelineNoWatermark
from pipei2i import StableDiffusionXLImg2ImgPipelineNoWatermark
from diffusers import DiffusionPipeline
from PIL import Image
import os
import gc
import pandas as pd
import random, sys
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@CoffeeVampir3
CoffeeVampir3 / merge-investigation.ipynb
Last active July 29, 2023 08:45
Lora Merging Investigation
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@CoffeeVampir3
CoffeeVampir3 / bookthing.ipynb
Created August 4, 2023 13:37
Thing for book thinging of stuff with the thing.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.