Add variant of flan-t5-xl, especially model.safetensors

#22
by bayang - opened

This repo doesn't contain model.safetensors like the xll or the base version.

Can I do a PR?

Google org

Hey @bayang , you can use the following Space to add a safetensors variant: https://huggingface.co/spaces/safetensors/convert

Google org

I submitted the current model to it and it opened the following PR: https://huggingface.co/google/flan-t5-xl/discussions/24#6565af340ff3292512bcf87d

Google org

I'm merging it, feel free to use the Space above to have conversions of the models you want.

Google org

Great! Closing this issue :)

lysandre changed discussion status to closed

Hey @lysandre , i was wondering if the code I was preparing to convert is the same as you do in that space internally?
import torch

all_weights = {}
for filename in ["pytorch_model-00001-of-00002.bin", "pytorch_model-00002-of-00002.bin"]:
    _model = torch.load(filename, map_location=torch.device('cpu'))
    all_weights = { **all_weights, **_model }

from safetensors import safe_open
from safetensors.torch import save_file

save_file(all_weights, "/tmp/model.safetensors")

If so, how would I create the model.safetensors.index.json file?

Google org

@bayang it's a bit different, it's using transformers' from_pretrained and save_pretrained methods to take care of the sharding

Google org

@lysandre Oh I see, the space has also the code.
thanks.

@lysandre How can I merge both safetensors files, because I'm using this quantization technique from Huggingface Candle? and it loads from one file.

$ cargo run --example tensor-tools --release -- quantize --quantization q6k PATH/TO/T5/model.safetensors /tmp/model.gguf

bayang changed discussion status to open

Sign up or log in to comment