#!/usr/bin/env -S uv run --script # # /// script # requires-python = ">=3.12" # dependencies = ["safetensors", "numpy"] # /// import numpy as np from safetensors.numpy import save_file d = np.load("model.npz") W = np.ascontiguousarray(d["rows_int8"]) # (30522, 1024) int8, the released table scale = d["int8_scale"].astype(np.float32) # (30522,) per-row dequantization scale assert W.shape == (30522, 1024) and W.dtype == np.int8 and scale.shape == (30522,) # FastEmbed's static models multiply each token's row by `weights`, which dequantizes it. save_file({"embeddings": W, "weights": scale}, "model.safetensors")