Feature Extraction
Transformers
Safetensors
English
bert
retrieval
constbert
colbert
multi-vector
embedding
custom_code
text-embeddings-inference
Instructions to use pinecone/ConstBERT with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use pinecone/ConstBERT with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("feature-extraction", model="pinecone/ConstBERT", trust_remote_code=True)# Load model directly from transformers import AutoTokenizer, AutoModel tokenizer = AutoTokenizer.from_pretrained("pinecone/ConstBERT", trust_remote_code=True) model = AutoModel.from_pretrained("pinecone/ConstBERT", trust_remote_code=True) - Notebooks
- Google Colab
- Kaggle
Upload ConstBERT
Browse files- modeling.py +2 -2
modeling.py
CHANGED
|
@@ -21,10 +21,10 @@ class MixedPrecisionManager():
|
|
| 21 |
self.activated = activated
|
| 22 |
|
| 23 |
if self.activated:
|
| 24 |
-
self.scaler = torch.
|
| 25 |
|
| 26 |
def context(self):
|
| 27 |
-
return torch.
|
| 28 |
|
| 29 |
def backward(self, loss):
|
| 30 |
if self.activated:
|
|
|
|
| 21 |
self.activated = activated
|
| 22 |
|
| 23 |
if self.activated:
|
| 24 |
+
self.scaler = torch.amp.GradScaler("cuda")
|
| 25 |
|
| 26 |
def context(self):
|
| 27 |
+
return torch.amp.autocast("cuda") if self.activated else NullContextManager()
|
| 28 |
|
| 29 |
def backward(self, loss):
|
| 30 |
if self.activated:
|