huggingface / huggingface/candle

How to load .pth file weights?

Open
#1,104 8 comments 1 reaction 0 assignees View on GitHub
Dominant language
Rust
Stars
21k
Forks
1.8k
Avg merge
16h 42m
Merged PRs (30d)
25

Description

I've been experimenting with candle and re-implementing ESRGAN in it. I ended up needing to convert a couple .pth files I have into .safetensors format in python in order to load them into the VarBuilder. I saw on the docs you say this supports loading pytorch weights directly though, but there does not seem to be an example on how to do that. I looked into the pickle module included in the library and got as far as being able to read the weights into a pickle format with TensorInfo, but then I got stuck trying to convert those to tensors and get it in a format VarBuilder would accept.

An example on how to either load these weights or convert them to safetensors format in rust would be great, thanks!

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.