我正在尝试加载大量Keras模型(例如,它们分别称为A,B,C和D),并且我想使用多处理来加快速度。
$('.whatever').typeahead(...)
不确定我是否正确执行此操作,也不确定如何访问model_names = ['A', 'B', 'C', 'D']
def load(name):
model = load_model(directory + '/models/' + var_name + '.h5')
return model
def main():
multiprocessing.set_start_method('spawn', force = True)
pool = multiprocessing.Pool(processes = multiprocessing.cpu_count())
results = pool.map_async(load, model_names)
pool.close()
pool.join()
if __name__ == '__main__':
main()
中已加载的模型。