tensorflow2_gpt2 Slow speed
See original GitHub issue❓ The speed of pytorch_gpt2 based on transformers is 4-5 times faster than that of tensorflow_gpt2, which is unreasonable. Where is my problem
pytorch_gpt2
tokenizer = GPT2Tokenizer.from_pretrained('gpt2')
model = GPT2LMHeadModel.from_pretrained('gpt2')
model.to(dev)
raw_text_2 = "And if so be ye can descrive what ye bear,"
inputs = tokenizer.encode(raw_text_2, add_special_tokens=False, return_tensors="pt")
inputs = inputs.to(dev)
generated = model.generate(inputs, top_k=0, max_length=512)
tensorflow2_gpt2
tokenizer = GPT2Tokenizer.from_pretrained('gpt2')
model = TFGPT2LMHeadModel.from_pretrained('gpt2')
raw_text = "And if so be ye can descrive what ye bear,"
tokens = tokenizer.encode(raw_text, return_tensors="tf")
output_ids = model.generate(tokens, top_k = 0, max_length=512)
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Why is TensorFlow 2 much slower than TensorFlow 1?
Below is code benchmarking performance, TF1 vs. TF2 - with TF1 running anywhere from 47% to 276% faster. My question is: what is...
Read more >Why is TensorFlow 2 much slower than TensorFlow 1? #33487
Below is code benchmarking performance, TF1 vs. TF2 - with TF1 running anywhere from 47% to 276% faster. My question is: what is...
Read more >Tensorflow running slower after cuda installation
To avoid using the GPU, and the processing speed is slower than it was prior to the installation of CUDA. Using the commands...
Read more >[D] Why is TensorFlow so slow? : r/MachineLearning - Reddit
I guess you have access to TPUs if you use TensorFlow but would it bring its speed to the same level as torch...
Read more >Why is it so slow? | Apple Developer Forums
With tensorflow-metal the performance is 6x slower than pure CPU. Posted 1 year ago by. zhiyufu.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
With tf. Varibable model for packaging
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.