Get the OneFlow Hub cache directory used for storing downloaded models & weights. If :func:`~oneflow.hub.set_dir` is not called, default path is ``$ONEFLOW_HOME/hub`` where environment variable ``$ONEFLOW_HOME`` defaults to ``$XDG_CACHE_HOME/oneflow``. ``$XDG_CACHE_HOME`` follows th
()
| 376 | |
| 377 | |
| 378 | def get_dir(): |
| 379 | """ |
| 380 | Get the OneFlow Hub cache directory used for storing downloaded models & weights. |
| 381 | If :func:`~oneflow.hub.set_dir` is not called, default path is ``$ONEFLOW_HOME/hub`` where |
| 382 | environment variable ``$ONEFLOW_HOME`` defaults to ``$XDG_CACHE_HOME/oneflow``. |
| 383 | ``$XDG_CACHE_HOME`` follows the X Design Group specification of the Linux |
| 384 | filesystem layout, with a default value ``~/.cache`` if the environment |
| 385 | variable is not set. |
| 386 | """ |
| 387 | # Issue warning to move data if old env is set |
| 388 | if os.getenv("ONEFLOW_HUB"): |
| 389 | warnings.warn("ONEFLOW_HUB is deprecated, please use env ONEFLOW_HOME instead") |
| 390 | |
| 391 | if _hub_dir is not None: |
| 392 | return _hub_dir |
| 393 | return os.path.join(_get_oneflow_home(), "hub") |
| 394 | |
| 395 | |
| 396 | def set_dir(d): |
no test coverage detected