set max threads of numexpr to improve performance and ommit warnings
This commit is contained in:
parent
3504cb5274
commit
4899c3b3cc
|
|
@ -5,6 +5,14 @@ import sys
|
|||
import os
|
||||
from pprint import pprint
|
||||
|
||||
# 设置numexpr最大线程数,默认为CPU核心数
|
||||
try:
|
||||
import numexpr
|
||||
n_cores = numexpr.utils.detect_number_of_cores()
|
||||
os.environ["NUMEXPR_MAX_THREADS"] = str(n_cores)
|
||||
except:
|
||||
pass
|
||||
|
||||
sys.path.append(os.path.dirname(os.path.dirname(__file__)))
|
||||
from configs.model_config import EMBEDDING_DEVICE, EMBEDDING_MODEL, llm_model_dict, LLM_MODEL, LLM_DEVICE, LOG_PATH, \
|
||||
logger
|
||||
|
|
|
|||
Loading…
Reference in New Issue