how to evaluate use model-00001-of-00002.safetensors and model-00002-of-00002.safetensors

#36
by andyweiqiu - opened

Now I have finetune large-v3 and the resulting model is model-00001-of-00002.safetensors and model-00002-of-00002.safetensors. How can I use these two models for evaluation?

Hey @andyweiqiu - these are the sharded weights split by the .save_pretrained method. To use them for inference, simply follow the code snippets in the README, replacing model_id with the repo id or path to your save checkpoint: https://huggingface.co/openai/whisper-large-v3#usage

E.g. if I trained a model and saved it under sanchit-gandhi/whisper-large-v3-hi, I would set:

model_id = "sanchit-gandhi/whisper-large-v3-hi"

And keep the rest of the code example un-changed.

This is called speaker diarizatiom.
There are many repos on github for thid

Hey @andyweiqiu - these are the sharded weights split by the .save_pretrained method. To use them for inference, simply follow the code snippets in the README, replacing model_id with the repo id or path to your save checkpoint: https://huggingface.co/openai/whisper-large-v3#usage

E.g. if I trained a model and saved it under sanchit-gandhi/whisper-large-v3-hi, I would set:

model_id = "sanchit-gandhi/whisper-large-v3-hi"

And keep the rest of the code example un-changed.

Thank you for your reply. I also want to know how to generate the pytorch_model.bin model file after I upload the local file(eg, model-00001-of-00002.safetensors and model-00002-of-00002.safetensors.) , or will it be generated automatically after uploading?

Hey @andyweiqiu - may I ask why you need the pytorch_model.bin format? Note that this weight format is inherently unsafe, as explained: https://huggingface.co/blog/safetensors-security-audit#why-create-something-new

Therefore, it is recommended to use weight sharding and safetensors serialisation to save PyTorch model weights: https://huggingface.co/docs/transformers/v4.35.2/en/main_classes/model#transformers.PreTrainedModel.save_pretrained.max_shard_size

These weights are entirely compatible with from_pretrained, so there's no need to change any of your code to accommodate for them!

You can use the same code-snippet as in: https://huggingface.co/openai/whisper-large-v3#usage

Just replace the model_id with the path (or repo id) of your model.

Hey @andyweiqiu - may I ask why you need the pytorch_model.bin format? Note that this weight format is inherently unsafe, as explained: https://huggingface.co/blog/safetensors-security-audit#why-create-something-new

Therefore, it is recommended to use weight sharding and safetensors serialisation to save PyTorch model weights: https://huggingface.co/docs/transformers/v4.35.2/en/main_classes/model#transformers.PreTrainedModel.save_pretrained.max_shard_size

These weights are entirely compatible with from_pretrained, so there's no need to change any of your code to accommodate for them!

You can use the same code-snippet as in: https://huggingface.co/openai/whisper-large-v3#usage

Just replace the model_id with the path (or repo id) of your model.

Ok, thank you. I've got it

Sign up or log in to comment