@@ -123,15 +123,16 @@ def load_from_meta_file(save_dir: str, meta_filename='meta.json', transform_only
123123 from None
124124 raise e from None
125125 except Exception as e :
126- # Some users often install an incompatible tf and put the blame on HanLP. Teach them the basics.
127- try :
128- you_installed_wrong_versions , extras = check_version_conflicts (extras = ('full' ,) if tf_model else None )
129- except Exception as check_e :
130- you_installed_wrong_versions , extras = None , None
131- if you_installed_wrong_versions :
132- raise version .NotCompatible (you_installed_wrong_versions + '\n Please reinstall HanLP in the proper way:' +
133- '\n \n \t pip install --upgrade hanlp' + (
134- f'[{ "," .join (extras )} ]' if extras else '' )) from None
126+ if not e .__traceback__ .tb_frame .f_code .co_filename .startswith (os .path .dirname (os .path .dirname (__file__ ))):
127+ # Some users often install an incompatible tf and put the blame on HanLP. Teach them the basics.
128+ try :
129+ you_installed_wrong_versions , extras = check_version_conflicts (extras = ('full' ,))
130+ except Exception as check_e :
131+ you_installed_wrong_versions , extras = None , None
132+ if you_installed_wrong_versions :
133+ raise version .NotCompatible (f'{ you_installed_wrong_versions } \n Please reinstall HanLP in the proper way:'
134+ '\n \n \t pip install --upgrade hanlp' + (
135+ f'[{ "," .join (extras )} ]' if extras else '' )) from None
135136 eprint (f'Failed to load { identifier } ' )
136137 from pkg_resources import parse_version
137138 model_version = meta .get ("hanlp_version" , '2.0.0-alpha.0' )
@@ -151,7 +152,8 @@ def load_from_meta_file(save_dir: str, meta_filename='meta.json', transform_only
151152 f'Please upgrade HanLP with:\n '
152153 f'\n \t pip install --upgrade hanlp\n ' )
153154 eprint (
154- 'If the problem still persists, please submit an issue to https://github.com/hankcs/HanLP/issues\n '
155+ 'If the problem persists, please submit an issue to '
156+ 'https://github.com/hankcs/HanLP/issues/new?labels=bug&template=bug_report.md\n '
155157 'When reporting an issue, make sure to paste the FULL ERROR LOG below.' )
156158
157159 eprint (f'{ "ERROR LOG BEGINS" :=^80} ' )
0 commit comments