Instructions to use jinaai/xlm-roberta-flash-implementation with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use jinaai/xlm-roberta-flash-implementation with Transformers:
# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("jinaai/xlm-roberta-flash-implementation", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Update rotary.py
Browse files
rotary.py
CHANGED
|
@@ -534,7 +534,7 @@ class RotaryEmbedding(torch.nn.Module):
|
|
| 534 |
# And the output of arange can be quite large, so bf16 would lose a lot of precision.
|
| 535 |
# However, for compatibility reason, we add an option to use the dtype of self.inv_freq.
|
| 536 |
if rotary_base_changed:
|
| 537 |
-
self.inv_freq = self._compute_inv_freq(device=
|
| 538 |
if self.pos_idx_in_fp32:
|
| 539 |
t = torch.arange(seqlen, device=device, dtype=torch.float32)
|
| 540 |
# We want fp32 here as well since inv_freq will be multiplied with t, and the output
|
|
|
|
| 534 |
# And the output of arange can be quite large, so bf16 would lose a lot of precision.
|
| 535 |
# However, for compatibility reason, we add an option to use the dtype of self.inv_freq.
|
| 536 |
if rotary_base_changed:
|
| 537 |
+
self.inv_freq = self._compute_inv_freq(device=device)
|
| 538 |
if self.pos_idx_in_fp32:
|
| 539 |
t = torch.arange(seqlen, device=device, dtype=torch.float32)
|
| 540 |
# We want fp32 here as well since inv_freq will be multiplied with t, and the output
|