Fix SyntaxWarning

This commit is contained in:
Jeremy Howard
2024-09-25 15:53:46 +00:00
parent dfba2911b6
commit 80e032b0eb
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -447,7 +447,7 @@ def load_learner(fname, cpu=True, pickle_module=pickle):
map_loc = 'cpu' if cpu else default_device()
try: res = torch.load(fname, map_location=map_loc, pickle_module=pickle_module)
except AttributeError as e:
e.args = [f"Custom classes or functions exported with your `Learner` not available in namespace.\Re-declare/import before loading:\n\t{e.args[0]}"]
e.args = [f"Custom classes or functions exported with your `Learner` not available in namespace. Re-declare/import before loading:\n\t{e.args[0]}"]
raise
if cpu:
res.dls.cpu()
+1 -1
View File
@@ -2170,7 +2170,7 @@
" map_loc = 'cpu' if cpu else default_device()\n",
" try: res = torch.load(fname, map_location=map_loc, pickle_module=pickle_module)\n",
" except AttributeError as e: \n",
" e.args = [f\"Custom classes or functions exported with your `Learner` not available in namespace.\\Re-declare/import before loading:\\n\\t{e.args[0]}\"]\n",
" e.args = [f\"Custom classes or functions exported with your `Learner` not available in namespace. Re-declare/import before loading:\\n\\t{e.args[0]}\"]\n",
" raise\n",
" if cpu: \n",
" res.dls.cpu()\n",