Skip to content

Conversation

@lhoestq
Copy link
Member

@lhoestq lhoestq commented Jun 23, 2022

There are some warnings in the CI that are annoying, I tried to remove most of them

@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Jun 23, 2022

The documentation is not available anymore as the PR was closed or merged.

Copy link
Member

@albertvillanova albertvillanova left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot: great to get rid off all warning messages!!!

np_arrays.append(np.array(array))

if np.issubdtype(np_arrays[0].dtype, np.integer) or np_arrays[0].dtype == np.bool:
if np.issubdtype(np_arrays[0].dtype, np.integer) or np_arrays[0].dtype == np.dtype("bool"):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The warning message suggests to use bool instead.

Suggested change
if np.issubdtype(np_arrays[0].dtype, np.integer) or np_arrays[0].dtype == np.dtype("bool"):
if np.issubdtype(np_arrays[0].dtype, np.integer) or np_arrays[0].dtype == bool:

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, and for object as well

from datasets.commands.env import EnvironmentCommand
from datasets.commands.run_beam import RunBeamCommand
from datasets.commands.test import TestCommand
from datasets.commands.test import CLITestCommand
Copy link
Member

@albertvillanova albertvillanova Jun 24, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are preceding with CLI only the TestCommand; i.e. the rest of the command names are not preceded by CLI.

IMHO, either all or none should be preceded by CLI.

On the other hand, from your commit message, I guess you introduce this modification to prevent pytest default test discovery to identify this class as a test. If this is the reason, I would strongly suggest using testpaths instead: https://docs.pytest.org/en/latest/reference/reference.html#confval-testpaths

  • We tell pytest to search for tests only inside the tests directory
  • Moreover, tests discovery/collection will be faster

I just realized pytest is called with arg ./tests... I did not consider imported classes as possible test candidates, thus I thought pytest was called without arguments and it was searching inside src to find TestCommand. Sorry for the confusion.

Copy link
Member

@albertvillanova albertvillanova Jun 24, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pytest suggests adding the class attribute __test__ = False to TestCommand, but I am not sure if this is better... :/

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went for __test__ = False since it's simpler

Comment on lines 68 to 69
if data_struct.dtype == np.dtype(
"object"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above.

Suggested change
if data_struct.dtype == np.dtype(
"object"
if (
data_struct.dtype == object

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not resolved yet.

Comment on lines 49 to 51
if data_struct.dtype == np.dtype(
"object"
): # pytorch tensors cannot be instantied from an array of objects
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same.

Suggested change
if data_struct.dtype == np.dtype(
"object"
): # pytorch tensors cannot be instantied from an array of objects
if data_struct.dtype == object: # pytorch tensors cannot be instantied from an array of objects

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not resolved yet.

@lhoestq
Copy link
Member Author

lhoestq commented Jun 28, 2022

There is a CI failure only related to the missing content of the universal_dependencies dataset card, we can ignore this failure in this PR

Copy link
Member

@albertvillanova albertvillanova left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some leftovers to be fixed before merging.

from datasets.commands.env import EnvironmentCommand
from datasets.commands.run_beam import RunBeamCommand
from datasets.commands.test import TestCommand
from datasets.commands.test import CLITestCommand
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please note there are still some CLI... leftovers you should fix before merging.

ConvertCommand.register_subcommand(commands_parser)
EnvironmentCommand.register_subcommand(commands_parser)
TestCommand.register_subcommand(commands_parser)
CLITestCommand.register_subcommand(commands_parser)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above...

Comment on lines 68 to 69
if data_struct.dtype == np.dtype(
"object"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not resolved yet.

Comment on lines 49 to 51
if data_struct.dtype == np.dtype(
"object"
): # pytorch tensors cannot be instantied from an array of objects
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not resolved yet.

@lhoestq
Copy link
Member Author

lhoestq commented Jun 28, 2022

good catch, I thought I resolved them all sorry

@lhoestq
Copy link
Member Author

lhoestq commented Jun 28, 2022

Alright it should be good now

Copy link
Member

@albertvillanova albertvillanova left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!!!

@lhoestq lhoestq merged commit f85a78d into master Jun 28, 2022
@lhoestq lhoestq deleted the fix-some-warnings branch June 28, 2022 13:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants