2bfe5bfcec7759ae022b1a479411aa7d1b8401f1,example/example7.py,,,#,26

Before Change


pool_layer = 1
subset_vec_all_layers = []

common = {
    "model_dir": "//data/cips/data/lab/data/model/uncased_L-12_H-768_A-12",
    "num_worker": 2,
    "num_repeat": 5,
    "port": 6006,
    "port_out": 6007,
    "max_seq_len": 20,
    "client_batch_size": 2048,
    "max_batch_size": 256,
    "num_client": 1,
    "pooling_strategy": PoolingStrategy.REDUCE_MEAN,
    "pooling_layer": [-2],
    "gpu_memory_fraction": 0.5,
    "xla": False,
    "cpu": False,
    "verbose": False,
    "device_map": []
}
args = namedtuple("args_namedtuple", ",".join(common.keys()))
for k, v in common.items():
    setattr(args, k, v)

for pool_layer in range(1, 13):
    setattr(args, "pooling_layer", [-pool_layer])
    server = BertServer(args)
    server.start()
    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


port = 6006
port_out = 6007

common = [
    "-model_dir", "/bert_model/chinese_L-12_H-768_A-12/",
    "-num_worker", "2",
    "-port", str(port),
    "-port_out", str(port_out),
    "-max_seq_len", "20",
    // "-client_batch_size", "2048",
    "-max_batch_size", "256",
    // "-num_client", "1",
    "-pooling_strategy", "REDUCE_MEAN",
    "-pooling_layer", "-2",
    "-gpu_memory_fraction", "0.2",
    "-device","3",
]
args = get_args_parser().parse_args(common)

for pool_layer in range(1, 13):
    setattr(args, "pooling_layer", [-pool_layer])
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 8

Instances


Project Name: hanxiao/bert-as-service
Commit Name: 2bfe5bfcec7759ae022b1a479411aa7d1b8401f1
Time: 2019-05-06
Author: zyn2122@gmail.com
File Name: example/example7.py
Class Name:
Method Name:


Project Name: hanxiao/bert-as-service
Commit Name: 2bfe5bfcec7759ae022b1a479411aa7d1b8401f1
Time: 2019-05-06
Author: zyn2122@gmail.com
File Name: example/example7.py
Class Name:
Method Name:


Project Name: r9y9/nnmnkwii
Commit Name: 63bebeea54b4ef80fd136f5b814768cc702205a0
Time: 2019-01-10
Author: zryuichi@gmail.com
File Name: setup.py
Class Name:
Method Name:


Project Name: brilee/MuGo
Commit Name: ac532f8ee44d044696a5d6142c3070194a73d3cb
Time: 2016-07-01
Author: brian.kihoon.lee@gmail.com
File Name: main.py
Class Name:
Method Name: