未验证 提交 e5c84957 编写于 作者: S SunGaofeng 提交者: GitHub

fix pretrain params download in windows (#3410)

fix path of dir of files in windows
上级 796fde66
...@@ -23,7 +23,7 @@ except: ...@@ -23,7 +23,7 @@ except:
import paddle.fluid as fluid import paddle.fluid as fluid
from .utils import download, AttrDict from .utils import download, AttrDict
WEIGHT_DIR = os.path.expanduser("~/.paddle/weights") WEIGHT_DIR = os.path.join(os.path.expanduser('~'), '.paddle', 'weights')
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
......
...@@ -21,13 +21,13 @@ __all__ = ['decompress', 'download', 'AttrDict'] ...@@ -21,13 +21,13 @@ __all__ = ['decompress', 'download', 'AttrDict']
def decompress(path): def decompress(path):
t = tarfile.open(path) t = tarfile.open(path)
t.extractall(path='/'.join(path.split('/')[:-1])) t.extractall(path=os.path.split(path)[0])
t.close() t.close()
os.remove(path) os.remove(path)
def download(url, path): def download(url, path):
weight_dir = '/'.join(path.split('/')[:-1]) weight_dir = os.path.split(path)[0]
if not os.path.exists(weight_dir): if not os.path.exists(weight_dir):
os.makedirs(weight_dir) os.makedirs(weight_dir)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册