Giter VIP home page Giter VIP logo

Comments (5)

lcswillems avatar lcswillems commented on July 24, 2024 1

This is normal. The default model is made to take as input a 7x7x3 image. It applies convolutions hence assumes the output has size 64 (https://github.com/lcswillems/pytorch-a2c-ppo/blob/9e87fdad55c1139526a8228dfe15d0b667fbedae/model.py#L25). So you should modify this number.

I am modifying my code to do it automatically. I will tell you when it is done.

from minigrid.

lcswillems avatar lcswillems commented on July 24, 2024 1

This is done. Now, the model adapts to the observation space (https://github.com/lcswillems/pytorch-a2c-ppo/blob/e37dd17f9115c08b4234cc85b38f7429c9623560/model.py#L36). However, keep in mind that the model created automatically for the fully-observable space is not necessarily the best.

from minigrid.

maximecb avatar maximecb commented on July 24, 2024

Yes, the problem is that with a fully observable grid, the size of your observation is the size of the grid. I unfortunately don't know of a way to automatically adjust the convolutional layer sizes in PyTorch, so you have to manually adjust these so that the size of the tensors being passed through operations match:

Convolutional layers:
https://github.com/lcswillems/pytorch-a2c-ppo/blob/master/model.py#L26

You could also pad the size of the embedding after the convolution, or make it go through a fully-connected layer to get an embedding of the size you want:
https://github.com/lcswillems/pytorch-a2c-ppo/blob/master/model.py#L80

from minigrid.

maximecb avatar maximecb commented on July 24, 2024

@lcswillems Awesome if you can do it automatically! 👍

from minigrid.

Driesssens avatar Driesssens commented on July 24, 2024

Of course. Browsed through that code to see if the input size was hardcoded, but didn't realize a fixed CNN output size implies a fixed input size too. Thanks for the quick replies!

from minigrid.

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.