GithubHelp home page GithubHelp logo

Python3 version about flownet2-pytorch HOT 10 CLOSED

nvidia avatar nvidia commented on August 19, 2024
Python3 version

from flownet2-pytorch.

Comments (10)

fitsumreda avatar fitsumreda commented on August 19, 2024 3

https://github.com/NVIDIA/flownet2-pytorch/tree/python36

from flownet2-pytorch.

HTLife avatar HTLife commented on August 19, 2024 1

I met this error when loading pre-trained weight from python3

Traceback (most recent call last):                                              
  File "main.py", line 270, in <module>                                         
    main()                                                                      
  File "main.py", line 262, in main                                             
    train(EPOCH, model, optimizer, BATCH)                                       
  File "main.py", line 176, in train                                            
    output = model(data)                                                        
  File "/usr/local/lib/python3.5/dist-packages/torch/nn/modules/module.py", line
 357, in __call__                                                               
    result = self.forward(*input, **kwargs)                                     
  File "main.py", line 128, in forward                                          
    c_out = self.flownetc(c_in)                                                 
  File "/usr/local/lib/python3.5/dist-packages/torch/nn/modules/module.py", line
 357, in __call__                                                               
    result = self.forward(*input, **kwargs)                                     
  File "/notebooks/data/jacky/VINet/FlowNetC.py", line 106, in forward          
    concat5 = torch.cat((out_conv5,out_deconv5,flow6_up),1)                     
RuntimeError: invalid argument 0: Sizes of tensors must match except in dimensio
n 1. Got 18 and 17 in dimension 2 at /pytorch/torch/lib/THC/generic/THCTensorMat
h.cu:111 

from flownet2-pytorch.

HTLife avatar HTLife commented on August 19, 2024 1

I found the solution for the error above. I'm running the whole project inside the docker container.
And this is caused by docker setting.
Docker should be run with --shm-size command

sudo nvidia-docker run --shm-size 8G .........

Note1

Relative discussion could be found at:

  1. Bus error (core dumped) model share memory #2244
  2. possible deadlock in dataloader #1355

Note2

I start my training successfully by the following command:

python3 main.py --batch_size 8 --model FlowNet2C --optimizer=Adam --optimizer_lr=1e-4 --loss=MultiScale --loss_norm=L1 --loss_numScales=5 --loss_startScale=4 --optimizer_lr=1e-4 --crop_size 384 512 --training_dataset FlyingChairs --training_dataset_root /notebooks/data/FlyingChairs_release/data --validation_dataset MpiSintelClean --validation_dataset_root /notebooks/data/mpi_sintel_dataset/training

from flownet2-pytorch.

TusharNimbhorkar avatar TusharNimbhorkar commented on August 19, 2024

Hey @HTLife

For porting it to python3. You have to change few import statements. For example
Instead of from correlation_package.modules.correlation import Correlation

I used

from networks.correlation_package.modules.correlation import Correlation

I am not sure why this happens but in python3 relative paths for import doesn't work for me.

Hope this helps

from flownet2-pytorch.

HTLife avatar HTLife commented on August 19, 2024

@TusharNimbhorkar Thanks for your tips.
Could you load that pre-trained weight by python3 successfully?

from flownet2-pytorch.

TusharNimbhorkar avatar TusharNimbhorkar commented on August 19, 2024

@HTLife
Haven't tried it yet. But I am training from the start and inference step seems to be working for that.

from flownet2-pytorch.

HTLife avatar HTLife commented on August 19, 2024

Got it! That's another solution. Thanks again.

from flownet2-pytorch.

fitsumreda avatar fitsumreda commented on August 19, 2024

I’m looking at this.

from flownet2-pytorch.

fitsumreda avatar fitsumreda commented on August 19, 2024

i've added a python3 branch.

from flownet2-pytorch.

HTLife avatar HTLife commented on August 19, 2024

@fitsumreda How many memory(main/GPU) is required to train flownet2-pytorch?

  • My main memory size: 32GB
  • GPU memory: 11GB

I got this error message when I tried to train the network.

Overall Progress:   0%|                                                   | 0/10000 [00:00<?, ?it/s]
ERROR: Unexpected bus error encountered in worker. 
This might be caused by insufficient shared memory (shm).                        | 0/130.0 [00:00<?, ?it/s]
Traceback (most recent call last):
  File "main.py", line 407, in <module>
    validation_loss, _ = train(args=args, epoch=epoch - 1, start_iteration=global_iteration, data_loader=validation_loader, model=model_and_loss, optimizer=optimizer, logger=validation_logger, is_validate=True, offset=offset)
  File "main.py", line 260, in train
    for batch_idx, (data, target) in enumerate(progress):
  File "/usr/local/lib/python3.5/dist-packages/tqdm/_tqdm.py", line 910, in __iter__
    for obj in iterable:
  File "/notebooks/data/flownet2-pytorch/utils/tools.py", line 111, in __next__
    n = next(self.iterator)
  File "/usr/local/lib/python3.5/dist-packages/torch/utils/data/dataloader.py", line 275, in __next__
    idx, batch = self._get_batch()
  File "/usr/local/lib/python3.5/dist-packages/torch/utils/data/dataloader.py", line 254, in _get_batch
    return self.data_queue.get()
  File "/usr/lib/python3.5/queue.py", line 164, in get
    self.not_empty.wait()
  File "/usr/lib/python3.5/threading.py", line 293, in wait
    waiter.acquire()
  File "/usr/local/lib/python3.5/dist-packages/torch/utils/data/dataloader.py", line 175, in handler
    _error_if_any_worker_fails()
RuntimeError: DataLoader worker (pid 1361) is killed by signal: Bus error.

from flownet2-pytorch.

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.