From 8be78a2d6403238e8cc0068e701acca65a198572 Mon Sep 17 00:00:00 2001 From: Abolfazl Shahbazi Date: Wed, 29 May 2024 21:01:40 -0700 Subject: [PATCH] Misc header and style updates (#15) Signed-off-by: Abolfazl Shahbazi --- .github/workflows/code_scan.yml | 5 +---- .github/workflows/docker/common.dockerfile | 7 ++----- .github/workflows/scripts/unittest/unittest.sh | 1 - .github/workflows/trellix.yml | 5 +---- .github/workflows/unittest.yml | 5 +---- GenAIEval/__init__.py | 2 +- GenAIEval/evaluation/__init__.py | 2 +- .../evaluation/bigcode_evaluation_harness/__init__.py | 2 +- .../evaluation/bigcode_evaluation_harness/accuracy.py | 2 +- .../evaluation/bigcode_evaluation_harness/arguments.py | 2 +- .../evaluation/bigcode_evaluation_harness/examples/main.py | 2 +- GenAIEval/evaluation/lm_evaluation_harness/__init__.py | 3 ++- GenAIEval/evaluation/lm_evaluation_harness/accuracy.py | 3 ++- GenAIEval/evaluation/lm_evaluation_harness/arguments.py | 3 ++- .../evaluation/lm_evaluation_harness/examples/main.py | 3 ++- .../evaluation/lm_evaluation_harness/lm_eval/__init__.py | 2 +- .../evaluation/lm_evaluation_harness/lm_eval/evaluator.py | 3 ++- .../lm_evaluation_harness/lm_eval/models/__init__.py | 3 ++- .../lm_evaluation_harness/lm_eval/models/huggingface.py | 3 ++- README.md | 6 +++--- setup.py | 3 ++- tests/test_bigcode_eval.py | 3 ++- tests/test_lm_eval.py | 3 ++- 23 files changed, 35 insertions(+), 38 deletions(-) diff --git a/.github/workflows/code_scan.yml b/.github/workflows/code_scan.yml index fce9c13e..ba79a619 100644 --- a/.github/workflows/code_scan.yml +++ b/.github/workflows/code_scan.yml @@ -1,7 +1,4 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Copyright (c) 2022 Intel Corporation +# Copyright (c) 2024 Intel Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/.github/workflows/docker/common.dockerfile b/.github/workflows/docker/common.dockerfile index 843885d3..ca511a1e 100644 --- a/.github/workflows/docker/common.dockerfile +++ b/.github/workflows/docker/common.dockerfile @@ -1,7 +1,4 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Copyright (c) 2022 Intel Corporation +# Copyright (c) 2024 Intel Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -35,4 +32,4 @@ RUN apt-get update && apt-get install -y --no-install-recommends --fix-missing \ RUN ln -sf $(which python3) /usr/bin/python RUN python -m pip install --no-cache-dir pytest -WORKDIR / \ No newline at end of file +WORKDIR / diff --git a/.github/workflows/scripts/unittest/unittest.sh b/.github/workflows/scripts/unittest/unittest.sh index a241c471..4613ef2e 100644 --- a/.github/workflows/scripts/unittest/unittest.sh +++ b/.github/workflows/scripts/unittest/unittest.sh @@ -14,7 +14,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -#!/bin/bash source /GenAIEval/.github/workflows/scripts/change_color export COVERAGE_RCFILE="/GenAIEval/.github/workflows/scripts/unittest/coveragerc" LOG_DIR=/GenAIEval/log_dir diff --git a/.github/workflows/trellix.yml b/.github/workflows/trellix.yml index 256f24ef..ccc98ba3 100644 --- a/.github/workflows/trellix.yml +++ b/.github/workflows/trellix.yml @@ -1,7 +1,4 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Copyright (c) 2022 Intel Corporation +# Copyright (c) 2024 Intel Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/.github/workflows/unittest.yml b/.github/workflows/unittest.yml index af5770c9..4c3807f6 100644 --- a/.github/workflows/unittest.yml +++ b/.github/workflows/unittest.yml @@ -1,7 +1,4 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Copyright (c) 2022 Intel Corporation +# Copyright (c) 2024 Intel Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/GenAIEval/__init__.py b/GenAIEval/__init__.py index 369707c0..1e8078e9 100644 --- a/GenAIEval/__init__.py +++ b/GenAIEval/__init__.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Copyright (c) 2022 Intel Corporation +# Copyright (c) 2024 Intel Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/GenAIEval/evaluation/__init__.py b/GenAIEval/evaluation/__init__.py index 369707c0..1e8078e9 100644 --- a/GenAIEval/evaluation/__init__.py +++ b/GenAIEval/evaluation/__init__.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Copyright (c) 2022 Intel Corporation +# Copyright (c) 2024 Intel Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/GenAIEval/evaluation/bigcode_evaluation_harness/__init__.py b/GenAIEval/evaluation/bigcode_evaluation_harness/__init__.py index 60505a08..11b515b4 100644 --- a/GenAIEval/evaluation/bigcode_evaluation_harness/__init__.py +++ b/GenAIEval/evaluation/bigcode_evaluation_harness/__init__.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Copyright (c) 2022 Intel Corporation +# Copyright (c) 2024 Intel Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/GenAIEval/evaluation/bigcode_evaluation_harness/accuracy.py b/GenAIEval/evaluation/bigcode_evaluation_harness/accuracy.py index f0d043e8..945c0d68 100644 --- a/GenAIEval/evaluation/bigcode_evaluation_harness/accuracy.py +++ b/GenAIEval/evaluation/bigcode_evaluation_harness/accuracy.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Copyright (c) 2022 Intel Corporation +# Copyright (c) 2024 Intel Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/GenAIEval/evaluation/bigcode_evaluation_harness/arguments.py b/GenAIEval/evaluation/bigcode_evaluation_harness/arguments.py index 7fe217a1..0d9511e0 100644 --- a/GenAIEval/evaluation/bigcode_evaluation_harness/arguments.py +++ b/GenAIEval/evaluation/bigcode_evaluation_harness/arguments.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Copyright (c) 2022 Intel Corporation +# Copyright (c) 2024 Intel Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/GenAIEval/evaluation/bigcode_evaluation_harness/examples/main.py b/GenAIEval/evaluation/bigcode_evaluation_harness/examples/main.py index 4e103158..1b998c04 100644 --- a/GenAIEval/evaluation/bigcode_evaluation_harness/examples/main.py +++ b/GenAIEval/evaluation/bigcode_evaluation_harness/examples/main.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Copyright (c) 2022 Intel Corporation +# Copyright (c) 2024 Intel Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/GenAIEval/evaluation/lm_evaluation_harness/__init__.py b/GenAIEval/evaluation/lm_evaluation_harness/__init__.py index 3592b7dc..aaacc723 100644 --- a/GenAIEval/evaluation/lm_evaluation_harness/__init__.py +++ b/GenAIEval/evaluation/lm_evaluation_harness/__init__.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Copyright (c) 2022 Intel Corporation +# Copyright (c) 2024 Intel Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,6 +14,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. + from .accuracy import cli_evaluate as evaluate from .arguments import LMEvalParser, setup_parser diff --git a/GenAIEval/evaluation/lm_evaluation_harness/accuracy.py b/GenAIEval/evaluation/lm_evaluation_harness/accuracy.py index 274fafa7..be307127 100644 --- a/GenAIEval/evaluation/lm_evaluation_harness/accuracy.py +++ b/GenAIEval/evaluation/lm_evaluation_harness/accuracy.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Copyright (c) 2022 Intel Corporation +# Copyright (c) 2024 Intel Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,6 +14,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. + import json import logging import os diff --git a/GenAIEval/evaluation/lm_evaluation_harness/arguments.py b/GenAIEval/evaluation/lm_evaluation_harness/arguments.py index 6b52b153..7e6c7ada 100644 --- a/GenAIEval/evaluation/lm_evaluation_harness/arguments.py +++ b/GenAIEval/evaluation/lm_evaluation_harness/arguments.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Copyright (c) 2022 Intel Corporation +# Copyright (c) 2024 Intel Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,6 +14,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. + import argparse from functools import partial diff --git a/GenAIEval/evaluation/lm_evaluation_harness/examples/main.py b/GenAIEval/evaluation/lm_evaluation_harness/examples/main.py index 6fdd27db..15b23d2a 100644 --- a/GenAIEval/evaluation/lm_evaluation_harness/examples/main.py +++ b/GenAIEval/evaluation/lm_evaluation_harness/examples/main.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Copyright (c) 2022 Intel Corporation +# Copyright (c) 2024 Intel Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,6 +14,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. + from GenAIEval.evaluation.lm_evaluation_harness import evaluate, setup_parser diff --git a/GenAIEval/evaluation/lm_evaluation_harness/lm_eval/__init__.py b/GenAIEval/evaluation/lm_evaluation_harness/lm_eval/__init__.py index 369707c0..1e8078e9 100644 --- a/GenAIEval/evaluation/lm_evaluation_harness/lm_eval/__init__.py +++ b/GenAIEval/evaluation/lm_evaluation_harness/lm_eval/__init__.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Copyright (c) 2022 Intel Corporation +# Copyright (c) 2024 Intel Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/GenAIEval/evaluation/lm_evaluation_harness/lm_eval/evaluator.py b/GenAIEval/evaluation/lm_evaluation_harness/lm_eval/evaluator.py index 37797572..59a884de 100644 --- a/GenAIEval/evaluation/lm_evaluation_harness/lm_eval/evaluator.py +++ b/GenAIEval/evaluation/lm_evaluation_harness/lm_eval/evaluator.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Copyright (c) 2022 Intel Corporation +# Copyright (c) 2024 Intel Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,6 +14,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. + import itertools import logging import random diff --git a/GenAIEval/evaluation/lm_evaluation_harness/lm_eval/models/__init__.py b/GenAIEval/evaluation/lm_evaluation_harness/lm_eval/models/__init__.py index 3450411c..52a95789 100644 --- a/GenAIEval/evaluation/lm_evaluation_harness/lm_eval/models/__init__.py +++ b/GenAIEval/evaluation/lm_evaluation_harness/lm_eval/models/__init__.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Copyright (c) 2022 Intel Corporation +# Copyright (c) 2024 Intel Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,6 +14,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. + from . import huggingface # TODO: implement __all__ diff --git a/GenAIEval/evaluation/lm_evaluation_harness/lm_eval/models/huggingface.py b/GenAIEval/evaluation/lm_evaluation_harness/lm_eval/models/huggingface.py index 2d7ed3c9..90e2e3a5 100644 --- a/GenAIEval/evaluation/lm_evaluation_harness/lm_eval/models/huggingface.py +++ b/GenAIEval/evaluation/lm_evaluation_harness/lm_eval/models/huggingface.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Copyright (c) 2022 Intel Corporation +# Copyright (c) 2024 Intel Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,6 +14,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. + import copy import json import os diff --git a/README.md b/README.md index 68744fe1..2fd8f7a2 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ python main.py \ ``` #### function call usage ```python -from GenAIEval.evaluation.lm_evaluation_harness import evaluate, LMEvalParser +from GenAIEval.evaluation.lm_evaluation_harness import LMEvalParser, evaluate args = LMevalParser( model="hf", @@ -63,11 +63,11 @@ python main.py \ --tasks "humaneval" \ --n_samples 100 \ --batch_size 10 \ - --allow_code_execution \ + --allow_code_execution ``` #### function call usage ```python -from GenAIEval.evaluation.bigcode_evaluation_harness import evaluate, BigcodeEvalParser +from GenAIEval.evaluation.bigcode_evaluation_harness import BigcodeEvalParser, evaluate args = BigcodeEvalParser( user_model=user_model, diff --git a/setup.py b/setup.py index 6bc8d4bf..8b424326 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Copyright (c) 2022 Intel Corporation +# Copyright (c) 2024 Intel Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,6 +14,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. + import subprocess from setuptools import find_packages, setup diff --git a/tests/test_bigcode_eval.py b/tests/test_bigcode_eval.py index 6df8e5c7..d57e8a51 100644 --- a/tests/test_bigcode_eval.py +++ b/tests/test_bigcode_eval.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Copyright (c) 2022 Intel Corporation +# Copyright (c) 2024 Intel Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,6 +14,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. + import unittest from transformers import AutoModelForCausalLM, AutoTokenizer diff --git a/tests/test_lm_eval.py b/tests/test_lm_eval.py index 3dd39d7c..c5e49e14 100644 --- a/tests/test_lm_eval.py +++ b/tests/test_lm_eval.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Copyright (c) 2022 Intel Corporation +# Copyright (c) 2024 Intel Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,6 +14,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. + import unittest from transformers import AutoModelForCausalLM, AutoTokenizer