fix: check for exact task names
Browse filesSigned-off-by: Mohammad Kalim Akram <kalim.akram@jina.ai>
- modeling_lora.py +3 -1
modeling_lora.py
CHANGED
|
@@ -232,9 +232,11 @@ class XLMRobertaLoRA(XLMRobertaPreTrainedModel):
|
|
| 232 |
if (
|
| 233 |
not isinstance(self._lora_prompts, dict)
|
| 234 |
or len(self._lora_prompts) != len(self._lora_adaptations)
|
|
|
|
| 235 |
):
|
| 236 |
raise ValueError(
|
| 237 |
-
f'`lora_prompts` must be a dict and contain the same number of elements
|
|
|
|
| 238 |
)
|
| 239 |
self._adaptation_map = {
|
| 240 |
name: idx for idx, name in enumerate(self._lora_adaptations)
|
|
|
|
| 232 |
if (
|
| 233 |
not isinstance(self._lora_prompts, dict)
|
| 234 |
or len(self._lora_prompts) != len(self._lora_adaptations)
|
| 235 |
+
or not all([v in self._lora_adaptations for v in self._lora_prompts.keys()])
|
| 236 |
):
|
| 237 |
raise ValueError(
|
| 238 |
+
f'`lora_prompts` must be a dict and contain the same number of elements '
|
| 239 |
+
f'as `lora_adaptations` with all keys in `lora_prompts` present in `lora_adaptations`.'
|
| 240 |
)
|
| 241 |
self._adaptation_map = {
|
| 242 |
name: idx for idx, name in enumerate(self._lora_adaptations)
|