MCPcopy Create free account
hub / github.com/Oneflow-Inc/oneflow / get_dir

Function get_dir

python/oneflow/hub.py:378–393  ·  view source on GitHub ↗

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

()

Source from the content-addressed store, hash-verified

376
377
378def 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
396def set_dir(d):

Callers 3

_get_cache_or_reloadFunction · 0.85
_check_repo_is_trustedFunction · 0.85
load_state_dict_from_urlFunction · 0.85

Calls 2

_get_oneflow_homeFunction · 0.85
joinMethod · 0.80

Tested by

no test coverage detected