Giter Site home page Giter Site logo

models.networks.sync_batchnorm about spade HOT 8 CLOSED

nvlabs avatar nvlabs commented on May 6, 2024
models.networks.sync_batchnorm

from spade.

Comments (8)

wasd96040501 avatar wasd96040501 commented on May 6, 2024 6

@xohvan
I think it is better to follow the README.
In second header Installation, the authors show us how to install sync_batchnorm.

Copy from README:

Clone this repo.

git clone https://github.com/NVlabs/SPADE.git
cd SPADE/

This code requires PyTorch 1.0 and python 3+. Please install dependencies by

pip install -r requirements.txt

This code also requires the Synchronized-BatchNorm-PyTorch rep.

cd models/networks/
git clone https://github.com/vacancy/Synchronized-BatchNorm-PyTorch
cp Synchronized-BatchNorm-PyTorch/sync_batchnorm . -rf
cd ../../

To reproduce the results reported in the paper, you would need an NVIDIA DGX1 machine with 8 V100 GPUs.

from spade.

claudetheboof avatar claudetheboof commented on May 6, 2024

wait wait .. so do you need 8 V100 gpus to test out the the code? or do you need 8 V100 gpus to train the model?

from spade.

mingyuliutw avatar mingyuliutw commented on May 6, 2024

Train require 8 V100. Test requires 1 GPU and you need 6GB memory.

from spade.

claudetheboof avatar claudetheboof commented on May 6, 2024

thanks for the reply, mine was a GTX 1060 6gb ver which has just enough for the bare minimum. but does this demo included the UI like the GauGan video ?

from spade.

taesungp avatar taesungp commented on May 6, 2024

It does not contain UI like GauGAN. The code repo is designed to replicate the evaluation metrics that appear in the paper.

from spade.

Eliam76 avatar Eliam76 commented on May 6, 2024

Hello everyone. I have exactly the same problem, using Google Colab to run SPADE. I followed the instructions from README step by step, but I still have the same issue. I am simply trying to test the training with the very limited set of images provided in the original dataset directory. Here is what I get (note that on Google Colab, OS instructions start with an exclamation mark) :

!chdir('/content/gdrive/My Drive/Colab Notebooks')
!git clone https://github.com/NVlabs/SPADE.git

Cloning into 'SPADE'...
remote: Enumerating objects: 475, done.
remote: Total 475 (delta 0), reused 0 (delta 0), pack-reused 475
Receiving objects: 100% (475/475), 21.96 MiB | 7.04 MiB/s, done.
Resolving deltas: 100% (154/154), done.
Checking out files: 100% (121/121), done.

!chdir('/content/gdrive/My Drive/Colab Notebooks/SPADE')
!cd models/networks/
!git clone https://github.com/vacancy/Synchronized-BatchNorm-PyTorch
!cp Synchronized-BatchNorm-PyTorch/sync_batchnorm . -rf
!cd ../../

Cloning into 'Synchronized-BatchNorm-PyTorch'...
remote: Enumerating objects: 16, done.
remote: Counting objects: 100% (16/16), done.
remote: Compressing objects: 100% (12/12), done.
remote: Total 177 (delta 8), reused 9 (delta 4), pack-reused 161
Receiving objects: 100% (177/177), 41.14 KiB | 249.00 KiB/s, done.
Resolving deltas: 100% (104/104), done.

!pip install -r requirements.txt

