Skip to content
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

Add support for pytorch 1.5.0 #122

Merged
merged 2 commits into from
May 3, 2020
Merged

Conversation

Giuseppe5
Copy link
Collaborator

@Giuseppe5 Giuseppe5 commented Apr 24, 2020

As per #119
Initial commit, more to follow.

@volcacius
Copy link
Contributor

Currently conda dry runs for retrieving cache hashes are failing, because the session is not defined in Nox for 1.5.0. You need to add "1.5.0" to PYTORCH_VERSIONS in gen_github_actions.py, that's the single source of truth that Nox adheres too.

@volcacius
Copy link
Contributor

Both Windows and Ubuntu are failing in ways I currently don't understand. Can you try disabling extension building with ninja? Add a use_ninja=False flag to the options here

'build_ext': BuildJittableExtension.with_options(no_python_abi_suffix=True),

@Giuseppe5
Copy link
Collaborator Author

That is one solution, another one proposed in the changelog is the following:
If a previously succeeding python setup.py install now fails, try setting the MAX_JOBS environment variable.

I will try both and see which one is better (faster, easier to configure, and everything).

@Giuseppe5
Copy link
Collaborator Author

Giuseppe5 commented Apr 24, 2020

I'll leave it here for memo. I need to refactor the torch.autograd functions that are used when the JIT is disabled, since there was a change in the API. This means also a change in the setup.py file for the codegen. Hopefully the new APIs will work also with older version (we were using deprecated APIs, even though no warning was ever printed about that).
If that's not the case, then we'll need support for both version according to pytorch version.

Edit: I was mistaken, we are using the correct version.

@Giuseppe5
Copy link
Collaborator Author

Now everything works as expected, and the errors on MacOS are unrelated to brevitas-support for 1.5

setup.py Outdated
Comment on lines 55 to 56
MIN_TORCH_JITTABLE_VERSION = "1.3.0"
MAX_TORCH_JITTABLE_VERSION = "1.5.0"
Copy link
Contributor

@volcacius volcacius Apr 30, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move these two constants into brevitas/__init__.py where they are also used, so that we have a single source of truth. init.py is not importing anything new compared to setup.py so it should be fine

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, for coherence it should be MAX_TORCH_JITTABLE_VERSION = 1.4.0, since the MIN one is inclusive, and then adjust comparison operators in init and setup accordingly

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In init.py there's the import of packaging that breaks everything. Considering the workaround we have in setup.py for having it installed automatically, I would prefer duplicating the two constants for now and look for a cleaner solution in a second moment

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just move the import inside the run() methods and then pass the value to the template function.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually we can just define a bool is_ste_jittable in __init__.py and then import it into setup.py from within the run methods.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Importing within the run methods causes all the code in init to be executed, included the search for the "_C" file. But at setup-time, the _C module has yet to be created, so it fails.

Copy link
Contributor

@volcacius volcacius May 1, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good point, let's put the bool in brevitas.config and import it into both init and setup. We need to setup a separate pull to move docstrings out of config first though, and into brevitas' init, or we will have another setup time import error.

@volcacius volcacius changed the title CI/CD: add runs against pytorch 1.5.0 Add support for pytorch 1.5.0 Apr 30, 2020
This was linked to issues Apr 30, 2020
@volcacius
Copy link
Contributor

Also please rebase into two commits, one "Setup: add support for Pytorch 1.5.0" with setup.py and init.py, the other "CI/CD: run CI against Pytorch 1.5.0" with everything else

@Giuseppe5 Giuseppe5 force-pushed the pytorch1.5.0 branch 3 times, most recently from 4f00410 to 9ca2e31 Compare May 1, 2020 13:32
@volcacius
Copy link
Contributor

Please rebase after #136 .

@Giuseppe5
Copy link
Collaborator Author

No fix seems to be working for MacOS, pytorch1.5 and python 3.6.
This (open) issue seems related, even though it happens on ubuntu (in our case, only with MacOS)

@volcacius volcacius merged commit acbe863 into Xilinx:dev May 3, 2020
@Giuseppe5 Giuseppe5 deleted the pytorch1.5.0 branch May 7, 2020 14:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Pytorch 1.5.0 not working Update CI to run against Pytorch 1.5
2 participants