Instructions to use keras/esm2_t12_35M with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- KerasHub
How to use keras/esm2_t12_35M with KerasHub:
import keras_hub # Load TextClassifier model text_classifier = keras_hub.models.TextClassifier.from_preset( "hf://keras/esm2_t12_35M", num_classes=2, ) # Fine-tune text_classifier.fit(x=["Thilling adventure!", "Total snoozefest."], y=[1, 0]) # Classify text text_classifier.predict(["Not my cup of tea."])import keras_hub # Create a MaskedLM model task = keras_hub.models.MaskedLM.from_preset("hf://keras/esm2_t12_35M")import keras_hub # Create a Backbone model unspecialized for any task backbone = keras_hub.models.Backbone.from_preset("hf://keras/esm2_t12_35M") - Keras
How to use keras/esm2_t12_35M 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://keras/esm2_t12_35M") - Notebooks
- Google Colab
- Kaggle
Download config.json from keras/esm2_t12_35M: direct link, hf CLI and curl.
- Browser
- Download file 654 Bytes
-
https://huggingface.co/keras/esm2_t12_35M/resolve/main/config.json
- Command line
-
hf download hf://keras/esm2_t12_35M/config.json
-
curl -L -o config.json https://huggingface.co/keras/esm2_t12_35M/resolve/main/config.json
654 Bytes
| { | |
| "module": "keras_hub.src.models.esm.esm_backbone", | |
| "class_name": "ESMBackbone", | |
| "config": { | |
| "name": "esm_backbone", | |
| "trainable": true, | |
| "vocabulary_size": 33, | |
| "num_layers": 12, | |
| "num_heads": 20, | |
| "hidden_dim": 480, | |
| "intermediate_dim": 1920, | |
| "dropout": 0.0, | |
| "max_wavelength": 10000, | |
| "use_bias": true, | |
| "activation": "gelu", | |
| "layer_norm_eps": 1e-05, | |
| "use_pre_layer_norm": false, | |
| "position_embedding_type": "rotary", | |
| "max_sequence_length": 1026, | |
| "pad_token_id": 1 | |
| }, | |
| "registered_name": "keras_hub>ESMBackbone" | |
| } |