Instructions to use zeromodels/gpt2_large with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- ZeroModels
How to use zeromodels/gpt2_large with ZeroModels:
# pip install -U zeromodels # ZeroModels is pure Keras 3, so pick a backend: "jax", "torch" or "tensorflow". import os os.environ["KERAS_BACKEND"] = "jax" from zeromodels import AutoZModel # AutoZModel reads the repo's model_type and loads the matching class. # For a task head use the matching loader, e.g. AutoZMImageClassify / AutoZMDetect / # AutoZMSemanticSegment / AutoZMTextGenerate (see zeromodels.auto). model = AutoZModel.from_weights("zeromodels/gpt2_large") - Keras
How to use zeromodels/gpt2_large with Keras:
# !pip install -U keras tensorflow huggingface_hub # Keras needs TensorFlow installed to read "hf://" paths, so the tensorflow backend is selected here; # "jax" and "torch" also work for computation once TensorFlow is installed. import os os.environ["KERAS_BACKEND"] = "tensorflow" import keras model = keras.saving.load_model("hf://zeromodels/gpt2_large") - Notebooks
- Google Colab
- Kaggle
Fix HUB-02: correct declared weights filename
Browse files- zm_config.json +2 -2
zm_config.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
| 4 |
"model_module": "zeromodels.models.gpt2",
|
| 5 |
"model_class": "GPT2Model",
|
| 6 |
"variant": "gpt2_large",
|
| 7 |
-
"weights": "model.weights.
|
| 8 |
"schema_version": 2,
|
| 9 |
"weight_dtype": "float32",
|
| 10 |
"model_type": "gpt2",
|
|
@@ -18,4 +18,4 @@
|
|
| 18 |
"norm_eps": 1e-05,
|
| 19 |
"tie_embeddings": true
|
| 20 |
}
|
| 21 |
-
}
|
|
|
|
| 4 |
"model_module": "zeromodels.models.gpt2",
|
| 5 |
"model_class": "GPT2Model",
|
| 6 |
"variant": "gpt2_large",
|
| 7 |
+
"weights": "model.weights.h5",
|
| 8 |
"schema_version": 2,
|
| 9 |
"weight_dtype": "float32",
|
| 10 |
"model_type": "gpt2",
|
|
|
|
| 18 |
"norm_eps": 1e-05,
|
| 19 |
"tie_embeddings": true
|
| 20 |
}
|
| 21 |
+
}
|