-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #120 from allenai/fix-ci
run tests on Beaker with NFS cache
- Loading branch information
Showing
11 changed files
with
242 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# This Dockerfile is for building an image suitable for running catwalk's tests. | ||
# There are no instruction lines in this Dockerfile that install catwalk. Instead, the entrypoint | ||
# script handles installing catwalk from a particular commit at runtime, based on the environment | ||
# variable "COMMIT_SHA". That way we don't need to rebuild and push the image each time we run | ||
# tests, and we can be sure the dependencies are always up-to-date. | ||
# | ||
# To rebuild and push this image to Beaker, run 'make docker-testing'. | ||
|
||
FROM ghcr.io/allenai/pytorch:1.13.0-cuda11.6-python3.9 | ||
|
||
COPY scripts/entrypoint.sh /entrypoint.sh | ||
RUN chmod +x /entrypoint.sh | ||
|
||
WORKDIR /testing | ||
|
||
ENTRYPOINT ["/entrypoint.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/bin/bash | ||
|
||
# Exit script if any commands fail. | ||
set -e | ||
set -o pipefail | ||
|
||
# Check that the environment variable has been set correctly | ||
if [ -z "$COMMIT_SHA" ]; then | ||
echo >&2 'error: missing COMMIT_SHA environment variable' | ||
exit 1 | ||
fi | ||
|
||
# Upgrade pip | ||
/opt/conda/bin/pip install --upgrade pip | ||
|
||
# Clone and install catwalk. | ||
git clone https://github.com/allenai/catwalk.git | ||
cd catwalk | ||
git checkout --quiet "$COMMIT_SHA" | ||
/opt/conda/bin/pip install --no-cache-dir '.[dev]' | ||
|
||
# Create directory for results. | ||
mkdir -p /results | ||
|
||
# Execute the arguments to this script as commands themselves, piping output into a log file. | ||
exec "$@" 2>&1 | tee /results/out.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,33 @@ | ||
import sys | ||
|
||
import pytest | ||
|
||
import catwalk.__main__ | ||
from catwalk.steps import PredictStep, CalculateMetricsStep | ||
from catwalk.steps import CalculateMetricsStep, PredictStep | ||
|
||
from .util import suite_C | ||
|
||
|
||
@suite_C | ||
def test_squad(): | ||
args = catwalk.__main__._parser.parse_args([ | ||
"--model", "bert-base-uncased", | ||
"--task", "squad", | ||
"--split", "validation", | ||
"--limit", "100" | ||
]) | ||
args = catwalk.__main__._parser.parse_args( | ||
[ | ||
"--model", | ||
"bert-base-uncased", | ||
"--task", | ||
"squad", | ||
"--split", | ||
"validation", | ||
"--limit", | ||
"100", | ||
] | ||
) | ||
catwalk.__main__.main(args) | ||
|
||
|
||
@pytest.mark.parametrize("task", ["mnli", "cola", "rte"]) | ||
@suite_C | ||
def test_gpt2_performance(task: str): | ||
model = "rc::gpt2" | ||
predictions = PredictStep(model=model, task=task, limit=100) | ||
metrics = CalculateMetricsStep(model=model, task=task, predictions=predictions) | ||
results = metrics.result() | ||
assert results['relative_improvement'] > 0 | ||
assert results["relative_improvement"] > 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.