Skip to content

Commit

Permalink
include the try-except logic for spacy
Browse files Browse the repository at this point in the history
  • Loading branch information
tianyu-z committed Jun 10, 2024
1 parent 427dabb commit db8e718
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions lmms_eval/tasks/vcr_wiki/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,23 @@
from lmms_eval.tasks._task_utils.file_utils import generate_submission_file

# Download the English and Chinese models
download("en_core_web_sm")
download("zh_core_web_sm")
try:
nlp_en = spacy.load("en_core_web_sm")
except:
download("en_core_web_sm")
nlp_en = spacy.load("en_core_web_sm")
try:
nlp_zh = spacy.load("zh_core_web_sm")
except:
download("zh_core_web_sm")
nlp_zh = spacy.load("zh_core_web_sm")

eval_logger = logging.getLogger("lmms-eval")

dir_name = os.path.dirname(os.path.abspath(__file__))

rouge = evaluate.load("rouge")
nlp_en = spacy.load("en_core_web_sm")
nlp_zh = spacy.load("zh_core_web_sm")

nlp = {"en": nlp_en, "zh": nlp_zh}

aggregate_results_template = {
Expand Down

0 comments on commit db8e718

Please sign in to comment.