Skip to content

Instantly share code, notes, and snippets.

@thement
thement / convert.py
Created March 16, 2023 22:18
Unquantize huggingface models and convert them to LLaMa format
import torch
import sys
# TODO: load from params.json
params = { "dim": 4096, "multiple_of": 256, "n_heads": 32, "n_layers": 32, "norm_eps": 1e-06, "vocab_size": -1 }
# TODO: pass as argument
quantized = True
def dict_list(d, prefix=''):
for k, v in d.items():