Tensorflow 模型转换到Pytorch

A command-line interface is provided to convert original Bert/GPT/GPT-2/Transformer-XL/XLNet/XLM checkpoints in models than be loaded using the from_pretrained methods of the library.

example:

export BERT_BASE_DIR=/path/to/bert/uncased_L-12_H-768_A-12

transformers-cli convert --model_type bert \
  --tf_checkpoint $BERT_BASE_DIR/bert_model.ckpt \
  --config $BERT_BASE_DIR/bert_config.json \
  --pytorch_dump_output $BERT_BASE_DIR/pytorch_model.bin

 

https://huggingface.co/transformers/converting_tensorflow_models.html

 

posted @ 2021-08-10 16:04  今夜无风  阅读(594)  评论(0编辑  收藏  举报