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

Colab: When Imports and Definitions Failed #151

Closed
andywolf-0921 opened this issue May 2, 2024 · 7 comments
Closed

Colab: When Imports and Definitions Failed #151

andywolf-0921 opened this issue May 2, 2024 · 7 comments

Comments

@andywolf-0921
Copy link

andywolf-0921 commented May 2, 2024

colab url
2024/4/29 11:29 +08:00 is working
2024/5/2 16:50 +08:00 is not working
The output is the below.

step 1, full output: MT3 - Setup Environment - output.txt
step 2, full output: MT3 - Imports and Definitions - output.txt

step 1, screenshot:
屏幕截图2024 05 02_23 55 11
step 2, screenshot:
屏幕截图2024 05 02_23 54 51
TypeError: register_with_handler() got an unexpected keyword argument 'for_restore'
The command import tensorflow.compat.v2 and t5x both failed.
Anyone face the issue, and how to fix it, thanks.

@andywolf-0921 andywolf-0921 changed the title Colab: no longer working Colab: When Imports and Definitions Failed May 3, 2024
@jmuru
Copy link

jmuru commented May 4, 2024

same issue

@0xdevalias
Copy link

0xdevalias commented May 12, 2024

This is the error I got:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
[<ipython-input-2-30d8629039fb>](https://localhost:8080/#) in <cell line: 16>()
     14 import seqio
     15 import t5
---> 16 import t5x
     17 
     18 from mt3 import metrics_utils

3 frames
[/usr/local/lib/python3.10/dist-packages/t5x/checkpoints.py](https://localhost:8080/#) in <module>
   2076 
   2077 
-> 2078 @ocp.args.register_with_handler(
   2079     DatasetCheckpointHandler, for_save=True, for_restore=True
   2080 )

TypeError: register_with_handler() got an unexpected keyword argument 'for_restore'
  • https://github.com/google-research/t5x
    • T5X is a modular, composable, research-friendly framework for high-performance, configurable, self-service training, evaluation, and inference of sequence models (starting with language) at many scales.

This is where that line of code appears to be in t5x:

@ocp.args.register_with_handler(
    DatasetCheckpointHandler, for_save=True, for_restore=True
)

ocp is imported from orbax.checkpoint:

import orbax.checkpoint as ocp

ChatGPT explanation:

The @ocp.args.register_with_handler is a decorator provided by the orbax.checkpoint module. This particular decorator is used to register a function or a method with a specific handler, in this case, DatasetCheckpointHandler, with parameters indicating it should be used both for saving (for_save=True) and restoring (for_restore=True). The function or method that would be decorated with this would then be associated with those operations related to saving and restoring datasets within the context defined by Orbax, typically a framework for managing operations in machine learning workflows.

From the colab dependencies install logs:

Collecting t5x@ git+https://github.com/google-research/t5x#egg=t5x (from mt3==0.0.1)
  Cloning https://github.com/google-research/t5x to /tmp/pip-install-rjz7xbnz/t5x_d0982f5011f24beea4d9d45972477f10
  Running command git clone --filter=blob:none --quiet https://github.com/google-research/t5x /tmp/pip-install-rjz7xbnz/t5x_d0982f5011f24beea4d9d45972477f10
  Resolved https://github.com/google-research/t5x to commit e84aab9a14be816beae651314217e39fc419fea8
  Preparing metadata (setup.py) ... done

..snip..

Requirement already satisfied: orbax-checkpoint in /usr/local/lib/python3.10/dist-packages (from flax@ git+https://github.com/google/flax#egg=flax->mt3==0.0.1) (0.4.4)

See also:

@Apple-jun
Copy link

same issue. could anyone help? would greatly appreciate any help.

@0xdevalias
Copy link

It seems like upstream was broken, as per this issue:

Within that issue, they mention that the commit before the one they mentioned seemed to work; so presumably this could be fixed by forcing that package to the version before the error was introduced (and then potentially any related dependencies/etc)

@garzon
Copy link

garzon commented May 21, 2024

!pip install --upgrade orbax-checkpoint==0.5.8 works as a workaround for me.

@0xdevalias
Copy link

0xdevalias commented May 23, 2024

Not sure if this is relevant/related, but when I was applying this fix/workaround:

!pip install --upgrade orbax-checkpoint==0.5.8 works as a workaround for me.

Originally posted by @garzon in #151 (comment)

I got the following error:

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
tensorflow 2.15.0 requires ml-dtypes~=0.2.0, but you have ml-dtypes 0.4.0 which is incompatible.
tensorflow-cpu 2.15.0.post1 requires ml-dtypes~=0.2.0, but you have ml-dtypes 0.4.0 which is incompatible.
Successfully installed ml-dtyp

Documenting here in case it is relevant.


After that fix, now getting a new issue unfortunately:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
[<ipython-input-6-689ff6dbf16f>](https://localhost:8080/#) in <cell line: 25>()
     23 note_seq.play_sequence(est_ns, synth=note_seq.fluidsynth,
     24                        sample_rate=SAMPLE_RATE, sf2_path=SF2_PATH)
---> 25 note_seq.plot_sequence(est_ns)

2 frames
[/usr/local/lib/python3.10/dist-packages/bokeh/core/has_props.py](https://localhost:8080/#) in _raise_attribute_error_with_matches(self, name, properties)
    373             matches, text = sorted(properties), "possible"
    374 
--> 375         raise AttributeError(f"unexpected attribute {name!r} to {self.__class__.__name__}, {text} attributes are {nice_join(matches)}")
    376 
    377     def __str__(self) -> str:

AttributeError: unexpected attribute 'plot_width' to figure, similar attributes are outer_width, width or min_width

Which seems to be at least these 2 issues:

Edit: And you can see my exploration, the upstream issue, and a workaround; here:

@iansimon
Copy link
Contributor

Sorry about the lack of activity! Colab should be fixed now...

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

No branches or pull requests

6 participants