Instructions to use kerasformers/gpt2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- KerasFormers
How to use kerasformers/gpt2 with KerasFormers:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Keras
How to use kerasformers/gpt2 with Keras:
# Available backend options are: "jax", "torch", "tensorflow". import os os.environ["KERAS_BACKEND"] = "jax" import keras model = keras.saving.load_model("hf://kerasformers/gpt2") - Notebooks
- Google Colab
- Kaggle
| pipeline_tag: text-generation | |
| license: mit | |
| base_model: openai-community/gpt2 | |
| library_name: kerasformers | |
| tags: | |
| - keras | |
| - kerasformers | |
| - text-generation | |
| - gpt2 | |
| - pytorch | |
| - jax | |
| - tf | |
| # gpt2 | |
| Pure-Keras 3 GPT2 weights for [kerasformers](https://github.com/IMvision12/KerasFormers), converted from [openai-community/gpt2](https://huggingface.co/openai-community/gpt2). | |
| ## Usage | |
| ```python | |
| from kerasformers.models.gpt2 import GPT2Generate, GPT2Tokenizer | |
| model = GPT2Generate.from_weights("kerasformers/gpt2") | |
| tokenizer = GPT2Tokenizer.from_weights("kerasformers/gpt2") | |
| ids = tokenizer("The meaning of life is") | |
| print(model.generate(ids, max_length=40)) | |
| ``` | |
| License: **mit**, inherited from the upstream source. | |