transformers icon indicating copy to clipboard operation
transformers copied to clipboard

Convert ckpt from TFTrainer to huggingface format.

Open kiyoungkim1 opened this issue 5 years ago • 2 comments

I trained models with Trainer(pytorch) and TfTrainer(tensorflow), repectively. With Trainer, everything is ok. Saved models are directly applicable to huggingface pipeline (eg, AutoModel('model_name')).

But with save models from TFTrainer (ckpt format), I can not do that with AutoModel and TFAutoModel . I can restart the training, so files do not have a problem. I guess the problem is ckpt file all contains weight and other parameters related to optimizer.

How can I transform my ckpt file to huggingface-applicable format like tf_model.h5 or convert to pytorch?

@jplu

kiyoungkim1 avatar Jan 15 '21 03:01 kiyoungkim1

Hello!

You have to use the save_model method of the trainer.

jplu avatar Jan 15 '21 08:01 jplu

ok. thanks!

kiyoungkim1 avatar Jan 15 '21 11:01 kiyoungkim1