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

Remove weak dependencies #294

Closed
manuelbb-upb opened this issue Mar 28, 2023 · 4 comments · Fixed by #295
Closed

Remove weak dependencies #294

manuelbb-upb opened this issue Mar 28, 2023 · 4 comments · Fixed by #295

Comments

@manuelbb-upb
Copy link

Big fan of this project, thanks a lot!

I noticed that installing/precompiling takes a while and that there are quite some heavy dependencies.
By looking at LuxCUDA.jl, it seems that CUDA is going to be optional?

However, there is more:
From how I interpret the __init__ function, it appears that Flux, Zygote etc. are meant to be optional dependencies.
But they appear in the [deps] section of the Project.toml and are automatically installed in Julia 1.8.
I did not test Julia 1.9 yet, but as they are also listed in [weakdeps], it might not be the case for Julia 1.9+

Is it mandatory to have Flux, ... as hard dependencies? Or could they be removed from the Project.toml dependency section?

This issue also mentions Flux as a dependency, so might be related.

@avik-pal
Copy link
Member

By looking at LuxCUDA.jl, it seems that CUDA is going to be optional?

Yes, CUDA is going to be optional starting v0.5 (no planned timeline for it yet).

it appears that Flux, Zygote etc. are meant to be optional dependencies.

Correct. However, for the Project.toml to be backwards compatible, we need to list all dependencies in [deps] and [weakdeps] (See DiffEqBase.jl as an example) (I could be wrong here since weak deps is quite new and I am not very familiar with it). Which means that you will pay the price for installing all the packages, however, those should never be loaded. If you instantiate and do using Lux only the required packages will be precompiled.

@manuelbb-upb
Copy link
Author

Thanks for the clarification 👍 You are right, I found out where I triggered precompilation of Zygote myself.

In DiffEqBase, most of the weakdeps do not appear in the [deps] section (except for Distributions, which might be accidental).
What I don't quite understand yet: Why do the weak dependencies have to be installed for backwards compatibility? From how they are setup with Requires.jl, everything should just work fine. (And they can have compat entries without being listed in [deps], it seems)

If removing the weak dependencies from [deps] is too much of a braking change, then we/you could maybe evaluate this as a task for 0.5?

@avik-pal
Copy link
Member

Ah I see. I think we can get away with just putting them under [extras]. We need it to be somewhere in Project.toml since we need [compat] entries.

@avik-pal
Copy link
Member

If the tests pass for the linked PR this should be fixed

avik-pal added a commit to LuxDL/LuxLib.jl that referenced this issue Mar 28, 2023
avik-pal added a commit to LuxDL/LuxLib.jl that referenced this issue Mar 29, 2023
avik-pal added a commit that referenced this issue Nov 3, 2024
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 a pull request may close this issue.

2 participants