-
Notifications
You must be signed in to change notification settings - Fork 24
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 #190 from stanford-oval/wip/cuda-error
Catch cuda runtime errors
- Loading branch information
Showing
3 changed files
with
84 additions
and
38 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,7 +52,6 @@ jobs: | |
script: | ||
- bash ./tests/test_kfserver.sh | ||
|
||
|
||
deploy: | ||
provider: pypi | ||
username: __token__ | ||
|
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,40 @@ | ||
#!/usr/bin/env bash | ||
|
||
. ./tests/lib.sh | ||
|
||
i=0 | ||
# test kfserver | ||
for hparams in \ | ||
"--model TransformerSeq2Seq --pretrained_model sshleifer/bart-tiny-random" ; | ||
do | ||
|
||
# train | ||
genienlp train --train_tasks almond --train_batch_tokens 100 --val_batch_size 100 --train_iterations 2 --preserve_case --save_every 2 --log_every 2 --val_every 2 --save $workdir/model_$i --data $SRCDIR/dataset/ $hparams --exist_ok --skip_cache --embeddings $EMBEDDING_DIR --no_commit | ||
|
||
# generate a long sequence | ||
long_sequence='' | ||
set +x | ||
for j in {1..2000}; | ||
do | ||
long_sequence="${long_sequence} XXX" | ||
done | ||
set -x | ||
|
||
# test cuda errors | ||
input="{\"id\": \"test\", \"context\": \"${long_sequence}\", \"question\": \"translate to thingtalk\", \"answer\": \"YYY\"}" | ||
set +e | ||
echo ${input} | genienlp server --path $workdir/model_$i --stdin | ||
exit_code=$? | ||
set -e | ||
|
||
if [ $exit_code != 100 ] ; then | ||
echo "Cuda error not caught!" | ||
exit 1 | ||
fi | ||
|
||
rm -rf $workdir/model_$i | ||
i=$((i+1)) | ||
done | ||
|
||
rm -fr $workdir | ||
rm -rf $SRCDIR/torch-shm-file-* |