Run this model with HF Jobs
Run jinaai/xlm-roberta-flash-implementation on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/jinaai/xlm-roberta-flash-implementation. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/jinaai/xlm-roberta-flash-implementation on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
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
Fixes import error for this function `create_position_ids_from_input_ids` in transformers V5.
Browse filesThe function is now kept as a staticmethod in the file: (transformers.models.xlm_roberta.modeling_xlm_roberta). This PR will make sure that it will now work in both Transformers V5 and older v4.57.6 versions.
ImportError: cannot import name 'create_position_ids_from_input_ids' from 'transformers.models.xlm_roberta.modeling_xlm_roberta' (/home/suraj/repos/transformers/src/transformers/models/xlm_roberta/modeling_xlm_roberta.py)
4 unmodified lines567891011124 unmodified linesimport torchimport torch.nn as nnfrom transformers.models.xlm_roberta.modeling_xlm_roberta import \create_position_ids_from_input_idsclass XLMRobertaEmbeddings(nn.Module):4 unmodified lines5678910111213141516171819202122232425264 unmodified linesimport torchimport torch.nn as nndef create_position_ids_from_input_ids(input_ids, padding_idx, past_key_values_length=0):"""Replace non-padding symbols with their position numbers. Position numbers begin at padding_idx+1. Padding symbolsare ignored. This is modified from fairseq's `utils.make_positions`.Args:x: torch.Tensor x:Returns: torch.Tensor"""# The series of casts and type-conversions here are carefully balanced to both work with ONNX export and XLA.mask = input_ids.ne(padding_idx).int()incremental_indices = (torch.cumsum(mask, dim=1).type_as(mask) + past_key_values_length) * maskreturn incremental_indices.long() + padding_idxclass XLMRobertaEmbeddings(nn.Module):
embedding.py+16-2