print("wait until server is ready...")
time.sleep(15)
print("encoding...")
bc = BertClient(port=common["port"], port_out=common["port_out"], show_server_config=True)
subset_vec_all_layers.append(bc.encode(subset_text))
bc.close()
server.close()
After Change
print("done at layer -%d" % pool_layer)
//save bert vectors and labels
stacked_subset_vec_all_layers = np.stack(subset_vec_all_layers)
np.save("example7_5k_2",stacked_subset_vec_all_layers)
np_subset_label = np.array(subset_label)
np.save("example7_5k_2_subset_label",np_subset_label)