You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
微调时
运行python finetune_hf.py data/AdvertiseGen/ THUDM/chatglm3-6b configs/lora.yaml
到中途突然报错,请问这是因为什么
67%|███████████████████████████████████████████████████████████████████████████▎ | 2000/3000 [29:44<18:00, 1.08s/it]***** Running Evaluation *****
Num examples = 50
Batch size = 128
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮ | 0/1 [00:00<?, ?it/s]
│ /home/fuchunlei/fanyijia/python/finetune/chatglm3-6B/ChatGLM3-main/ChatGLM3-main/finetune_demo/f │
│ inetune_hf.py:542 in main │
│ │
│ 539 │ ) │
│ 540 │ │
│ 541 │ if auto_resume_from_checkpoint.upper() == "" or auto_resume_from_checkpoint is None: │
│ ❱ 542 │ │ trainer.train() │
│ 543 │ else: │
│ 544 │ │ def do_rf_checkpoint(sn): │
│ 545 │ │ │ model.gradient_checkpointing_enable() │
│ │
│ /home/fuchunlei/fanyijia/.conda/envs/finetune3.6/lib/python3.11/site-packages/transformers/train │
│ er.py:1859 in train │
│ │
│ 1856 │ │ │ finally: │
│ 1857 │ │ │ │ hf_hub_utils.enable_progress_bars() │
│ 1858 │ │ else: │
│ ❱ 1859 │ │ │ return inner_training_loop( │
│ 1860 │ │ │ │ args=args, │
│ 1861 │ │ │ │ resume_from_checkpoint=resume_from_checkpoint, │
│ 1862 │ │ │ │ trial=trial, │
│ │
│ /home/fuchunlei/fanyijia/.conda/envs/finetune3.6/lib/python3.11/site-packages/transformers/train │
│ er.py:2278 in _inner_training_loop │
│ │
│ 2275 │ │ │ │ │ self.state.epoch = epoch + (step + 1 + steps_skipped) / steps_in_epo │
│ 2276 │ │ │ │ │ self.control = self.callback_handler.on_step_end(args, self.state, s │
│ 2277 │ │ │ │ │ │
│ ❱ 2278 │ │ │ │ │ self._maybe_log_save_evaluate(tr_loss, grad_norm, model, trial, epoc │
│ 2279 │ │ │ │ else: │
│ 2280 │ │ │ │ │ self.control = self.callback_handler.on_substep_end(args, self.state │
│ 2281 │
│ │
│ /home/fuchunlei/fanyijia/.conda/envs/finetune3.6/lib/python3.11/site-packages/transformers/train │
│ er.py:2662 in _maybe_log_save_evaluate │
│ │
│ 2659 │ │ │
│ 2660 │ │ metrics = None │
│ 2661 │ │ if self.control.should_evaluate: │
│ ❱ 2662 │ │ │ metrics = self.evaluate(ignore_keys=ignore_keys_for_eval) │
│ 2663 │ │ │ self._report_to_hp_search(trial, self.state.global_step, metrics) │
│ 2664 │ │ │ │
│ 2665 │ │ │ # Run delayed LR scheduler now that metrics are populated │
│ │
│ /home/fuchunlei/fanyijia/.conda/envs/finetune3.6/lib/python3.11/site-packages/transformers/train │
│ er_seq2seq.py:180 in evaluate │
│ │
│ 177 │ │ # We don't want to drop samples in general │
│ 178 │ │ self.gather_function = self.accelerator.gather │
│ 179 │ │ self._gen_kwargs = gen_kwargs │
│ ❱ 180 │ │ return super().evaluate(eval_dataset, ignore_keys=ignore_keys, metric_key_prefix │
│ 181 │ │
│ 182 │ def predict( │
│ 183 │ │ self, │
│ │
│ /home/fuchunlei/fanyijia/.conda/envs/finetune3.6/lib/python3.11/site-packages/transformers/train │
│ er.py:3467 in evaluate │
│ │
│ 3464 │ │ start_time = time.time() │
│ 3465 │ │ │
│ 3466 │ │ eval_loop = self.prediction_loop if self.args.use_legacy_prediction_loop else se │
│ ❱ 3467 │ │ output = eval_loop( │
│ 3468 │ │ │ eval_dataloader, │
│ 3469 │ │ │ description="Evaluation", │
│ 3470 │ │ │ # No point gathering the predictions if there are no metrics, otherwise we d │
│ │
│ /home/fuchunlei/fanyijia/.conda/envs/finetune3.6/lib/python3.11/site-packages/transformers/train │
│ er.py:3719 in evaluation_loop │
│ │
│ 3716 │ │ │ │ │ EvalPrediction(predictions=all_preds, label_ids=all_labels, inputs=a │
│ 3717 │ │ │ │ ) │
│ 3718 │ │ │ else: │
│ ❱ 3719 │ │ │ │ metrics = self.compute_metrics(EvalPrediction(predictions=all_preds, lab │
│ 3720 │ │ else: │
│ 3721 │ │ │ metrics = {} │
│ 3722 │
│ │
│ /home/fuchunlei/fanyijia/python/finetune/chatglm3-6B/ChatGLM3-main/ChatGLM3-main/finetune_demo/f │
│ inetune_hf.py:435 in compute_metrics │
│ │
│ 432 │ │ pred_tokens = list(jieba.cut(pred_txt)) │
│ 433 │ │ label_tokens = list(jieba.cut(label_txt)) │
│ 434 │ │ rouge = Rouge() │
│ ❱ 435 │ │ scores = rouge.get_scores(' '.join(pred_tokens), ' '.join(label_tokens)) │
│ 436 │ │ for k, v in scores[0].items(): │
│ 437 │ │ │ metrics_dct[k].append(round(v['f'] * 100, 4)) │
│ 438 │ │ metrics_dct['bleu-4'].append( │
│ │
│ /home/fuchunlei/fanyijia/.conda/envs/finetune3.6/lib/python3.11/site-packages/rouge_chinese/roug │
│ e.py:116 in get_scores │
│ │
│ 113 │ │ assert(len(hyps) == len(refs)) │
│ 114 │ │ │
│ 115 │ │ if not avg: │
│ ❱ 116 │ │ │ return self._get_scores(hyps, refs) │
│ 117 │ │ return self._get_avg_scores(hyps, refs) │
│ 118 │ │
│ 119 │ def _get_scores(self, hyps, refs): │
│ │
│ /home/fuchunlei/fanyijia/.conda/envs/finetune3.6/lib/python3.11/site-packages/rouge_chinese/roug │
│ e.py:129 in _get_scores │
│ │
│ 126 │ │ │ │
│ 127 │ │ │ for m in self.metrics: │
│ 128 │ │ │ │ fn = Rouge.AVAILABLE_METRICS[m] │
│ ❱ 129 │ │ │ │ sc = fn( │
│ 130 │ │ │ │ │ hyp, │
│ 131 │ │ │ │ │ ref, │
│ 132 │ │ │ │ │ raw_results=self.raw_results, │
│ │
│ /home/fuchunlei/fanyijia/.conda/envs/finetune3.6/lib/python3.11/site-packages/rouge_chinese/roug │
│ e.py:54 in │
│ │
│ 51 class Rouge: │
│ 52 │ DEFAULT_METRICS = ["rouge-1", "rouge-2", "rouge-l"] │
│ 53 │ AVAILABLE_METRICS = { │
│ ❱ 54 │ │ "rouge-1": lambda hyp, ref, **k: rouge_score.rouge_n(hyp, ref, 1, **k), │
│ 55 │ │ "rouge-2": lambda hyp, ref, **k: rouge_score.rouge_n(hyp, ref, 2, **k), │
│ 56 │ │ "rouge-3": lambda hyp, ref, **k: rouge_score.rouge_n(hyp, ref, 3, **k), │
│ 57 │ │ "rouge-4": lambda hyp, ref, **k: rouge_score.rouge_n(hyp, ref, 4, **k), │
│ │
│ /home/fuchunlei/fanyijia/.conda/envs/finetune3.6/lib/python3.11/site-packages/rouge_chinese/roug │
│ e_score.py:253 in rouge_n │
│ │
│ 250 │ ValueError: raises exception if a param has len <= 0 │
│ 251 │ """ │
│ 252 │ if len(evaluated_sentences) <= 0: │
│ ❱ 253 │ │ raise ValueError("Hypothesis is empty.") │
│ 254 │ if len(reference_sentences) <= 0: │
│ 255 │ │ raise ValueError("Reference is empty.") │
│ 256 │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
ValueError: Hypothesis is empty.
67%|███████████████████████████████████████████████████████████████████████████▎ | 2000/3000 [29:52<14:56, 1.12it/s]
Beta Was this translation helpful? Give feedback.
All reactions