elixir-nx / bumblebee

Pre-trained Neural Network models in Axon (+ 🤗 Models integration)
Apache License 2.0
1.33k stars 96 forks source link

Allow setting `CACHE_DIR` and `BUMBLEBEE_OFFLINE` via Config #240

Closed thiagopromano closed 1 year ago

thiagopromano commented 1 year ago

Hey,

I'm wondering why CACHE_DIR and BUMBLEBEE_OFFLINE options are loaded directly from the system environment variables and not from the application config as is commonly done in other Elixir libraries.

Replacing System.get_env with Application.get_env would allow greater flexibility. It can default to the env variables for backward compatibility.

josevalim commented 1 year ago

This is because they were meant to be used from scripts. See examples/phoenix/README.md that explains how they are used. You can also pass those to as options to Bumblebee itself.

jonatanklosko commented 1 year ago

You can pass these and more as {:hf, "...", opts}, see t:repository/0. With that, you are free to use configuration in your app :)