Warn when using Chinese directory under windows.
@@ -33,11 +33,13 @@ from paddlehub.finetune import Trainer
from paddlehub.utils import log, parser, utils
from paddlehub.utils import download as _download
from paddlehub.utils.paddlex import download, ResourceNotFoundError
+from paddlehub.utils.platform import is_windows
from paddlehub.server import server_check
from paddlehub.server.server_source import ServerConnectionError
from paddlehub.module import Module
from paddlehub.text.bert_tokenizer import BertTokenizer, ErnieTinyTokenizer
from paddlehub.text.tokenizer import CustomTokenizer
+from paddlehub.text.utils import is_chinese_char
# In order to maintain the compatibility of the old version, we put the relevant
# compatible code in the paddlehub.compat package, and mapped some modules referenced
@@ -103,3 +105,12 @@ def help(*args, **kwargs):
CacheUpdater("paddle.hub.help").start()
return phhelp(*args, **kwargs)
+
+
+if is_windows():
+ for char in env.HUB_HOME:
+ if is_chinese_char(char):
+ log.logger.warning(
+ 'The home directory contains Chinese characters which may cause unknown exceptions in the execution \
+ of some modules. Please set another path through the set HUB_HOME command.')
+ break
