If I run for example
learn = create_cnn(data, models.resnet18, metrics=accuracy)
the model is loaded into /root/.torch/models as it is shown here:
Downloading: "https://download.pytorch.org/models/resnet18-5c106cde.pth" to /root/.torch/models/resnet18-5c106cde.pth 100%|██████████| 46827520/46827520 [00:00<00:00, 73938844.51it/s]
My question is: can I change the directory where the model is loaded?
Pl try this.
~/.fastai/config.yml setup so the data and model are loaded into the
It works properly for
path = untar_data(URLs.PETS); path for example. The result is
PosixPath('/workspace/fastai/data/oxford-iiit-pet') but still
create_cnn loads the model into
You can override the default pytorch model_dir by changing the env variable,
os.environ['TORCH_MODEL_ZOO'] = '<path>'
That’s what I need. Thank you!
You can also use os.rename(old_path, new_path) if your files are uploaded incorrectly. This will move your files to the new directory. For example:
folders = [‘black’, ‘teddys’, ‘grizzly’]
files = [‘urls_black.csv’, ‘urls_teddys.csv’, ‘urls_grizzly.csv’]
for folder, file in zip(folders, files):
path = ‘data/bears’
os.path.join(os.getcwd(), path, file))
Please notice that “TORCH_MODEL_ZOO” is deprecated, use “TORCH_HOME” instead.