Skip to content

Commit

Permalink
fix plot error (#651)
Browse files Browse the repository at this point in the history
  • Loading branch information
tastelikefeet committed Apr 3, 2024
1 parent a4cbc59 commit 898783b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion requirements/framework.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ rouge
safetensors
tensorboard
tqdm
transformers>=4.33,<4.40
transformers>=4.33,<4.41
transformers_stream_generator
trl>=0.7.7
7 changes: 6 additions & 1 deletion swift/ui/llm_train/runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,12 @@ def plot(task):
fname = [
fname for fname in os.listdir(tb_dir)
if os.path.isfile(os.path.join(tb_dir, fname))
][0]
and fname.startswith('events.out')
]
if fname:
fname = fname[0]
else:
return [None] * len(Runtime.sft_plot)
tb_path = os.path.join(tb_dir, fname)
data = read_tensorboard_file(tb_path)

Expand Down
2 changes: 1 addition & 1 deletion swift/utils/metric.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

from typing import Dict, Literal

import jieba
import numpy as np
from nltk.translate.bleu_score import SmoothingFunction, sentence_bleu
from rouge.rouge import Rouge
Expand All @@ -15,6 +14,7 @@


def compute_nlg_metrics(prediction, tokenizer):
import jieba
preds, labels = prediction[0], prediction[1]

score_dict = {'rouge-1': [], 'rouge-2': [], 'rouge-l': [], 'bleu-4': []}
Expand Down

0 comments on commit 898783b

Please sign in to comment.