Instructions to use keras/bge_base_en with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- KerasHub
How to use keras/bge_base_en with KerasHub:
import keras_hub # Load TextClassifier model text_classifier = keras_hub.models.TextClassifier.from_preset( "hf://keras/bge_base_en", 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/bge_base_en")import keras_hub # Create a TextEmbedder model task = keras_hub.models.TextEmbedder.from_preset("hf://keras/bge_base_en")import keras_hub # Create a Backbone model unspecialized for any task backbone = keras_hub.models.Backbone.from_preset("hf://keras/bge_base_en") - Keras
How to use keras/bge_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/bge_base_en") - Notebooks
- Google Colab
- Kaggle
File size: 668 Bytes
ce85b16 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | {
"module": "keras_hub.src.models.bert.bert_backbone",
"class_name": "BertBackbone",
"config": {
"name": "bert_backbone",
"trainable": true,
"dtype": {
"module": "keras",
"class_name": "DTypePolicy",
"config": {
"name": "float32"
},
"registered_name": null
},
"vocabulary_size": 30522,
"num_layers": 12,
"num_heads": 12,
"hidden_dim": 768,
"intermediate_dim": 3072,
"dropout": 0.1,
"max_sequence_length": 512,
"num_segments": 2
},
"registered_name": "keras_hub>BertBackbone"
} |