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

04_01_gan_camel_train.ipynb getting "TypeError: cannot pickle '_thread.RLock' object" #89

Open
rohan-paul opened this issue Jun 30, 2021 · 0 comments

Comments

@rohan-paul
Copy link

rohan-paul commented Jun 30, 2021

In file 04_01_gan_camel_train.ipynb the following code block gives error

gan.train(     
    x_train
    , batch_size = BATCH_SIZE
    , epochs = EPOCHS
    , run_folder = RUN_FOLDER
    , print_every_n_batches = PRINT_EVERY_N_BATCHES
)

Getting TypeError: cannot pickle '_thread.RLock' object

I have tried to implement the changes from this PR by changing the GAN.py per this PR. But still getting the same error.

Specifically, even though I am deleting this below line

pkl.dump(self, open(os.path.join(run_folder, "obj.pkl"), "wb"))

Still, the file obj.pkl (of 0 bytes) is getting generated and producing this error.

Same error coming on the tensorflow_2 branch.

For helping with possible sources of the problem, refer this Stackoverflow link, which says

Generally pickle has problems saving ml model weights for pytorch, tensorflow and keras. To save your keras model, check out their tutorials

specifically, try using the functions save and load_module in keras:

model.save('path/to/location')
reconstructed_model = keras.models.load_model("path/to/location")
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

1 participant