Commit
·
3ee82c7
1
Parent(s):
4972e16
Add usage instructions
Browse files
README.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# TinyBERT Encoder Model
|
| 2 |
+
|
| 3 |
+
This is a fine-tuned **TinyBERT Encoder** model optimized for lightweight NLP tasks.
|
| 4 |
+
|
| 5 |
+
## 🔹 How to Use
|
| 6 |
+
|
| 7 |
+
```python
|
| 8 |
+
from transformers import AutoModel, AutoTokenizer
|
| 9 |
+
|
| 10 |
+
model_name = " hjsgfd/my_tinybert_encoder"
|
| 11 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 12 |
+
model = AutoModel.from_pretrained(model_name)
|
| 13 |
+
|
| 14 |
+
# Encode text
|
| 15 |
+
text = "TinyBERT is small but powerful."
|
| 16 |
+
inputs = tokenizer(text, return_tensors="pt")
|
| 17 |
+
outputs = model(**inputs)
|
| 18 |
+
|
| 19 |
+
print(outputs.last_hidden_state) # Encoded text representation
|