Update README.md
Browse files
README.md
CHANGED
|
@@ -51,6 +51,15 @@ classifier = pipeline('fill-mask', model=model, tokenizer=tokenizer,device="cpu"
|
|
| 51 |
|
| 52 |
print(classifier("I [MASK] to the store yesterday."))
|
| 53 |
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
|
| 55 |
# Join the Nomic Community
|
| 56 |
|
|
|
|
| 51 |
|
| 52 |
print(classifier("I [MASK] to the store yesterday."))
|
| 53 |
```
|
| 54 |
+
To finetune the model for a Sequence Classification task, you can use the following snippet
|
| 55 |
+
|
| 56 |
+
```python
|
| 57 |
+
from transformers import AutoConfig, AutoModelForSequenceClassification
|
| 58 |
+
model_path = "nomic-ai/nomic-bert-2048"
|
| 59 |
+
config = AutoConfig.from_pretrained(model_path, trust_remote_code=True)
|
| 60 |
+
# strict needs to be false here since we're initializing some new params
|
| 61 |
+
model = AutoModelForSequenceClassification.from_pretrained(model_path, config=config, trust_remote_code=True, strict=False)
|
| 62 |
+
```
|
| 63 |
|
| 64 |
# Join the Nomic Community
|
| 65 |
|