tortoise.cpp icon indicating copy to clipboard operation
tortoise.cpp copied to clipboard

Converting .pth files

Open dridri opened this issue 1 year ago • 5 comments

Hello, I found a fine-tuned model to handle French : https://huggingface.co/Snowad/French-Tortoise , but the files are in Torch format. Is there any way to convert it to ggml's format ?

dridri avatar Aug 09 '24 16:08 dridri

Yeah I'll publish those scripts in the next few days. Let me know if you decide to publish the converted files for the french model and I can link to them in the readme.

balisujohn avatar Aug 10 '24 03:08 balisujohn

I'm also going to try converting it myself out of curiosity.

balisujohn avatar Aug 10 '24 03:08 balisujohn

I'd be keen to try the result, as a French speaker

baileyheading avatar Aug 10 '24 03:08 baileyheading

hi @balisujohn can you provide script to convert tortoise to ggml format, thank you

tuanh123789 avatar Sep 17 '24 08:09 tuanh123789

hi @balisujohn can you provide script to convert tortoise to ggml format, thank you

`import torch import numpy as np

voice = "your_voice.pth" # Replace with your actual file path

pth_file = torch.load(voice, map_location=torch.device('cpu'))

tensor_to_convert = pth_file[0] numpy_array = tensor_to_convert.numpy()

file_path = voice.replace('.pth', '.bin')

Save NumPy array as binary file

numpy_array.tofile(file_path)

exit()`

eloop001 avatar Apr 25 '25 14:04 eloop001