Skip to content

Use _get_torch_home standard utility from torch hub #1752

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

Merged
merged 1 commit into from
May 31, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions torchtext/__init__.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import os

from torch.hub import _get_torch_home

# the following import has to happen first in order to load the torchtext C++ library
from torchtext import _extension # noqa: F401

_TEXT_BUCKET = "https://download.pytorch.org/models/text/"

_TORCH_HOME = os.getenv("TORCH_HOME")
if _TORCH_HOME is None:
_TORCH_HOME = "~/.cache/torch" # default
_CACHE_DIR = os.path.expanduser(os.path.join(_TORCH_HOME, "text"))
_CACHE_DIR = os.path.expanduser(os.path.join(_get_torch_home(), "text"))

from . import data, datasets, experimental, functional, models, nn, transforms, utils, vocab

Expand Down