Instructions to use keras/gpt2_base_en with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- KerasHub
How to use keras/gpt2_base_en with KerasHub:
import keras_hub # Load CausalLM model (optional: use half precision for inference) causal_lm = keras_hub.models.CausalLM.from_preset("hf://keras/gpt2_base_en", dtype="bfloat16") causal_lm.compile(sampler="greedy") # (optional) specify a sampler # Generate text causal_lm.generate("Keras: deep learning for", max_length=64)import keras_hub # Create a Backbone model unspecialized for any task backbone = keras_hub.models.Backbone.from_preset("hf://keras/gpt2_base_en") - Keras
How to use keras/gpt2_base_en with Keras:
# Available backend options are: "jax", "torch", "tensorflow". import os os.environ["KERAS_BACKEND"] = "jax" import keras model = keras.saving.load_model("hf://keras/gpt2_base_en") - Notebooks
- Google Colab
- Kaggle
Update README.md with new model card content
Browse files
README.md
CHANGED
|
@@ -14,7 +14,7 @@ Weights are released under the [MIT License](https://opensource.org/license/mit)
|
|
| 14 |
|
| 15 |
## Links
|
| 16 |
|
| 17 |
-
* [GPT-2 Quickstart Notebook](https://www.kaggle.com/code/
|
| 18 |
* [GPT-2 API Documentation](https://keras.io/api/keras_hub/models/gpt2/)
|
| 19 |
* [GPT-2 Model Card](https://github.com/openai/gpt-2/blob/master/model_card.md)
|
| 20 |
* [KerasHub Beginner Guide](https://keras.io/guides/keras_hub/getting_started/)
|
|
@@ -26,7 +26,7 @@ Keras and KerasHub can be installed with:
|
|
| 26 |
|
| 27 |
```
|
| 28 |
pip install -U -q keras-hub
|
| 29 |
-
pip install -U -q keras
|
| 30 |
```
|
| 31 |
|
| 32 |
Jax, TensorFlow, and Torch come preinstalled in Kaggle Notebooks. For instruction on installing them in another environment see the [Keras Getting Started](https://keras.io/getting_started/) page.
|
|
|
|
| 14 |
|
| 15 |
## Links
|
| 16 |
|
| 17 |
+
* [GPT-2 Quickstart Notebook](https://www.kaggle.com/code/laxmareddypatlolla/gpt-2-quickstart)
|
| 18 |
* [GPT-2 API Documentation](https://keras.io/api/keras_hub/models/gpt2/)
|
| 19 |
* [GPT-2 Model Card](https://github.com/openai/gpt-2/blob/master/model_card.md)
|
| 20 |
* [KerasHub Beginner Guide](https://keras.io/guides/keras_hub/getting_started/)
|
|
|
|
| 26 |
|
| 27 |
```
|
| 28 |
pip install -U -q keras-hub
|
| 29 |
+
pip install -U -q keras
|
| 30 |
```
|
| 31 |
|
| 32 |
Jax, TensorFlow, and Torch come preinstalled in Kaggle Notebooks. For instruction on installing them in another environment see the [Keras Getting Started](https://keras.io/getting_started/) page.
|