Instructions to use modularStarEncoder/ModularStarEncoder-finetuned-18 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use modularStarEncoder/ModularStarEncoder-finetuned-18 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("feature-extraction", model="modularStarEncoder/ModularStarEncoder-finetuned-18", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("modularStarEncoder/ModularStarEncoder-finetuned-18", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
Update modularStarEncoder.py
Browse files203 unmodified lines204205206207208209210211212213214215203 unmodified lines
repeated_idx = idx.unsqueeze(1).repeat(1, input_ids.size(1))
DEVICE = input_ids.get_device()
if DEVICE<0: DEVICE = "cpu" ranges = torch.arange(input_ids.size(1)).repeat(input_ids.size(0), 1) ranges = ranges.to(DEVICE)
pooling_mask = (repeated_idx <= ranges).long()
modularStarEncoder.py+5