Update README.md
Browse files
README.md
CHANGED
|
@@ -89,6 +89,35 @@ print(outputs["h"].shape) # [4, 128]
|
|
| 89 |
print(outputs["z"].shape) # [4, projector_out2]
|
| 90 |
```
|
| 91 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 92 |
### Load the Downstream Classification Model
|
| 93 |
```py
|
| 94 |
import torch
|
|
|
|
| 89 |
print(outputs["z"].shape) # [4, projector_out2]
|
| 90 |
```
|
| 91 |
|
| 92 |
+
This repository is public, and no Hugging Face authentication is required to download or use the model.
|
| 93 |
+
|
| 94 |
+
Users may see a warning when accessing the model without authentication. This warning is harmless and can be safely ignored.
|
| 95 |
+
|
| 96 |
+
However, users may optionally authenticate using their own Hugging Face account by passing their access_token as follows:
|
| 97 |
+
|
| 98 |
+
```py
|
| 99 |
+
import torch
|
| 100 |
+
from transformers import AutoModel
|
| 101 |
+
|
| 102 |
+
model = AutoModel.from_pretrained(
|
| 103 |
+
"SaeedLab/NeuroCLR",
|
| 104 |
+
subfolder="pretraining",
|
| 105 |
+
trust_remote_code=True,
|
| 106 |
+
access_token=your_huggingface_token
|
| 107 |
+
)
|
| 108 |
+
|
| 109 |
+
model.eval()
|
| 110 |
+
|
| 111 |
+
x = torch.randn(4, 1, 128) # [batch, sequence_length, embedding_dim]
|
| 112 |
+
|
| 113 |
+
with torch.no_grad():
|
| 114 |
+
outputs = model(x)
|
| 115 |
+
|
| 116 |
+
print(outputs["h"].shape) # [4, 128]
|
| 117 |
+
print(outputs["z"].shape) # [4, projector_out2]
|
| 118 |
+
```
|
| 119 |
+
|
| 120 |
+
|
| 121 |
### Load the Downstream Classification Model
|
| 122 |
```py
|
| 123 |
import torch
|