baidu / baidu/lac

请问一下,LAC是线程安全的么?

Open
#170 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
4k
Forks
592
PR merge metrics
No merged PRs in 30d

Description

环境:
python3.6 + lac 2.1.1
报错:
```
Traceback (most recent call last):
File "/admin/servers/anaconda3/envs/auto_moment/lib/python3.6/threading.py", line 884, in _bootstrap
self._bootstrap_inner()
File "/admin/servers/anaconda3/envs/auto_moment/lib/python3.6/threading.py", line 916, in _bootstrap_inner
self.run()
File "/admin/servers/anaconda3/envs/auto_moment/lib/python3.6/threading.py", line 864, in run
self._target(*self._args, **self._kwargs)
File "/admin/servers/anaconda3/envs/auto_moment/lib/python3.6/concurrent/futures/thread.py", line 69, in _worker
work_item.run()
File "/admin/servers/anaconda3/envs/auto_moment/lib/python3.6/concurrent/futures/thread.py", line 56, in run
result = self.fn(*self.args, **self.kwargs)
File "/admin/servers/anaconda3/envs/auto_moment/lib/python3.6/site-packages/grpc/_server.py", line 552, in _unary_response_in_pool
argument, request_deserializer)
File "/admin/servers/anaconda3/envs/auto_moment/lib/python3.6/site-packages/grpc/_server.py", line 435, in _call_behavior
response_or_iterator = behavior(argument, context)
> File "/admin/codes/ai_component/handler/ner_stock_model_service.py", line 92, in ner_content
) = self.base_ner_model.ner_stock(content)
File "/admin/codes/ai_component/business/base_ner_model.py", line 98, in ner_stock
content_tokenize_list, content_category_list = self.lac_obj.run(content)
File "/admin/servers/anaconda3/envs/auto_moment/lib/python3.6/site-packages/LAC/lac.py", line 81, in run
return self.model.run(texts)
File "/admin/servers/anaconda3/envs/auto_moment/lib/python3.6/site-packages/LAC/models.py", line 239, in run
crf_result = super(LacModel, self).run(texts)['crf_result']
File "/admin/servers/anaconda3/envs/auto_moment/lib/python3.6/site-packages/LAC/models.py", line 96, in run
tensor_words, words_length = self.texts2tensor(texts)
File "/admin/servers/anaconda3/envs/auto_moment/lib/python3.6/site-packages/LAC/models.py", line 129, in texts2tensor
text = self.segment_tool.fast_cut(text)
File "/admin/servers/anaconda3/envs/auto_moment/lib/python3.6/site-packages/LAC/segment.py", line 97, in fast_cut
self.logtotal + route[_+1][0], _) for _ in self.dag[idx])
KeyError: 1442
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing concurrent calls to LAC.run using the Python 3.6 environment described in the issue. Read LAC/lac.py, LAC/models.py, and LAC/segment.py around run, texts2tensor, and fast_cut, then determine whether the shared model can safely serve threads; done means the thread-safety behavior is documented and the reported KeyError is reproducibly addressed or explained.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.