Skip to content
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

Remove np.bool which is not supported in latest np versions #1558

Merged
merged 2 commits into from
Oct 23, 2023

Conversation

Louis-Dupont
Copy link
Contributor

@Louis-Dupont Louis-Dupont commented Oct 22, 2023

Issue

Exception when using SG with numpy==1.25.2

    (torch.bool, np.bool),
../../../../miniconda3/envs/louis-dev/lib/python3.8/site-packages/numpy/__init__.py:305: in __getattr__
    raise AttributeError(__former_attrs__[attr])
E   AttributeError: module 'numpy' has no attribute 'bool'.
E   `np.bool` was a deprecated alias for the builtin `bool`. To avoid this error in existing code, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here.
E   The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
E       https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations

Proposed solution

(torch.bool, np.bool), -> (torch.bool, bool),

@Louis-Dupont Louis-Dupont marked this pull request as ready for review October 22, 2023 08:59
@Louis-Dupont Louis-Dupont changed the title fix Remove np.bool which is not supported in latest np versions Oct 22, 2023
@shaydeci
Copy link
Collaborator

Issue

Exception when using SG with numpy==1.25.2

    (torch.bool, np.bool),
../../../../miniconda3/envs/louis-dev/lib/python3.8/site-packages/numpy/__init__.py:305: in __getattr__
    raise AttributeError(__former_attrs__[attr])
E   AttributeError: module 'numpy' has no attribute 'bool'.
E   `np.bool` was a deprecated alias for the builtin `bool`. To avoid this error in existing code, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here.
E   The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
E       https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations

Proposed solution

(torch.bool, np.bool), -> (torch.bool, bool),

Our requirement is numpy<=1.23.
Did you check compatibility ?

@Louis-Dupont
Copy link
Contributor Author

I tried with numpy==1.25 and numpy==1.17, both work.
np.ndarray.astype(bool) works in both versions, but they removed np.ndarray.astype(np.bool) and I don't see a reason to keep using it

Copy link
Collaborator

@BloodAxe BloodAxe left a comment

Choose a reason for hiding this comment

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

LGTM

@Louis-Dupont Louis-Dupont merged commit 8a1d255 into master Oct 23, 2023
7 checks passed
@Louis-Dupont Louis-Dupont deleted the hotfix/SG-000-remove_npbool branch October 23, 2023 08:29
BloodAxe pushed a commit that referenced this pull request Oct 26, 2023
Co-authored-by: Eugene Khvedchenya <ekhvedchenya@gmail.com>
(cherry picked from commit 8a1d255)
BloodAxe added a commit that referenced this pull request Oct 26, 2023
* [Improvement] max_batches support to training log and tqdm progress bar. (#1554)

* Added max_batches support to training log and tqdm progress bar.

* Added changing string in accordance which parameter is used (len(loader) of max_batches)

* Replaced stopping condition for the epoch with a smaller one

(cherry picked from commit 749a9c7)

* fix (#1558)

Co-authored-by: Eugene Khvedchenya <ekhvedchenya@gmail.com>
(cherry picked from commit 8a1d255)

* fix (#1564)

(cherry picked from commit 24798b0)

* Bugfix of model.export() to work correct with bs>1 (#1551)

(cherry picked from commit 0515496)

* Fixed incorrect automatic variable used (#1565)

$@ is the name of the target being generated, and $^ are the dependencies

Co-authored-by: Louis-Dupont <35190946+Louis-Dupont@users.noreply.github.com>
(cherry picked from commit 43f8bea)

* fix typo in class documentation (#1548)

Co-authored-by: Eugene Khvedchenya <ekhvedchenya@gmail.com>
Co-authored-by: Louis-Dupont <35190946+Louis-Dupont@users.noreply.github.com>
(cherry picked from commit ec21383)

* Feature/sg 1198 mixed precision automatically changed with warning (#1567)

* fix

* work with tmpdir

* minor change of comment

* improve device_config

(cherry picked from commit 34fda6c)

* Fixed issue with torch 1.12 where _scale_fn_ref is missing in CyclicLR (#1575)

(cherry picked from commit 23b4f7a)

* Fixed issue with torch 1.12 issue with arange not supporting fp16 for CPU device. (#1574)

(cherry picked from commit 1f15c76)

---------

Co-authored-by: hakuryuu96 <marchenkophilip@gmail.com>
Co-authored-by: Louis-Dupont <35190946+Louis-Dupont@users.noreply.github.com>
Co-authored-by: Alessandro Ros <aler9.dev@gmail.com>
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.

None yet

3 participants