Instructions to use tuhailong/cross-encoder-bert-base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use tuhailong/cross-encoder-bert-base with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="tuhailong/cross-encoder-bert-base")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("tuhailong/cross-encoder-bert-base") model = AutoModelForSequenceClassification.from_pretrained("tuhailong/cross-encoder-bert-base", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Update README.md
Browse files
README.md
CHANGED
|
@@ -14,10 +14,8 @@ model created by [sentence-tansformers](https://www.sbert.net/index.html),mode
|
|
| 14 |
|
| 15 |
### Usage
|
| 16 |
```python
|
| 17 |
-
>>> from
|
| 18 |
-
>>> model =
|
| 19 |
-
>>>
|
| 20 |
-
>>>
|
| 21 |
-
>>> inputs = tokenizer(sentences_str_list,return_tensors="pt", padding='max_length', truncation=True, max_length=32)
|
| 22 |
-
>>> outputs = model(**inputs)
|
| 23 |
```
|
|
|
|
| 14 |
|
| 15 |
### Usage
|
| 16 |
```python
|
| 17 |
+
>>> from sentence_transformers.cross_encoder import CrossEncoder
|
| 18 |
+
>>> model = CrossEncoder('tuhailong/cross-encoder')
|
| 19 |
+
>>> scores = model.predict([["今天天气不错", "今天心情不错"]])
|
| 20 |
+
>>> print(scores)
|
|
|
|
|
|
|
| 21 |
```
|