Instructions to use keras/xlm_roberta_base_multi with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- KerasHub
How to use keras/xlm_roberta_base_multi with KerasHub:
import keras_hub # Load TextClassifier model text_classifier = keras_hub.models.TextClassifier.from_preset( "hf://keras/xlm_roberta_base_multi", 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/xlm_roberta_base_multi")import keras_hub # Create a Backbone model unspecialized for any task backbone = keras_hub.models.Backbone.from_preset("hf://keras/xlm_roberta_base_multi") - Keras
How to use keras/xlm_roberta_base_multi 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/xlm_roberta_base_multi") - Notebooks
- Google Colab
- Kaggle
Update README.md with new model card content
Browse files
README.md
CHANGED
|
@@ -24,6 +24,33 @@ warranties or conditions of any kind. The underlying model is provided by a
|
|
| 24 |
third party and subject to a separate license, available
|
| 25 |
[here](https://github.com/facebookresearch/fairseq).
|
| 26 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
|
| 28 |
__Arguments__
|
| 29 |
|
|
|
|
| 24 |
third party and subject to a separate license, available
|
| 25 |
[here](https://github.com/facebookresearch/fairseq).
|
| 26 |
|
| 27 |
+
## Links
|
| 28 |
+
|
| 29 |
+
* [XLM-RoBERTa Quickstart Notebook](https://www.kaggle.com/code/laxmareddypatlolla/xlm-roberta-quickstart-notebook)
|
| 30 |
+
* [XLM-RoBERTa API Documentation](https://keras.io/keras_hub/api/models/xlm_roberta/)
|
| 31 |
+
* [XLM-RoBERTa Model Card](https://huggingface.co/FacebookAI/xlm-roberta-base)
|
| 32 |
+
* [KerasHub Beginner Guide](https://keras.io/guides/keras_hub/getting_started/)
|
| 33 |
+
* [KerasHub Model Publishing Guide](https://keras.io/guides/keras_hub/upload/)
|
| 34 |
+
|
| 35 |
+
## Installation
|
| 36 |
+
|
| 37 |
+
Keras and KerasHub can be installed with:
|
| 38 |
+
|
| 39 |
+
```
|
| 40 |
+
pip install -U -q keras-hub
|
| 41 |
+
pip install -U -q keras
|
| 42 |
+
```
|
| 43 |
+
|
| 44 |
+
Jax, TensorFlow, and Torch come preinstalled in Kaggle Notebooks. For instructions on installing them in another environment see the [Keras Getting Started](https://keras.io/getting_started/) page.
|
| 45 |
+
|
| 46 |
+
## Presets
|
| 47 |
+
|
| 48 |
+
The following model checkpoints are provided by the Keras team. Full code examples for each are available below.
|
| 49 |
+
| Preset name | Parameters | Description |
|
| 50 |
+
|----------------|------------|--------------------------------------------------|
|
| 51 |
+
| xlm_roberta_base_multi | 277.45M | 12-layer XLM-RoBERTa model where case is maintained. Trained on CommonCrawl in 100 languages.|
|
| 52 |
+
| xlm_roberta_large_multi | 558.84M | 24-layer XLM-RoBERTa model where case is maintained. Trained on CommonCrawl in 100 languages. |
|
| 53 |
+
|
| 54 |
|
| 55 |
__Arguments__
|
| 56 |
|