/content/gdrive/My Drive/Colab Notebooks/SPADE
Requirement already satisfied: torch>=1.0.0 in /usr/local/lib/python3.6/dist-packages (from -r requirements.txt (line 1)) (1.5.0+cu101)
Requirement already satisfied: torchvision in /usr/local/lib/python3.6/dist-packages (from -r requirements.txt (line 2)) (0.6.0+cu101)
Requirement already satisfied: dominate>=2.3.1 in /usr/local/lib/python3.6/dist-packages (from -r requirements.txt (line 3)) (2.5.1)
Requirement already satisfied: dill in /usr/local/lib/python3.6/dist-packages (from -r requirements.txt (line 4)) (0.3.1.1)
Requirement already satisfied: scikit-image in /usr/local/lib/python3.6/dist-packages (from -r requirements.txt (line 5)) (0.16.2)
Requirement already satisfied: future in /usr/local/lib/python3.6/dist-packages (from torch>=1.0.0->-r requirements.txt (line 1)) (0.16.0)
Requirement already satisfied: numpy in /usr/local/lib/python3.6/dist-packages (from torch>=1.0.0->-r requirements.txt (line 1)) (1.18.3)
Requirement already satisfied: pillow>=4.1.1 in /usr/local/lib/python3.6/dist-packages (from torchvision->-r requirements.txt (line 2)) (7.0.0)
Requirement already satisfied: imageio>=2.3.0 in /usr/local/lib/python3.6/dist-packages (from scikit-image->-r requirements.txt (line 5)) (2.4.1)
Requirement already satisfied: scipy>=0.19.0 in /usr/local/lib/python3.6/dist-packages (from scikit-image->-r requirements.txt (line 5)) (1.4.1)
Requirement already satisfied: networkx>=2.0 in /usr/local/lib/python3.6/dist-packages (from scikit-image->-r requirements.txt (line 5)) (2.4)
Requirement already satisfied: matplotlib!=3.0.0,>=2.0.0 in /usr/local/lib/python3.6/dist-packages (from scikit-image->-r requirements.txt (line 5)) (3.2.1)
Requirement already satisfied: PyWavelets>=0.4.0 in /usr/local/lib/python3.6/dist-packages (from scikit-image->-r requirements.txt (line 5)) (1.1.1)
Requirement already satisfied: decorator>=4.3.0 in /usr/local/lib/python3.6/dist-packages (from networkx>=2.0->scikit-image->-r requirements.txt (line 5)) (4.4.2)
Requirement already satisfied: python-dateutil>=2.1 in /usr/local/lib/python3.6/dist-packages (from matplotlib!=3.0.0,>=2.0.0->scikit-image->-r requirements.txt (line 5)) (2.8.1)
Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in /usr/local/lib/python3.6/dist-packages (from matplotlib!=3.0.0,>=2.0.0->scikit-image->-r requirements.txt (line 5)) (2.4.7)
Requirement already satisfied: cycler>=0.10 in /usr/local/lib/python3.6/dist-packages (from matplotlib!=3.0.0,>=2.0.0->scikit-image->-r requirements.txt (line 5)) (0.10.0)
Requirement already satisfied: kiwisolver>=1.0.1 in /usr/local/lib/python3.6/dist-packages (from matplotlib!=3.0.0,>=2.0.0->scikit-image->-r requirements.txt (line 5)) (1.2.0)
Requirement already satisfied: six>=1.5 in /usr/local/lib/python3.6/dist-packages (from python-dateutil>=2.1->matplotlib!=3.0.0,>=2.0.0->scikit-image->-r requirements.txt (line 5)) (1.12.0)

!python train.py --name 'TEST' --dataset_mode custom --label_dir './datasets/coco_stuff/train_label' -- image_dir './datasets/coco_stuff/train_img'

Traceback (most recent call last):
  File "train.py", line 12, in <module>
    from trainers.pix2pix_trainer import Pix2PixTrainer
  File "/content/gdrive/My Drive/Colab Notebooks/SPADE/trainers/pix2pix_trainer.py", line 6, in <module>
    from models.networks.sync_batchnorm import DataParallelWithCallback
  File "/content/gdrive/My Drive/Colab Notebooks/SPADE/models/networks/__init__.py", line 8, in <module>
    from models.networks.loss import *
  File "/content/gdrive/My Drive/Colab Notebooks/SPADE/models/networks/loss.py", line 9, in <module>
    from models.networks.architecture import VGG19
  File "/content/gdrive/My Drive/Colab Notebooks/SPADE/models/networks/architecture.py", line 11, in <module>
    from models.networks.normalization import SPADE
  File "/content/gdrive/My Drive/Colab Notebooks/SPADE/models/networks/normalization.py", line 10, in <module>
    from models.networks.sync_batchnorm import SynchronizedBatchNorm2d
ModuleNotFoundError: No module named 'models.networks.sync_batchnorm'

Do you have any ideas ?

from spade.

shripad1986 avatar shripad1986 commented on May 6, 2024

from spade.

Eliam76 avatar Eliam76 commented on May 6, 2024

@shripad1986 I finally found the issue and solved it. I was trying to install the package with the following code

!chdir('/content/gdrive/My Drive/Colab Notebooks/SPADE')
!cd models/networks/
!git clone https://github.com/vacancy/Synchronized-BatchNorm-PyTorch
!cp Synchronized-BatchNorm-PyTorch/sync_batchnorm . -rf
!cd ../../

unfortunately, Google Colab does not seem to handle cd command very well into the python code (and does not print the error), so the package was installed in the root directory. The following piece of code solved the problem :

running_dir = '/content/gdrive/My Drive/Colab Notebooks/SPADE'
chdir(running_dir+'/models/networks')
!git clone https://github.com/vacancy/Synchronized-BatchNorm-PyTorch
!cp Synchronized-BatchNorm-PyTorch/sync_batchnorm . -rf
chdir(running_dir)

Thank you for your help

from spade.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.