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

AttributeError: 'PrefetchDataset' object has no attribute 'make_one_shot_iterator' #115

Open
boobootoo2 opened this issue Feb 27, 2021 · 2 comments

Comments

@boobootoo2
Copy link

boobootoo2 commented Feb 27, 2021

I get this error when running

/scripts/run_train.sh "./exp/my_experiment/" "0"

To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags. Traceback (most recent call last): File "/Users/jgs/Projects/python/musegan/scripts/../src/train.py", line 348, in <module> main() File "/Users/jgs/Projects/python/musegan/scripts/../src/train.py", line 172, in main train_x, _ = load_training_data(params, config) File "/Users/jgs/Projects/python/musegan/scripts/../src/train.py", line 105, in load_training_data train_x, train_y = dataset.make_one_shot_iterator().get_next(), None AttributeError: 'PrefetchDataset' object has no attribute 'make_one_shot_iterator' (jupyter) bash-3.2$

I read this issue thread for Tensorflow. Maybe this script needs refactoring for current version of tensorflow? Or maybe I need to use an older version of Tensorflow?
tensorflow/tensorflow#29252

@ruscot
Copy link

ruscot commented Sep 18, 2021

I had the same issue, to solve I replace the lane like this :
Last code :

    if params['is_conditional']:
        train_x, train_y = dataset.make_one_shot_iterator().get_next()
    else:
        train_x, train_y = dataset.make_one_shot_iterator().get_next(), None

New code :

    if params['is_conditional']:
        train_x, train_y = tf.compat.v1.data.make_one_shot_iterator(dataset).get_next()
    else:
        train_x, train_y = tf.compat.v1.data.make_one_shot_iterator(dataset).get_next(), None

@ruscot
Copy link

ruscot commented Sep 18, 2021

But it seems to have other issue due to tensorflow update.... A refactoring seems necessary no ?

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

2 participants