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

[REVIEW]: TypeError in plot_infotopo.py #65

Closed
pitmonticone opened this issue Oct 17, 2024 · 10 comments
Closed

[REVIEW]: TypeError in plot_infotopo.py #65

pitmonticone opened this issue Oct 17, 2024 · 10 comments
Assignees
Labels
bug Something isn't working

Comments

@pitmonticone
Copy link
Contributor

When running the example script examples/metrics/plot_infotopo.py I encountered the following error:

TypeError: unsupported type for timedelta seconds component: jaxlib.xla_extension.ArrayImpl

REVIEW ISSUE: REVIEW ISSUE: openjournals/joss-reviews#7360

@EtienneCmb EtienneCmb added the bug Something isn't working label Oct 29, 2024
@EtienneCmb EtienneCmb self-assigned this Oct 29, 2024
@EtienneCmb
Copy link
Collaborator

Thank you for reporting this issue.

October, Jax dropped some internal callback functions that we used to display the progress bar (jax's changelog). I suspect that this error was due to the progress bar. We fixed this issue with commits 38cc6bc and feb9eb7. Tests are now passing for python>=3.8.

Could you please fetch the latest commits, update jax with pip install -U jax and running this example again?

@pitmonticone
Copy link
Contributor Author

Fetched the latest commits and updated jax.

Here is the output:

Copnorm and demean the data
Get list of multiplets
   index  order       hoi           multiplet                                                                
0     72      5  0.182472     [0, 1, 2, 3, 6]
1     35      4  0.181906        [0, 1, 2, 3]
2      0      3  0.181892           [0, 1, 2]
3     37      4  0.181686        [0, 1, 2, 5]
4     38      4  0.181507        [0, 1, 2, 6]
5     84      5 -0.447083     [0, 3, 4, 5, 6]
6     69      4 -0.447269        [3, 4, 5, 6]
7     89      5 -0.453236     [1, 3, 4, 5, 6]
8     97      6 -0.453758  [1, 2, 3, 4, 5, 6]
9     95      6 -0.454479  [0, 1, 3, 4, 5, 6]
Compute entropy with gc
    Copnorm and demean the data
Get list of multiplets
Get list of multiplets                                                                                       
Traceback (most recent call last):
  File "/Users/pietromonticone/GitHub/hoi/examples/metrics/plot_infotopo.py", line 99, in <module>
    hoi = model.fit(minsize=3, method="gc")
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/pietromonticone/GitHub/hoi/.venv/lib/python3.12/site-packages/hoi/metrics/infotopo.py", line 154, in fit
    _, hoi = jax.lax.scan(
             ^^^^^^^^^^^^^
  File "/Users/pietromonticone/GitHub/hoi/.venv/lib/python3.12/site-packages/hoi/utils/progressbar.py", line 62, in wrapper_progress_bar
    _update_progress_bar(iter_num)
  File "/Users/pietromonticone/GitHub/hoi/.venv/lib/python3.12/site-packages/hoi/utils/progressbar.py", line 151, in _update_progress_bar
    _ = jax.jax.lax.cond(
        ^^^^^^^^^^^^^^^^^
  File "/Users/pietromonticone/GitHub/hoi/.venv/lib/python3.12/site-packages/hoi/utils/progressbar.py", line 153, in <lambda>
    lambda _: host_callback.id_tap(
              ^^^^^^^^^^^^^^^^^^^^^
  File "/Users/pietromonticone/GitHub/hoi/.venv/lib/python3.12/site-packages/jax/experimental/host_callback.py", line 27, in call
    raise NotImplementedError(
NotImplementedError: jax.experimental.host_callback has been deprecated since March 2024 and is now no longer supported. See https://github.com/jax-ml/jax/issues/20385
--------------------
For simplicity, JAX has removed its internal frames from the traceback of the following exception. Set JAX_TRACEBACK_FILTERING=off to include these.

@EtienneCmb
Copy link
Collaborator

I believe there's an issue with your update because the latest version of hoi doesn't have the progress bar anymore. Now we rely on the package jax-tqdm. Have you installed hoi using pip or python setup.py?

@pitmonticone
Copy link
Contributor Author

pitmonticone commented Oct 29, 2024

I have installed it in my local .venv using pip install -U hoi.

@pitmonticone
Copy link
Contributor Author

Can you deploy the new version on pypi?

@EtienneCmb
Copy link
Collaborator

Yes, sure, I'll do it tomorrow morning ! I'll let you know once done 👍

@EtienneCmb
Copy link
Collaborator

Hi @pitmonticone , the new version is on pypi

@pitmonticone
Copy link
Contributor Author

Yes, now it works fine:

  Copnorm and demean the data
Get list of multiplets
   index  order       hoi           multiplet                                                                                                                                                                 
0     36      4  0.203451        [0, 1, 2, 4]
1     73      5  0.203430     [0, 1, 2, 4, 5]
2     37      4  0.203373        [0, 1, 2, 5]
3      0      3  0.203372           [0, 1, 2]
4     72      5  0.202888     [0, 1, 2, 3, 6]
5     96      6 -0.420208  [0, 2, 3, 4, 5, 6]
6     84      5 -0.420437     [0, 3, 4, 5, 6]
7     95      6 -0.420715  [0, 1, 3, 4, 5, 6]
8     97      6 -0.421467  [1, 2, 3, 4, 5, 6]
9     89      5 -0.422012     [1, 3, 4, 5, 6]
Compute entropy with gc
    Copnorm and demean the data
Get list of multiplets
Get list of multiplets                                                                                                                                                                                        
Mutual information: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 99/99 [00:00<00:00, 75980.99it/s]
   index  order       hoi     multiplet
0      0      3  0.203372     [0, 1, 2]
1     69      4  0.094784  [3, 4, 5, 6]
2      4      3  0.000405     [0, 1, 6]
3     62      4  0.000385  [1, 3, 4, 6]
4     52      4  0.000381  [0, 3, 4, 6]
5     47      4 -0.000550  [0, 2, 3, 6]
6      8      3 -0.001450     [0, 2, 6]
7     33      3 -0.057861     [3, 5, 6]
8     31      3 -0.060821     [3, 4, 5]
9     32      3 -0.110925     [3, 4, 6]

Sorry for the pedantry, but during review I need to test the user experience.

I will close all the similar issues.

@pitmonticone
Copy link
Contributor Author

pitmonticone commented Oct 30, 2024

I consider this issue resolved.

@EtienneCmb
Copy link
Collaborator

Yes, now it works fine:

  Copnorm and demean the data
Get list of multiplets
   index  order       hoi           multiplet                                                                                                                                                                 
0     36      4  0.203451        [0, 1, 2, 4]
1     73      5  0.203430     [0, 1, 2, 4, 5]
2     37      4  0.203373        [0, 1, 2, 5]
3      0      3  0.203372           [0, 1, 2]
4     72      5  0.202888     [0, 1, 2, 3, 6]
5     96      6 -0.420208  [0, 2, 3, 4, 5, 6]
6     84      5 -0.420437     [0, 3, 4, 5, 6]
7     95      6 -0.420715  [0, 1, 3, 4, 5, 6]
8     97      6 -0.421467  [1, 2, 3, 4, 5, 6]
9     89      5 -0.422012     [1, 3, 4, 5, 6]
Compute entropy with gc
    Copnorm and demean the data
Get list of multiplets
Get list of multiplets                                                                                                                                                                                        
Mutual information: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 99/99 [00:00<00:00, 75980.99it/s]
   index  order       hoi     multiplet
0      0      3  0.203372     [0, 1, 2]
1     69      4  0.094784  [3, 4, 5, 6]
2      4      3  0.000405     [0, 1, 6]
3     62      4  0.000385  [1, 3, 4, 6]
4     52      4  0.000381  [0, 3, 4, 6]
5     47      4 -0.000550  [0, 2, 3, 6]
6      8      3 -0.001450     [0, 2, 6]
7     33      3 -0.057861     [3, 5, 6]
8     31      3 -0.060821     [3, 4, 5]
9     32      3 -0.110925     [3, 4, 6]

Sorry for the pedantry, but during review I need to test the user experience.

I will close all the similar issues.

Great ! No problem, thank you for reporting this !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants