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
Resuming from pretrained network checkpoints on CPU fails: unknown Torch class <torch.CudaTensor> #3
Comments
Hey! Thanks for bringing this to my attention; I actually had no idea that CPU users couldn't use the pre-trained models I put up; so sorry about that. I'll make a commit once I get home from work tonight with the converted models. |
Indeed, it would fantastic to obtain the CPU-compatible models ! |
@Caselles Agreed - CPU-compatible models are a must; On my work computer - the conversion script in Kaparthy's repo doesn't run (gives a very strange error)... I think I'm going to try and add the "two-line change" that @JCBrouwer mentioned and see if it runs on a computer with |
@robbiebarrat Did you have the time to progress on the issue? I really want to try out the pretrained models but it is currently not possible for me. |
Sorry - I have been working on this. I keep getting errors when trying to run a generation with the converted model, and recently a very discouraging one
Here; I've uploaded one of the models for you to try. See if it works by running Get the model here and please let me know if you find anything out. In the meantime; I'll keep trying to solve this. https://drive.google.com/open?id=0B-_m9VM1w1bKRnJMZmkzWEVtSDA Also; the script I used for conversion is as follows:
|
Thanks for your work. I tried, and got the same error as you, related to cudnn : It might be too much work, but isn't there a way to convert the code to python ? The problem seems related to torch, I guess with Keras or Tensorflow these problems does not exist. I know it is a lot of work but I assure you that a lot of people would be grateful, since it is VERY HARD to find pre-trained art GANs models. I think this repo would be much more used if it was in python. I'll try to seek answers for the cudnn problem though. Keep us in touch please :) |
It might not be too much work, honestly; python is the language that im most comfortable with, and keras is my favorite library. I just finished converting an old project i wrote in pybrain, of all things, to keras and had great success doing that. I'll keep you updated on the conversion process - I'm a little busy right now since I'm starting to apply to college, so it might take like, two or so weeks, but I feel like it'd definitely be worth it. |
Two or so weeks would be great ! I would really appreciate you doing that. Thanks |
no problem - It'll help me a lot with some art projects I'm doing, too, so it's a win-win |
@Caselles @JCBrouwer Anyways; yeah expect a python rewrite sometime this week(end?) |
Thanks a lot for the update. Do you mean we will have pre-trained models in 256x256 resolution, loadable in python ? This would be really great ! |
Yeah - I plan on making that the case. At my workplace, we have these insane GPU clusters that I'll set the models to train on; so training won't take forever, and once I finish defining the model in keras (i'm making some slight improvements in the architecture), it'll be relatively easy for me to train. Let me know if you have any ideas for a pre-trained GAN you'd like to see included; I'm definitely going to do landscapes and nude portraits, but if you think of anything else you'd like just let me know. |
@robbiebarrat Thanks a ton for working on this! Some more training sets I can think of are: cartoon characters, pixel art, graffiti, space, and psychedelic art. Feel like all of those should have more than enough examples to train on. They could also all be interesting checkpoints to resume from and train with new data. |
Maybe try the flowers dataset too : http://www.robots.ox.ac.uk/~vgg/data/flowers/ I would looove to see the results of a pre trained GAN on flowers that you fine tune on abstract art ! :) |
@JCBrouwer @Caselles The things that jump out at me as really cool ideas is the space gan, and the flowers + abstract fine-tuning GAN. I've been meaning to have a network that can sort of "show off" the whole micro-training-on-a-different-dataset thing I've come up with and flowers sound really good for that... Thanks so much for the suggestions; I'll keep you updated on the progress of the rewrite in the coming week. |
@robbiebarrat Any progress on the rewrite ? :) No hurry, just want to know if you had the time to work on it. |
@Caselles yeah - I've finished pretty much everything except for the network implementation itself (like defining the model in keras, but that shouldn't take long at all). I'll put it up as soon as it's like, presentable with results and stuff, which I think is going to be ~a week from now. By the end of next weekend for sure I'll have something ready to put up. |
Thanks a lot ! Looking forward to try out these models ! |
Hey guys - I'm actually running into a lot of trouble with the Keras model; it's insanely hard to train at 256x256 resolution so I'm messing around with architectural changes... Really sorry, but this might take longer to do than I initially thought it would. |
Hey @robbiebarrat, no worries and thanks for the update! Take your time, as long as you keep us updated about your work it is perfectly ok :) Good luck with the architectural changes ! |
@robbiebarrat training for 256x256 is quite difficult! Most implementations have a lot of issues with mode collapse above 128x128 resolution. Perhaps it's an idea to get a working implementation and trained datasets for 128x128 up first and then expand to larger resolutions later. Otherwise some tips that might help with larger resolution training can be found here and maybe something to look at implementing eventually would be progressive growing of resolution. |
Even if you have results in 128x128 I am very much interested in being able to get the pretrained models and code in python. Such repository do not really exist at the moment so even if it does not seem really perfect to publish I think you should consider it :) |
? |
@Caselles Hey - sorry about this; but I've run into a lot of problems with the python networks (mostly with regard to training stability). I've tried a bunch of things from ganhacks, different architectures, loss functions, etc. but to no avail. I thought about using the progressive growing of gans paper, but that takes multiple months to train. I'm putting this project on hold right now, since it's not really working out, and also I'm pretty swamped with applying to colleges right now... I might come back to it in the next few months if I come across something that'll help me out, or if some cool new GAN paper comes out (like if there's one that does higher resolution generations easily) - but I really don't know if that's very likely. |
Ok, really disappointed. Could you at least provide the code for the 128x128 Gan in Keras ? |
Unfortunately I don't have that working; otherwise i'd absolutely provide it. I'm going to try something using tf-gan in the near future, which will just be straight up tensorflow as opposed to keras, but I'll update this repo with some equivalent networks in tf - can't promise 256x256 though. |
Hello @Caselles @robbiebarrat. I've finally gotten myself a cuda enabled GPU. I wrote a simple script that converts GPU checkpoints to CPU checkpoints and converted all the included pretrained networks with it. See #6 Landscape GANGeneratorDiscriminatorNude-Portrait GANGeneratorDiscriminatorPortrait GANGeneratorDiscriminator |
Thank you so much! I will try this out at once! |
This worked! Thank you soooooo much! @JCBrouwer |
I'm French and I feel you robbie |
@Boriyilla why make this about nationalities? |
Trying to resume training from one of the models on CPU returns an error regarding an unknown Torch class.
This seems to be because the models were trained using a GPU and thus require CUNN to load. According to this comment however, this can be remedied simply by converting the models to float before saving them. I would test it out myself and pull request (seeing as this might be as simple as adding 2 lines) but I don't have an NVIDIA graphics card.
Next to this I have found this script, which seems to be able to convert checkpoints after the fact. This also requires CUNN though, so it would be nice if the checkpoints could be converted for us CPU users!
The text was updated successfully, but these errors were encountered: