Datasets:

Modalities:
Tabular
Text
Formats:
json
Size:
< 1K
ArXiv:
DOI:
Libraries:
Datasets
Dask
File size: 9,798 Bytes
643999a
1
{"language": "Python", "id": 96, "repo_owner": "mosaicml", "repo_name": "composer", "head_branch": "error_logging_callback", "workflow_name": "Smoketest", "workflow_filename": "smoketest.yaml", "workflow_path": ".github/workflows/smoketest.yaml", "contributor": "bmosaicml", "sha_fail": "4410203c56984c613d23f29a81ecd1b96c57b1ee", "sha_success": "e4eb7eeac2e76c3287bdd650407e4067ad3a7625", "workflow": "name: Smoketest\non:\n  push:\n    branches:\n      - dev\n      - main\n      - release/**\n  pull_request:\n  workflow_call:\n  workflow_dispatch:\n# Cancel old runs when a new commit is pushed to the same branch if not on main or dev\nconcurrency:\n  group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}\n  cancel-in-progress: ${{ github.ref != 'refs/heads/main' && github.ref != 'refs/heads/dev' }}\ndefaults:\n  run:\n    working-directory: .\njobs:\n  smoketest:\n    runs-on: ubuntu-20.04\n    timeout-minutes: 10\n    strategy:\n      matrix:\n        python_version:\n          - \"3.8\"\n          - \"3.9\"\n          - \"3.10\"\n    steps:\n      - uses: actions/checkout@v3\n      - uses: actions/setup-python@v4\n        with:\n          python-version: ${{ matrix.python_version }}\n      - name: Setup\n        run: |\n          set -ex\n          python -m pip install --upgrade 'pip<23' wheel\n          python -m pip install --upgrade .\n          python -m pip install pytest==7.2.1 pytest_codeblocks==0.16.1\n      - name: Run checks\n        run: |\n          pytest tests/test_smoketest.py\n", "logs": [{"step_name": "smoketest (3.8)/5_Run checks.txt", "log": "##[group]Run pytest tests/test_smoketest.py\n\u001b[36;1mpytest tests/test_smoketest.py\u001b[0m\nshell: /usr/bin/bash -e {0}\nenv:\n  pythonLocation: /opt/hostedtoolcache/Python/3.8.18/x64\n  PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.8.18/x64/lib/pkgconfig\n  Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.8.18/x64\n  Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.8.18/x64\n  Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.8.18/x64\n  LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.8.18/x64/lib\n##[endgroup]\nImportError while loading conftest '/home/runner/work/composer/composer/tests/conftest.py'.\ntests/conftest.py:9: in <module>\n    from composer.utils import reproducibility\ncomposer/__init__.py:10: in <module>\n    from composer.trainer import Trainer\ncomposer/trainer/__init__.py:6: in <module>\n    from composer.trainer.trainer import Trainer\ncomposer/trainer/trainer.py:37: in <module>\n    from composer.callbacks import CheckpointSaver, OptimizerMonitor\ncomposer/callbacks/__init__.py:12: in <module>\n    from composer.callbacks.eval_output_logging_callback import EvalOutputLogging\ncomposer/callbacks/eval_output_logging_callback.py:16: in <module>\n    from composer.datasets.in_context_learning_evaluation import (InContextLearningCodeEvalDataset,\ncomposer/datasets/in_context_learning_evaluation.py:13: in <module>\n    import transformers\nE   ModuleNotFoundError: No module named 'transformers'\n##[error]Process completed with exit code 4.\n"}, {"step_name": "smoketest (3.9)/5_Run checks.txt", "log": "##[group]Run pytest tests/test_smoketest.py\n\u001b[36;1mpytest tests/test_smoketest.py\u001b[0m\nshell: /usr/bin/bash -e {0}\nenv:\n  pythonLocation: /opt/hostedtoolcache/Python/3.9.18/x64\n  PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.9.18/x64/lib/pkgconfig\n  Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.9.18/x64\n  Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.9.18/x64\n  Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.9.18/x64\n  LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.9.18/x64/lib\n##[endgroup]\nImportError while loading conftest '/home/runner/work/composer/composer/tests/conftest.py'.\ntests/conftest.py:9: in <module>\n    from composer.utils import reproducibility\ncomposer/__init__.py:10: in <module>\n    from composer.trainer import Trainer\ncomposer/trainer/__init__.py:6: in <module>\n    from composer.trainer.trainer import Trainer\ncomposer/trainer/trainer.py:37: in <module>\n    from composer.callbacks import CheckpointSaver, OptimizerMonitor\ncomposer/callbacks/__init__.py:12: in <module>\n    from composer.callbacks.eval_output_logging_callback import EvalOutputLogging\ncomposer/callbacks/eval_output_logging_callback.py:16: in <module>\n    from composer.datasets.in_context_learning_evaluation import (InContextLearningCodeEvalDataset,\ncomposer/datasets/in_context_learning_evaluation.py:13: in <module>\n    import transformers\nE   ModuleNotFoundError: No module named 'transformers'\n##[error]Process completed with exit code 4.\n"}, {"step_name": "smoketest (3.10)/5_Run checks.txt", "log": "##[group]Run pytest tests/test_smoketest.py\n\u001b[36;1mpytest tests/test_smoketest.py\u001b[0m\nshell: /usr/bin/bash -e {0}\nenv:\n  pythonLocation: /opt/hostedtoolcache/Python/3.10.13/x64\n  PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.10.13/x64/lib/pkgconfig\n  Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.10.13/x64\n  Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.10.13/x64\n  Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.10.13/x64\n  LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.10.13/x64/lib\n##[endgroup]\nImportError while loading conftest '/home/runner/work/composer/composer/tests/conftest.py'.\ntests/conftest.py:9: in <module>\n    from composer.utils import reproducibility\ncomposer/__init__.py:10: in <module>\n    from composer.trainer import Trainer\ncomposer/trainer/__init__.py:6: in <module>\n    from composer.trainer.trainer import Trainer\ncomposer/trainer/trainer.py:37: in <module>\n    from composer.callbacks import CheckpointSaver, OptimizerMonitor\ncomposer/callbacks/__init__.py:12: in <module>\n    from composer.callbacks.eval_output_logging_callback import EvalOutputLogging\ncomposer/callbacks/eval_output_logging_callback.py:16: in <module>\n    from composer.datasets.in_context_learning_evaluation import (InContextLearningCodeEvalDataset,\ncomposer/datasets/in_context_learning_evaluation.py:13: in <module>\n    import transformers\nE   ModuleNotFoundError: No module named 'transformers'\n##[error]Process completed with exit code 4.\n"}], "diff": "diff --git a/composer/callbacks/eval_output_logging_callback.py b/composer/callbacks/eval_output_logging_callback.py\nindex 48e4f76d..65cbdebb 100644\n--- a/composer/callbacks/eval_output_logging_callback.py\n+++ b/composer/callbacks/eval_output_logging_callback.py\n@@ -7,7 +7,7 @@ import hashlib\n import os\n import random\n import shutil\n-import time\n+import tempfile\n from typing import Callable, Optional\n \n from torch.utils.data import DataLoader\n@@ -58,6 +58,8 @@ class EvalOutputLogging(Callback):\n         self.hash = hashlib.sha256()\n         self.destination_file = None\n \n+    # with tempfile.NamedTemporaryFile\n+    #  tmp_dir =\n     def _write_tables_to_output_dir(self, state: State):\n         try:\n             import pandas as pd\n@@ -66,16 +68,9 @@ class EvalOutputLogging(Callback):\n                                                 conda_package='pandas',\n                                                 conda_channel='conda-forge') from e\n         # write tmp files\n-        self.hash.update((str(time.time()) + str(random.randint(0, 1_000_000))).encode('utf-8'))\n-        tmp_dir = os.getcwd() + '/' + self.hash.hexdigest()\n-\n-        if not os.path.exists(tmp_dir):\n-            with dist.local_rank_zero_download_and_wait(tmp_dir):\n-                if dist.get_local_rank() == 0:\n-                    os.mkdir(tmp_dir)\n \n         full_df = pd.DataFrame()\n-        file_name = f'eval-outputs-ba{state.timestamp.batch.value}.tsv'\n+        upload_file_name = f'eval-outputs-ba{state.timestamp.batch.value}.tsv'\n \n         for benchmark in self.table:\n             cols, rows = self.table[benchmark]\n@@ -84,18 +79,14 @@ class EvalOutputLogging(Callback):\n             df['benchmark'] = benchmark\n             full_df = pd.concat([full_df, df], ignore_index=True)\n \n-        with dist.local_rank_zero_download_and_wait(f'{tmp_dir}/{file_name}'):\n-            if dist.get_local_rank() == 0:\n-                with open(f'{tmp_dir}/{file_name}', 'wb') as f:\n-                    full_df.to_csv(f, sep='\\t', index=False)\n+        tmp_file = ''\n+        with tempfile.NamedTemporaryFile('wb') as f:\n+            full_df.to_csv(f, sep='\\t', index=False)\n+            tmp_file = f.name\n \n         # copy/upload tmp files\n-        _write(destination_path=f'{self.output_directory}/{file_name}', src_file=f'{tmp_dir}/{file_name}')\n-        os.remove(f'{tmp_dir}/{file_name}')\n-        self.destination_file = f'{self.output_directory}/{file_name}'\n-\n-        # delete tmp files\n-        os.rmdir(tmp_dir)\n+        _write(destination_path=f'{self.output_directory}/{upload_file_name}', src_file=tmp_file)\n+        self.destination_file = f'{self.output_directory}/{upload_file_name}'\n \n     def _prep_response_cache(self, state, cache):\n         benchmark = state.dataloader_label\ndiff --git a/composer/datasets/in_context_learning_evaluation.py b/composer/datasets/in_context_learning_evaluation.py\nindex e1566509..1a53f75c 100644\n--- a/composer/datasets/in_context_learning_evaluation.py\n+++ b/composer/datasets/in_context_learning_evaluation.py\n@@ -10,7 +10,6 @@ import random\n from typing import TYPE_CHECKING, Any, Dict, List, Optional, Union\n \n import torch\n-import transformers\n from torch.utils.data import DataLoader, Dataset\n from tqdm import tqdm\n \n", "difficulty": 1, "changed_files": ["composer/callbacks/eval_output_logging_callback.py", "composer/datasets/in_context_learning_evaluation.py"], "commit_link": "https://github.com/mosaicml/composer/tree/4410203c56984c613d23f29a81ecd1b96c57b1ee"}