-
-
Save pxanthopoulos/9f40ba1fdef3a57c9a1b13d75ca37db2 to your computer and use it in GitHub Desktop.
Export GPT in TF format using huggingface
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from transformers import AutoTokenizer, TFOpenAIGPTModel | |
import tensorflow as tf | |
model_name = "openai-community/openai-gpt" | |
model_path = "/workspace/iree/workspace/gpt/gpt-tf" | |
cache_dir = "/workspace/iree/workspace/gpt/cache" | |
tokenizer = AutoTokenizer.from_pretrained(model_name, cache_dir=cache_dir) | |
model = TFOpenAIGPTModel.from_pretrained(model_name, cache_dir=cache_dir) | |
tf.saved_model.save(model, model_path) | |
tokenizer.save_pretrained(model_path) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment