Instructions to use keras/bge_large_v1.5_zh with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- KerasHub
How to use keras/bge_large_v1.5_zh with KerasHub:
import keras_hub # Load TextClassifier model text_classifier = keras_hub.models.TextClassifier.from_preset( "hf://keras/bge_large_v1.5_zh", 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_large_v1.5_zh")import keras_hub # Create a TextEmbedder model task = keras_hub.models.TextEmbedder.from_preset("hf://keras/bge_large_v1.5_zh")import keras_hub # Create a Backbone model unspecialized for any task backbone = keras_hub.models.Backbone.from_preset("hf://keras/bge_large_v1.5_zh") - Keras
How to use keras/bge_large_v1.5_zh 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/bge_large_v1.5_zh") - Notebooks
- Google Colab
- Kaggle
Download config.json from keras/bge_large_v1.5_zh: direct link, hf CLI and curl.
- Browser
- Download file 669 Bytes
-
https://huggingface.co/keras/bge_large_v1.5_zh/resolve/main/config.json
- Command line
-
hf download hf://keras/bge_large_v1.5_zh/config.json
-
curl -L -o config.json https://huggingface.co/keras/bge_large_v1.5_zh/resolve/main/config.json
669 Bytes
| { | |
| "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": 21128, | |
| "num_layers": 24, | |
| "num_heads": 16, | |
| "hidden_dim": 1024, | |
| "intermediate_dim": 4096, | |
| "dropout": 0.1, | |
| "max_sequence_length": 512, | |
| "num_segments": 2 | |
| }, | |
| "registered_name": "keras_hub>BertBackbone" | |
| } |