Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
# TinyBERT Encoder Model
|
| 2 |
|
| 3 |
This is a fine-tuned **TinyBERT Encoder** model optimized for lightweight NLP tasks.
|
|
|
|
| 1 |
+
---
|
| 2 |
+
tags:
|
| 3 |
+
- transformers
|
| 4 |
+
- text-classification
|
| 5 |
+
- text-embedding
|
| 6 |
+
- tinybert
|
| 7 |
+
license: apache-2.0
|
| 8 |
+
library_name: transformers
|
| 9 |
+
widget:
|
| 10 |
+
- text: "Encode this text using TinyBERT"
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
# 🚀 TinyBERT Encoder Model
|
| 14 |
+
|
| 15 |
+
This is a fine-tuned **TinyBERT Encoder** model, optimized for lightweight NLP tasks.
|
| 16 |
+
|
| 17 |
+
## 🔹 Use This Model
|
| 18 |
+
|
| 19 |
+
To use this model with **transformers**, simply run:
|
| 20 |
+
|
| 21 |
+
```python
|
| 22 |
+
from transformers import AutoModel, AutoTokenizer
|
| 23 |
+
|
| 24 |
+
model_name = "hjsgfd/my_tinybert_encoder" # Replace with your actual repo name
|
| 25 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 26 |
+
model = AutoModel.from_pretrained(model_name)
|
| 27 |
+
|
| 28 |
+
# Encode text
|
| 29 |
+
text = "TinyBERT is small but powerful."
|
| 30 |
+
inputs = tokenizer(text, return_tensors="pt")
|
| 31 |
+
outputs = model(**inputs)
|
| 32 |
+
|
| 33 |
+
print(outputs.last_hidden_state) # Encoded text representation
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
from sentence_transformers import SentenceTransformer
|
| 37 |
+
|
| 38 |
+
model = SentenceTransformer("hjsgfd/my_tinybert_encoder")
|
| 39 |
+
embeddings = model.encode("This is an example sentence.")
|
| 40 |
+
print(embeddings)
|
| 41 |
+
---
|
| 42 |
+
|
| 43 |
+
|
| 44 |
# TinyBERT Encoder Model
|
| 45 |
|
| 46 |
This is a fine-tuned **TinyBERT Encoder** model optimized for lightweight NLP tasks.
|