From 4c5e472636557c9a1c1746f64e80eac50dc78f91 Mon Sep 17 00:00:00 2001 From: Rashmika Reddy Vookanti Date: Fri, 15 Dec 2023 10:08:46 -0800 Subject: [PATCH 1/2] Update main.py --- src/autora/doc/pipelines/main.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/autora/doc/pipelines/main.py b/src/autora/doc/pipelines/main.py index 2c077b2..984b81a 100644 --- a/src/autora/doc/pipelines/main.py +++ b/src/autora/doc/pipelines/main.py @@ -1,13 +1,14 @@ import itertools import logging -import nltk + from timeit import default_timer as timer from typing import List -from nltk.translate.bleu_score import corpus_bleu, SmoothingFunction -from nltk.translate.meteor_score import single_meteor_score +import nltk import torch import typer +from nltk.translate.bleu_score import corpus_bleu, SmoothingFunction +from nltk.translate.meteor_score import single_meteor_score from autora.doc.runtime.predict_hf import Predictor from autora.doc.runtime.prompts import INSTR, SYS, InstructionPrompts, SystemPrompts @@ -20,7 +21,7 @@ logger = logging.getLogger(__name__) nltk.download('wordnet') -def evaluate_documentation(predictions, references): +def evaluate_documentation(predictions, references) -> None: # Tokenize predictions and references tokenized_predictions = [pred[0].split() if pred else [] for pred in predictions] tokenized_references = [[ref.split()] for ref in references] From 1f7b43e89288c74986d86a995dd5e63154535720 Mon Sep 17 00:00:00 2001 From: Rashmika Reddy Vookanti Date: Fri, 15 Dec 2023 10:13:05 -0800 Subject: [PATCH 2/2] Update test_main.py --- tests/test_main.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/test_main.py b/tests/test_main.py index 2b0d1e3..85ba730 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -1,6 +1,7 @@ -import jsonlines from pathlib import Path +import jsonlines + from autora.doc.pipelines.main import eval, generate, evaluate_documentation from autora.doc.runtime.prompts import InstructionPrompts, SystemPrompts @@ -15,7 +16,7 @@ def test_predict() -> None: for output in outputs: assert len(output[0]) > 0, "Expected non-empty output" -def test_evaluation(): +def test_evaluation() -> None: # Test Case: Valid Scores in the range of 0 and 1 data = Path(__file__).parent.joinpath("../data/data.jsonl").resolve() with jsonlines.open(data) as reader: