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
refactor-task-type-to-task (#43)
Browse files- rename task type (3afddee7275504c48afc63049db9124f9e2871ce)
Files changed (2)
- modeling_lora.py+10-10
- modeling_xlm_roberta.py+1-1
366 unmodified lines367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401366 unmodified linesself,sentences: Union[str, List[str]],*args,task_type: Optional[str] = None,**kwargs,) -> Union[List[torch.Tensor], np.ndarray, torch.Tensor]:"""Computes sentence embeddings.sentences(`str` or `List[str]`):Sentence or sentences to be encodedtask_type(`str`, *optional*, defaults to `None`):Specifies the task for which the encoding is intended. If `task_type` is not provided,all LoRA adapters are disabled, and the model reverts to its original,general-purpose weights."""if task_type and task_type not in self._lora_adaptations:raise ValueError(f"Unsupported task '{task_type}'. "f"Supported tasks are: {', '.join(self.config.lora_adaptations)}."f"Alternatively, don't pass the `task_type` argument to disable LoRA.")adapter_mask = Noneif task_type:task_id = self._adaptation_map[task_type]num_examples = 1 if isinstance(sentences, str) else len(sentences)adapter_mask = torch.full((num_examples,), task_id, dtype=torch.int32, device=self.device)if isinstance(sentences, str):sentences = self._task_instructions[task_type] + sentenceselse:sentences = [self._task_instructions[task_type] + sentence for sentence in sentences]return self.roberta.encode(sentences, *args, adapter_mask=adapter_mask, **kwargs)366 unmodified lines367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401366 unmodified linesself,sentences: Union[str, List[str]],*args,task: Optional[str] = None,**kwargs,) -> Union[List[torch.Tensor], np.ndarray, torch.Tensor]:"""Computes sentence embeddings.sentences(`str` or `List[str]`):Sentence or sentences to be encodedtask(`str`, *optional*, defaults to `None`):Specifies the task for which the encoding is intended. If `task` is not provided,all LoRA adapters are disabled, and the model reverts to its original,general-purpose weights."""if task and task not in self._lora_adaptations:raise ValueError(f"Unsupported task '{task}'. "f"Supported tasks are: {', '.join(self.config.lora_adaptations)}."f"Alternatively, don't pass the `task` argument to disable LoRA.")adapter_mask = Noneif task:task_id = self._adaptation_map[task]num_examples = 1 if isinstance(sentences, str) else len(sentences)adapter_mask = torch.full((num_examples,), task_id, dtype=torch.int32, device=self.device)if isinstance(sentences, str):sentences = self._task_instructions[task] + sentenceselse:sentences = [self._task_instructions[task] + sentence for sentence in sentences]return self.roberta.encode(sentences, *args, adapter_mask=adapter_mask, **kwargs)
472 unmodified lines473474475476477478479472 unmodified linesnormalize_embeddings: bool = True,truncate_dim: Optional[int] = None,adapter_mask: Optional[torch.Tensor] = None,task_type: Optional[str] = None,**tokenizer_kwargs,) -> Union[List[torch.Tensor], np.ndarray, torch.Tensor]:"""472 unmodified lines473474475476477478479472 unmodified linesnormalize_embeddings: bool = True,truncate_dim: Optional[int] = None,adapter_mask: Optional[torch.Tensor] = None,task: Optional[str] = None,**tokenizer_kwargs,) -> Union[List[torch.Tensor], np.ndarray, torch.Tensor]:"""
modeling_lora.py+10-10
modeling_xlm_roberta.py+1-1