I:VENTILATOR:[i:i: 67]:freeze, optimize and export graph, could take a while...
I:GRAPHOPT:[gra:opt: 53]:model config: ./word_model/cased_L/bert_config.json
I:GRAPHOPT:[gra:opt: 56]:checkpoint: ./word_model/cased_L/bert_model.ckpt
I:GRAPHOPT:[gra:opt: 60]:build graph...
I:GRAPHOPT:[gra:opt:132]:load parameters from checkpoint...
I:GRAPHOPT:[gra:opt:136]:optimize...
I:GRAPHOPT:[gra:opt:144]:freeze...
I:GRAPHOPT:[gra:opt:149]:write graph to a tmp file: /tmp/tmpu9_t7kt7
I:VENTILATOR:[i:i: 75]:optimized graph is stored at: /tmp/tmpu9_t7kt7
start client
I:VENTILATOR:[i:_ru:129]:bind all sockets
I:VENTILATOR:[__i:_ru:133]:open 8 ventilator-worker sockets
I:VENTILATOR:[i:_ru:136]:start the sink
I:SINK:[i:_ru:306]:ready
I:VENTILATOR:[__i:_ge:222]:get devices
I:VENTILATOR:[i:_ge:255]:device map:
worker 0 -> gpu 0
I:WORKER-0:[i:_ru:531]:use device gpu: 0, load graph from /tmp/tmpu9_t7kt7
I:WORKER-0:[i:gen:559]:ready and listening!
I:VENTILATOR:[i:_ru:164]:all set, ready to serve request!
I:VENTILATOR:[__i:_ru:180]:new config request req id: 1 client: b'b0c6aaa0-e5aa-4f9c-bac8-bcd3a527cab1'
I:SINK:[i:_ru:348]:send config client b'b0c6aaa0-e5aa-4f9c-bac8-bcd3a527cab1'
data load
start
go
I:VENTILATOR:[i:_ru:196]:new encode request req id: 2 size: 3 client: b'b0c6aaa0-e5aa-4f9c-bac8-bcd3a527cab1'
I:SINK:[__i:_ru:342]:job register size: 3 job id: b'b0c6aaa0-e5aa-4f9c-bac8-bcd3a527cab1#2'
I:WORKER-0:[i:gen:568]:new job socket: 0 size: 3 client: b'b0c6aaa0-e5aa-4f9c-bac8-bcd3a527cab1#2
原来的测试代码是这样子的:
from bert_serving.server.helper import get_args_parser
from bert_serving.server import BertServer
args = get_args_parser().parse_args(['-model_dir', './word_model/cased_L/',
'-pooling_strategy', 'NONE',
'-num_worker','1'])
server = BertServer(args)
server.start()
print('start client',flush=True)
from bert_serving.client import BertClient
bc = BertClient(ip='127.0.0.1')
import numpy as np
import pandas as pd
import time
print('data load', flush=True)
df_np = np.load('./English_Data/500_imblanced_sample.npy', allow_pickle=True)
df = pd.DataFrame(data=df_np, columns=["event_id", "tweet_id", "text", "user_id", "created_at", "user_loc", \
"place_type", "place_full_name", "place_country_code", "hashtags",
"user_mentions", "image_urls", "entities", "words"])
start = time.time()
print('start',flush=True)
print(df['words'][0][0], flush=True)
doc_vecs = bc.encode(['First do it', 'then do it right', 'then do it better'])
print(doc_vecs.shape)
I:VENTILATOR:[i:i: 67]:freeze, optimize and export graph, could take a while... I:GRAPHOPT:[gra:opt: 53]:model config: ./word_model/cased_L/bert_config.json I:GRAPHOPT:[gra:opt: 56]:checkpoint: ./word_model/cased_L/bert_model.ckpt I:GRAPHOPT:[gra:opt: 60]:build graph... I:GRAPHOPT:[gra:opt:132]:load parameters from checkpoint... I:GRAPHOPT:[gra:opt:136]:optimize... I:GRAPHOPT:[gra:opt:144]:freeze... I:GRAPHOPT:[gra:opt:149]:write graph to a tmp file: /tmp/tmpu9_t7kt7 I:VENTILATOR:[i:i: 75]:optimized graph is stored at: /tmp/tmpu9_t7kt7 start client I:VENTILATOR:[i:_ru:129]:bind all sockets I:VENTILATOR:[__i:_ru:133]:open 8 ventilator-worker sockets I:VENTILATOR:[i:_ru:136]:start the sink I:SINK:[i:_ru:306]:ready I:VENTILATOR:[__i:_ge:222]:get devices I:VENTILATOR:[i:_ge:255]:device map: worker 0 -> gpu 0 I:WORKER-0:[i:_ru:531]:use device gpu: 0, load graph from /tmp/tmpu9_t7kt7 I:WORKER-0:[i:gen:559]:ready and listening! I:VENTILATOR:[i:_ru:164]:all set, ready to serve request! I:VENTILATOR:[__i:_ru:180]:new config request req id: 1 client: b'b0c6aaa0-e5aa-4f9c-bac8-bcd3a527cab1' I:SINK:[i:_ru:348]:send config client b'b0c6aaa0-e5aa-4f9c-bac8-bcd3a527cab1' data load start go I:VENTILATOR:[i:_ru:196]:new encode request req id: 2 size: 3 client: b'b0c6aaa0-e5aa-4f9c-bac8-bcd3a527cab1' I:SINK:[__i:_ru:342]:job register size: 3 job id: b'b0c6aaa0-e5aa-4f9c-bac8-bcd3a527cab1#2' I:WORKER-0:[i:gen:568]:new job socket: 0 size: 3 client: b'b0c6aaa0-e5aa-4f9c-bac8-bcd3a527cab1#2
原来的测试代码是这样子的: from bert_serving.server.helper import get_args_parser from bert_serving.server import BertServer args = get_args_parser().parse_args(['-model_dir', './word_model/cased_L/', '-pooling_strategy', 'NONE', '-num_worker','1'])
server = BertServer(args) server.start()
print('start client',flush=True)
from bert_serving.client import BertClient bc = BertClient(ip='127.0.0.1') import numpy as np import pandas as pd import time print('data load', flush=True) df_np = np.load('./English_Data/500_imblanced_sample.npy', allow_pickle=True) df = pd.DataFrame(data=df_np, columns=["event_id", "tweet_id", "text", "user_id", "created_at", "user_loc", \ "place_type", "place_full_name", "place_country_code", "hashtags", "user_mentions", "image_urls", "entities", "words"])
start = time.time() print('start',flush=True) print(df['words'][0][0], flush=True) doc_vecs = bc.encode(['First do it', 'then do it right', 'then do it better']) print(doc_vecs.shape)