Barbershop icon indicating copy to clipboard operation
Barbershop copied to clipboard

Google Colab

Open osushilover opened this issue 2 years ago • 8 comments

I'm excited to watch the demo videos, especially the part of faceswap. Please release the code for Google colab so that we can try this repo easily. I am looking forward to your next update.

osushilover avatar May 02 '22 15:05 osushilover

@osushilover you can try this little demo in the meanwhile. too slow though.

deshwalmahesh avatar May 02 '22 16:05 deshwalmahesh

@deshwalmahesh You have the technical skills to build a Colab notebook from Python! I admire you.

I tried the code you provided and it was indeed slow even with Tesla V100 under high memory on Colab Pro+.

However, I was able to process the test images and I know this code will definitely be useful for others, so thank you very much for your help.

If you would allow me, I would like to ask you to change the permissions of this notebook so that anyone can modify it. I am not a programmer and do not understand what it means except for that first cell. Therefore, I am embarrassed and frustrated that I still cannot try FaceSwap with the images I have prepared.

osushilover avatar May 03 '22 17:05 osushilover

If you would allow me, I would like to ask you to change the permissions of this notebook so that anyone can modify it.

You can simply copy notebook and change it yourself, if I understood you correctly. If you want to faceswap your images, just change the urls in the second cell to links to your images and change fourth cell to !python main.py --im_path1 0.png --im_path2 1.png --sign realistic --smooth 5 or something like that

Styml avatar May 04 '22 07:05 Styml

@deshwalmahesh You have the technical skills to build a Colab notebook from Python! I admire you.

I tried the code you provided and it was indeed slow even with Tesla V100 under high memory on Colab Pro+.

However, I was able to process the test images and I know this code will definitely be useful for others, so thank you very much for your help.

If you would allow me, I would like to ask you to change the permissions of this notebook so that anyone can modify it. I am not a programmer and do not understand what it means except for that first cell. Therefore, I am embarrassed and frustrated that I still cannot try FaceSwap with the images I have prepared.

Thank you for such kind words. If you want to modify that notebook, you can either press Ctrl + S and save it in a drive or you could Download the ipynb and upload it again in Colab. I hope that works for you.

deshwalmahesh avatar May 06 '22 14:05 deshwalmahesh

Downloading StyleGAN2 checkpoint: pretrained_models/ffhq.pt Access denied with the following error:

Cannot retrieve the public link of the file. You may need to change
the permission to 'Anyone with the link', or have had many accesses. 

You may still be able to access the file from the browser:

 https://drive.google.com/uc?id=1AT6bNR2ppK8f2ETL_evT27f3R_oyWNHS 

Loading StyleGAN2 from checkpoint: pretrained_models/ffhq.pt Traceback (most recent call last): File "main.py", line 117, in main(args) File "main.py", line 18, in main ii2s = Embedding(args) File "/content/Barbershop/Barbershop/models/Embedding.py", line 23, in init self.net = Net(self.opts) File "/content/Barbershop/Barbershop/models/Net.py", line 15, in init self.load_weights() File "/content/Barbershop/Barbershop/models/Net.py", line 25, in load_weights checkpoint = torch.load(self.opts.ckpt) File "/usr/local/lib/python3.8/dist-packages/torch/serialization.py", line 771, in load with _open_file_like(f, 'rb') as opened_file: File "/usr/local/lib/python3.8/dist-packages/torch/serialization.py", line 270, in _open_file_like return _open_file(name_or_buffer, mode) File "/usr/local/lib/python3.8/dist-packages/torch/serialization.py", line 251, in init super(_open_file, self).init(open(name, mode)) FileNotFoundError: [Errno 2] No such file or directory: 'pretrained_models/ffhq.pt'

kuldeep70391 avatar Dec 23 '22 07:12 kuldeep70391

true too slow in nature

AdityaVishwakarmaIN avatar Feb 09 '23 17:02 AdityaVishwakarmaIN

@deshwalmahesh Thank you for the sharing. It works like a charm without setting up the conda environment rather than just pip install ninja

Curious how does it work? Could you share a bit more about the magic? Thanks.

fingerella2000 avatar May 20 '23 08:05 fingerella2000

@deshwalmahesh Thank you for the sharing. It works like a charm without setting up the conda environment rather than just pip install ninja

Curious how does it work? Could you share a bit more about the magic? Thanks.

I also want to know why. My guess would be that the collab environment already has all the packages installed.

eralds avatar Jul 13 '23 17:07 eralds