Commit 73fe2e73 authored by VictorSanh's avatar VictorSanh Committed by Lysandre Debut
Browse files

remove fstrings

parent 3e7656f7
......@@ -248,7 +248,7 @@ def evaluate(args, model, tokenizer, prefix=""):
if args.output_mode == "classification":
preds = np.argmax(preds, axis=1)
else:
raise ValueError(f'No other `output_mode` for XNLI.')
raise ValueError('No other `output_mode` for XNLI.')
result = compute_metrics(eval_task, preds, out_label_ids)
results.update(result)
......@@ -305,7 +305,7 @@ def load_and_cache_examples(args, task, tokenizer, evaluate=False):
if output_mode == "classification":
all_labels = torch.tensor([f.label for f in features], dtype=torch.long)
else:
raise ValueError(f'No other `output_mode` for XNLI.')
raise ValueError('No other `output_mode` for XNLI.')
dataset = TensorDataset(all_input_ids, all_attention_mask, all_token_type_ids, all_labels)
return dataset
......
......@@ -36,7 +36,7 @@ class XnliProcessor(DataProcessor):
def get_train_examples(self, data_dir):
"""See base class."""
lg = self.language if self.train_language is None else self.train_language
lines = self._read_tsv(os.path.join(data_dir, f"XNLI-MT-1.0/multinli/multinli.train.{lg}.tsv"))
lines = self._read_tsv(os.path.join(data_dir, "XNLI-MT-1.0/multinli/multinli.train.{lg}.tsv".format(lg)))
examples = []
for (i, line) in enumerate(lines):
if i == 0:
......@@ -78,7 +78,7 @@ def xnli_compute_metrics(task_name, preds, labels):
if task_name == "xnli":
return {"acc": simple_accuracy(preds, labels)}
else:
raise ValueError(f'{task_name} is not a supported task.')
raise ValueError('{} is not a supported task.'.format(task_name))
xnli_processors = {
"xnli": XnliProcessor,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment