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

Can't load model #3

Open
livkx opened this issue Oct 1, 2022 · 3 comments
Open

Can't load model #3

livkx opened this issue Oct 1, 2022 · 3 comments

Comments

@livkx
Copy link

livkx commented Oct 1, 2022

On latest version when I try run stepmania_note_generator.py I get the following:

PS C:\dev\StepCOVNet-master> python stepmania_note_generator.py -i test_in -o test_out --model dataset\time2_challenge_timing_model -v 1
Loading StepCOVNet retrained model
Failed to retrieve retrained StepCOVNet model. Loading non-retrained model
Traceback (most recent call last):
  File "C:\dev\StepCOVNet-master\stepmania_note_generator.py", line 155, in <module>
    stepmania_note_generator(args.input,
  File "C:\dev\StepCOVNet-master\stepmania_note_generator.py", line 124, in stepmania_note_generator
    stepcovnet_model = StepCOVNetModel.load(input_path=model_path, retrained=False)
  File "C:\dev\StepCOVNet-master\stepcovnet\model\StepCOVNetModel.py", line 40, in load
    model = load_model(model_path, compile=compile_model)
  File "C:\Users\georg\AppData\Roaming\Python\Python39\site-packages\keras\utils\traceback_utils.py", line 70, in error_handler
    raise e.with_traceback(filtered_tb) from None
  File "C:\Users\georg\AppData\Roaming\Python\Python39\site-packages\tensorflow\python\util\nest.py", line 573, in assert_same_structure
    raise type(e)("%s\n"
ValueError: The two structures don't have the same nested structure.

First structure: type=tuple str=(({'input_ids': TensorSpec(shape=(None, 5), dtype=tf.int32, name=None)}, None, None, None, None, None, None, None, None, None, None, None, None, False), {})

Second structure: type=tuple str=((TensorSpec(shape=(None, None), dtype=tf.int32, name='input_ids'), None, TensorSpec(shape=(None, None), dtype=tf.int32, name='attention_mask'), None, None, None, None, None, None, None, None, None, None, False), {})

More specifically: Substructure "type=dict str={'input_ids': TensorSpec(shape=(None, 5), dtype=tf.int32, name=None)}" is a sequence, while substructure "type=TensorSpec str=TensorSpec(shape=(None, None), dtype=tf.int32, name='input_ids')" is not
Entire first structure:
(({'input_ids': .}, ., ., ., ., ., ., ., ., ., ., ., ., .), {})
Entire second structure:
((., ., ., ., ., ., ., ., ., ., ., ., ., .), {})
@D-Vaillant
Copy link

Had this happen to me to, so +1.

@jhaco
Copy link
Collaborator

jhaco commented Nov 29, 2023

@D-Vaillant Could you post your console log for this as well? It's possible that a numpy update broke the np.random.choice function...but if that doesn't sum even remotely close to 1, then something else is amiss.

We should hard define all python dependency versions for that working build we had way back then to prevent future updates from breaking this project @cpuguy96

One of them is Tensorflow 2.10, but I suspect we might need to roll back even further...possibly to Tensorflow 2.6 judging by the last commit message to master

Since Tensorflow 2.6 was released in 2021, any other dependencies used would also need to be before that cutoff year.

@D-Vaillant
Copy link

Yup, here's the full log.

WARNING:tensorflow:Mixed precision compatibility check (mixed_float16): WARNING
The dtype policy mixed_float16 may run slowly because this machine does not have a GPU. Only Nvidia GPUs with compute capability of at least 7.0 run quickly with mixed_float16.
If you will use compatible GPU(s) not attached to this host, e.g. by running a multi-worker model, you can ignore this warning. This message will only be logged once
Traceback (most recent call last):
  File "/Users/david/Personal Documents/NYU Courses/Machine Learning/project/stepmania_convnet/StepCOVNet/stepmania_note_generator.py", line 155, in <module>
    stepmania_note_generator(args.input,
  File "/Users/david/Personal Documents/NYU Courses/Machine Learning/project/stepmania_convnet/StepCOVNet/stepmania_note_generator.py", line 120, in stepmania_note_generator
    stepcovnet_model = StepCOVNetModel.load(input_path=model_path, retrained=True)
  File "/Users/david/Personal Documents/NYU Courses/Machine Learning/project/stepmania_convnet/StepCOVNet/stepcovnet/model/StepCOVNetModel.py", line 40, in load
    model = load_model(model_path, compile=compile_model)
  File "/Users/david/Personal Documents/NYU Courses/Machine Learning/project/stepmania_convnet/StepCOVNet/venv/lib/python3.10/site-packages/keras/utils/traceback_utils.py", line 67, in error_handler
    raise e.with_traceback(filtered_tb) from None
  File "/Users/david/Personal Documents/NYU Courses/Machine Learning/project/stepmania_convnet/StepCOVNet/venv/lib/python3.10/site-packages/tensorflow/python/util/nest.py", line 572, in assert_same_structure
    raise type(e)("%s\n"
ValueError: The two structures don't have the same nested structure.

First structure: type=tuple str=(({'attention_mask': TensorSpec(shape=(None, None), dtype=tf.int32, name=None), 'input_ids': TensorSpec(shape=(None, None), dtype=tf.int32, name=None)}, None, None, None, None, None, None, None, None, None, None, None, None, False), {})

Second structure: type=tuple str=((TensorSpec(shape=(None, None), dtype=tf.int32, name='input_ids'), None, TensorSpec(shape=(None, None), dtype=tf.int32, name='attention_mask'), None, None, None, None, None, None, None, None, None, None, False), {})

More specifically: Substructure "type=dict str={'attention_mask': TensorSpec(shape=(None, None), dtype=tf.int32, name=None), 'input_ids': TensorSpec(shape=(None, None), dtype=tf.int32, name=None)}" is a sequence, while substructure "type=TensorSpec str=TensorSpec(shape=(None, None), dtype=tf.int32, name='input_ids')" is not
Entire first structure:
(({'attention_mask': ., 'input_ids': .}, ., ., ., ., ., ., ., ., ., ., ., ., .), {})
Entire second structure:
((., ., ., ., ., ., ., ., ., ., ., ., ., .), {})

Also uploading my currently installed library versions.
installed.txt

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

3 participants