Skip to content

Instantly share code, notes, and snippets.

# %%
import torch
from transformers import AutoModelForCausalLM, BitsAndBytesConfig
# %%
import bitsandbytes as bnb # type: ignore
def dump_4bit_weight(m: bnb.nn.modules.Linear4bit, path: str):
assert isinstance(m, bnb.nn.modules.Linear4bit), "Only Linear4bit is supported"
obj = {
@sekstini
sekstini / weightcomp.ipynb
Created July 19, 2023 21:58
LLaMA-2 7b weight comparison between original (bf16) and huggingface (fp16)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.