tokenizer = hanlp.load(‘CTB6_CONVSEG’)
Failed to load https://file.hankcs.com/hanlp/tok/ctb6_convseg_nowe_nocrf_20200110_004046.zip. See traceback below:
================================ERROR LOG BEGINS================================
Traceback (most recent call last):
File “C:\Users\Jason\anaconda3\lib\site-packages\hanlp\utils\component_util.py”, line 74, in load_from_meta_file
obj: Component = object_from_classpath(cls)
File “C:\Users\Jason\anaconda3\lib\site-packages\hanlp_common\reflection.py”, line 27, in object_from_classpath
classpath = str_to_type(classpath)
File “C:\Users\Jason\anaconda3\lib\site-packages\hanlp_common\reflection.py”, line 44, in str_to_type
cls = getattr(importlib.import_module(module_name), class_name)
File “C:\Users\Jason\anaconda3\lib\importlib_init_.py”, line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File “”, line 1014, in _gcd_import
File “”, line 991, in _find_and_load
File “”, line 975, in _find_and_load_unlocked
File “”, line 671, in _load_unlocked
File “”, line 783, in exec_module
File “”, line 219, in _call_with_frames_removed
File “C:\Users\Jason\anaconda3\lib\site-packages\hanlp\components\tok_tf.py”, line 12, in
from hanlp.components.taggers.transformers.transformer_tagger_tf import TransformerTaggerTF
File “C:\Users\Jason\anaconda3\lib\site-packages\hanlp\components\taggers\transformers\transformer_tagger_tf.py”, line 11, in
from hanlp.layers.transformers.loader_tf import build_transformer
File “C:\Users\Jason\anaconda3\lib\site-packages\hanlp\layers\transformers\loader_tf.py”, line 7, in
import bert
ModuleNotFoundError: No module named ‘bert’
=================================ERROR LOG ENDS=================================
Some modules required by this model are missing. Please install the full version:
pip install hanlp[full]
If the problem still persists, please submit an issue to https://github.com/hankcs/HanLP/issues
When reporting an issue, make sure to paste the FULL ERROR LOG above and the system info below.
OS: Windows-10-10.0.19041-SP0
Python: 3.8.5
PyTorch: 1.8.1+cu111
HanLP: 2.1.0-alpha.44
ERROR:root:Internal Python error in the inspect module.
Below is the traceback from this internal error.
Traceback (most recent call last):
File “C:\Users\Jason\anaconda3\lib\site-packages\hanlp\utils\component_util.py”, line 74, in load_from_meta_file
obj: Component = object_from_classpath(cls)
File “C:\Users\Jason\anaconda3\lib\site-packages\hanlp_common\reflection.py”, line 27, in object_from_classpath
classpath = str_to_type(classpath)
File “C:\Users\Jason\anaconda3\lib\site-packages\hanlp_common\reflection.py”, line 44, in str_to_type
cls = getattr(importlib.import_module(module_name), class_name)
File “C:\Users\Jason\anaconda3\lib\importlib_init_.py”, line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File “”, line 1014, in _gcd_import
File “”, line 991, in _find_and_load
File “”, line 975, in _find_and_load_unlocked
File “”, line 671, in _load_unlocked
File “”, line 783, in exec_module
File “”, line 219, in _call_with_frames_removed
File “C:\Users\Jason\anaconda3\lib\site-packages\hanlp\components\tok_tf.py”, line 12, in
from hanlp.components.taggers.transformers.transformer_tagger_tf import TransformerTaggerTF
File “C:\Users\Jason\anaconda3\lib\site-packages\hanlp\components\taggers\transformers\transformer_tagger_tf.py”, line 11, in
from hanlp.layers.transformers.loader_tf import build_transformer
File “C:\Users\Jason\anaconda3\lib\site-packages\hanlp\layers\transformers\loader_tf.py”, line 7, in
import bert
ModuleNotFoundError: No module named ‘bert’
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “C:\Users\Jason\anaconda3\lib\site-packages\IPython\core\interactiveshell.py”, line 3418, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File “”, line 2, in
tokenizer = hanlp.load(‘CTB6_CONVSEG’)
File “C:\Users\Jason\anaconda3\lib\site-packages\hanlp_init_.py”, line 43, in load
return load_from_meta_file(save_dir, ‘meta.json’, verbose=verbose, **kwargs)
File “C:\Users\Jason\anaconda3\lib\site-packages\hanlp\utils\component_util.py”, line 121, in load_from_meta_file
exit(1)
SystemExit: 1
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “C:\Users\Jason\anaconda3\lib\site-packages\IPython\core\ultratb.py”, line 1170, in get_records
return _fixed_getinnerframes(etb, number_of_lines_of_context, tb_offset)
File “C:\Users\Jason\anaconda3\lib\site-packages\IPython\core\ultratb.py”, line 316, in wrapped
return f(*args, **kwargs)
File “C:\Users\Jason\anaconda3\lib\site-packages\IPython\core\ultratb.py”, line 350, in _fixed_getinnerframes
records = fix_frame_records_filenames(inspect.getinnerframes(etb, context))
File “C:\Users\Jason\anaconda3\lib\inspect.py”, line 1503, in getinnerframes
frameinfo = (tb.tb_frame,) + getframeinfo(tb, context)
AttributeError: ‘tuple’ object has no attribute ‘tb_frame’
ModuleNotFoundError Traceback (most recent call last)
~\anaconda3\lib\site-packages\hanlp\utils\component_util.py in load_from_meta_file(save_dir, meta_filename, transform_only, verbose, **kwargs)
73 try:
—> 74 obj: Component = object_from_classpath(cls)
75 if hasattr(obj, ‘load’):
~\anaconda3\lib\site-packages\hanlp_common\reflection.py in object_from_classpath(classpath, **kwargs)
26 def object_from_classpath(classpath, **kwargs):
—> 27 classpath = str_to_type(classpath)
28 if inspect.isfunction(classpath):
~\anaconda3\lib\site-packages\hanlp_common\reflection.py in str_to_type(classpath)
43 module_name, class_name = classpath.rsplit(".", 1)
—> 44 cls = getattr(importlib.import_module(module_name), class_name)
45 return cls
~\anaconda3\lib\importlib_init_.py in import_module(name, package)
126 level += 1
–> 127 return _bootstrap._gcd_import(name[level:], package, level)
128
~\anaconda3\lib\importlib_bootstrap.py in _gcd_import(name, package, level)
~\anaconda3\lib\importlib_bootstrap.py in find_and_load(name, import)
~\anaconda3\lib\importlib_bootstrap.py in find_and_load_unlocked(name, import)
~\anaconda3\lib\importlib_bootstrap.py in _load_unlocked(spec)
~\anaconda3\lib\importlib_bootstrap_external.py in exec_module(self, module)
~\anaconda3\lib\importlib_bootstrap.py in _call_with_frames_removed(f, *args, **kwds)
~\anaconda3\lib\site-packages\hanlp\components\tok_tf.py in
11 from hanlp.components.taggers.rnn_tagger_tf import RNNTaggerTF
—> 12 from hanlp.components.taggers.transformers.transformer_tagger_tf import TransformerTaggerTF
13 from hanlp.components.taggers.transformers.transformer_transform_tf import TransformerTransform
~\anaconda3\lib\site-packages\hanlp\components\taggers\transformers\transformer_tagger_tf.py in
10 from hanlp.components.taggers.transformers.transformer_transform_tf import TransformerTransform
—> 11 from hanlp.layers.transformers.loader_tf import build_transformer
12 from hanlp.layers.transformers.utils_tf import build_adamw_optimizer
~\anaconda3\lib\site-packages\hanlp\layers\transformers\loader_tf.py in
6
----> 7 import bert
8 import tensorflow as tf
ModuleNotFoundError: No module named ‘bert’
During handling of the above exception, another exception occurred:
SystemExit Traceback (most recent call last)
[… skipping hidden 1 frame]
in
1 # 加载CTB_CONVSEG预训练模型进行分词任务
----> 2 tokenizer = hanlp.load(‘CTB6_CONVSEG’)
~\anaconda3\lib\site-packages\hanlp_init_.py in load(save_dir, verbose, **kwargs)
42 verbose = HANLP_VERBOSE
—> 43 return load_from_meta_file(save_dir, ‘meta.json’, verbose=verbose, **kwargs)
44
~\anaconda3\lib\site-packages\hanlp\utils\component_util.py in load_from_meta_file(save_dir, meta_filename, transform_only, verbose, **kwargs)
120 eprint(f’HanLP: {version.version}’)
–> 121 exit(1)
122
SystemExit: 1
During handling of the above exception, another exception occurred:
TypeError Traceback (most recent call last)
[… skipping hidden 1 frame]
~\anaconda3\lib\site-packages\IPython\core\interactiveshell.py in showtraceback(self, exc_tuple, filename, tb_offset, exception_only, running_compiled_code)
2036 stb = ['An exception has occurred, use %tb to see ’
2037 ‘the full traceback.\n’]
-> 2038 stb.extend(self.InteractiveTB.get_exception_only(etype,
2039 value))
2040 else:
~\anaconda3\lib\site-packages\IPython\core\ultratb.py in get_exception_only(self, etype, value)
821 value : exception value
822 “”"
–> 823 return ListTB.structured_traceback(self, etype, value)
824
825 def show_exception_only(self, etype, evalue):
~\anaconda3\lib\site-packages\IPython\core\ultratb.py in structured_traceback(self, etype, evalue, etb, tb_offset, context)
696 chained_exceptions_tb_offset = 0
697 out_list = (
–> 698 self.structured_traceback(
699 etype, evalue, (etb, chained_exc_ids),
700 chained_exceptions_tb_offset, context)
~\anaconda3\lib\site-packages\IPython\core\ultratb.py in structured_traceback(self, etype, value, tb, tb_offset, number_of_lines_of_context)
1434 else:
1435 self.tb = tb
-> 1436 return FormattedTB.structured_traceback(
1437 self, etype, value, tb, tb_offset, number_of_lines_of_context)
1438
~\anaconda3\lib\site-packages\IPython\core\ultratb.py in structured_traceback(self, etype, value, tb, tb_offset, number_of_lines_of_context)
1334 if mode in self.verbose_modes:
1335 # Verbose modes need a full traceback
-> 1336 return VerboseTB.structured_traceback(
1337 self, etype, value, tb, tb_offset, number_of_lines_of_context
1338 )
~\anaconda3\lib\site-packages\IPython\core\ultratb.py in structured_traceback(self, etype, evalue, etb, tb_offset, number_of_lines_of_context)
1191 “”“Return a nice text document describing the traceback.”""
1192
-> 1193 formatted_exception = self.format_exception_as_a_whole(etype, evalue, etb, number_of_lines_of_context,
1194 tb_offset)
1195
~\anaconda3\lib\site-packages\IPython\core\ultratb.py in format_exception_as_a_whole(self, etype, evalue, etb, number_of_lines_of_context, tb_offset)
1149
1150
-> 1151 last_unique, recursion_repeat = find_recursion(orig_etype, evalue, records)
1152
1153 frames = self.format_records(records, last_unique, recursion_repeat)
~\anaconda3\lib\site-packages\IPython\core\ultratb.py in find_recursion(etype, value, records)
449 # first frame (from in to out) that looks different.
450 if not is_recursion_error(etype, value, records):
–> 451 return len(records), 0
452
453 # Select filename, lineno, func_name to track frames with
TypeError: object of type ‘NoneType’ has no len()