-
Notifications
You must be signed in to change notification settings - Fork 615
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add error message checks #3371
Add error message checks #3371
Conversation
Signed-off-by: Rafal <Banas.Rafal97@gmail.com>
# source provided, so we don't have valid placeholder | ||
yield check_disallowed_es, {'name': 'a', 'source': []}, {'a': in_dataset} | ||
# misnamed placeholder | ||
yield check_disallowed_es, {'name': 'b'}, {'a': in_dataset} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one is already covered on L260
|
||
pipeline = get_image_pipeline(batch_size, num_threads, 'gpu', 0) | ||
|
||
with tf.device('/cpu:0'): | ||
dataset = get_dali_dataset_from_pipeline( | ||
pipeline, batch_size, num_threads, 'cpu', 0) | ||
dataset = get_dali_dataset_from_pipeline(pipeline, 'cpu', 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
|
||
@pipeline_def(batch_size=10, num_threads=4, device_id=0) | ||
def es_pipe(kwargs): | ||
return fn.external_source(**kwargs) | ||
|
||
|
||
@raises(Exception) | ||
def check_disallowed_es(kwargs, input_datasets): | ||
# @raises(Exception) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
leftover - removed
@@ -35,7 +37,10 @@ def test_tf_dataset_cpu(): | |||
run_tf_dataset_eager_mode('cpu') | |||
|
|||
# Return differently sized images to check if DALIDataset can handle this case gracefully | |||
@raises(tf.errors.FailedPreconditionError) | |||
@raises(tf.errors.FailedPreconditionError, glob='*Batch output at index * from DALI pipeline is not uniform - individual ' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can remove leading and trailing *
from glob pattern. They are not needed, as glob to regexp converted we use adds them automatically.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can skip most of the message and only match relevant fragments, making some slack for future adjustment of the error messages.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed all the leading and trailing * and shortened the patterns to the essential parts.
def test_set_outputs(): | ||
data = [[[np.random.rand(1, 3, 2)], [np.random.rand(1, 4, 5)]]] | ||
pipe = Pipeline(batch_size = 1, num_threads = 1, device_id = None) | ||
pipe.set_outputs(fn.external_source(data, num_outputs = 2, cycle = 'quiet')) | ||
assert_raises(TypeError, pipe.build) | ||
pipe.build() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would stick to checking if the build
step raises that error, not any other one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -12,6 +12,7 @@ | |||
# See the License for the specific language governing permissions and | |||
# limitations under the License. | |||
|
|||
from nose.tools.nontrivial import raises |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove. That's probably VSCode's doing - it keeps doing it to me all the time :\
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed
@@ -150,7 +151,7 @@ def test_pad_error(): | |||
align=align, shape_arg=shape_arg, layout=layout) | |||
|
|||
pipe.build() | |||
assert_raises(RuntimeError, pipe.run) | |||
pipe.run() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would keep this check here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
def test_wrong_length_sequence_videopipeline(): | ||
pipe = VideoPipe(batch_size=BATCH_SIZE, data=VIDEO_FILES, sequence_length=100000) | ||
assert_raises(RuntimeError, pipe.build) | ||
pipe.build() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we keep this check here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
list_file.close() | ||
|
||
pipe = VideoPipeList(batch_size=BATCH_SIZE, data=list_file.name) | ||
with assert_raises(RuntimeError, glob='*No files were read'): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would improve video_loader error message in this case as we discussed offline.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As we agreed, the warning about empty range, that is already there, should be enough
yield _test_file_list_invalid_range, r[0], r[1] | ||
|
||
|
||
def test_file_list_empty(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def test_file_list_empty(): | |
def test_file_list_empty_range(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@raises(TypeError, glob='*`input_datasets` must be a dictionary that maps input names (the `name` specified for External ' | ||
'Source node in DALI pipeline) to input datasets objects (`tf.data.Dataset`) or ' | ||
'`nvidia.dali.plugin.tf.experimental.Input` wrapper objects*') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Likewise, you don't have to put the entire message here - and you can skip leading and trailing *.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I shortened the patterns to the essential part
Signed-off-by: Rafal <Banas.Rafal97@gmail.com>
!build |
CI MESSAGE: [3063756]: BUILD STARTED |
CI MESSAGE: [3063756]: BUILD FAILED |
CI MESSAGE: [3063756]: BUILD PASSED |
Add error message checks and fix some TF tests. Signed-off-by: Rafal <Banas.Rafal97@gmail.com>
Add error message checks and fix some TF tests. Signed-off-by: Rafal <Banas.Rafal97@gmail.com>
Add error message checks and fix some TF tests. Signed-off-by: Rafal <Banas.Rafal97@gmail.com>
Add error message checks and fix some TF tests. Signed-off-by: Rafal <Banas.Rafal97@gmail.com>
Add error message checks and fix some TF tests. Signed-off-by: Rafal <Banas.Rafal97@gmail.com>
Add error message checks and fix some TF tests. Signed-off-by: Rafal <Banas.Rafal97@gmail.com>
Add error message checks and fix some TF tests. Signed-off-by: Rafal <Banas.Rafal97@gmail.com>
Add error message checks and fix some TF tests. Signed-off-by: Rafal <Banas.Rafal97@gmail.com>
Add error message checks and fix some TF tests. Signed-off-by: Rafal <Banas.Rafal97@gmail.com>
Add error message checks and fix some TF tests. Signed-off-by: Rafal <Banas.Rafal97@gmail.com>
Add error message checks and fix some TF tests. Signed-off-by: Rafal <Banas.Rafal97@gmail.com>
Add error message checks and fix some TF tests. Signed-off-by: Rafal <Banas.Rafal97@gmail.com>
Add error message checks and fix some TF tests. Signed-off-by: Rafal <Banas.Rafal97@gmail.com>
Add error message checks and fix some TF tests. Signed-off-by: Rafal <Banas.Rafal97@gmail.com>
Add error message checks and fix some TF tests. Signed-off-by: Rafal <Banas.Rafal97@gmail.com>
Add error message checks and fix some TF tests. Signed-off-by: Rafal <Banas.Rafal97@gmail.com>
Add error message checks and fix some TF tests. Signed-off-by: Rafal <Banas.Rafal97@gmail.com>
Signed-off-by: Rafal Banas.Rafal97@gmail.com
Description
What happened in this PR
Adding error message checks + some test fixes
Additional information
Checklist
Tests
Documentation
DALI team only
Requirements
REQ IDs: N/A
JIRA TASK: N/A