@@ -151,6 +151,7 @@ def start(self, config_file):
151
151
'preprocess_opt' : conf .get ('preprocess' , None ),
152
152
'tokenizer_opt' : conf .get ('tokenizer' , None ),
153
153
'postprocess_opt' : conf .get ('postprocess' , None ),
154
+ 'custom_opt' : conf .get ('custom_opt' , None ),
154
155
'on_timeout' : conf .get ('on_timeout' , None ),
155
156
'model_root' : conf .get ('model_root' , self .models_root ),
156
157
'ct2_model' : conf .get ('ct2_model' , None )
@@ -245,10 +246,10 @@ class ServerModel(object):
245
246
opt (dict): Options for the Translator
246
247
model_id (int): Model ID
247
248
preprocess_opt (list): Options for preprocess processus or None
248
- (extend for CJK)
249
249
tokenizer_opt (dict): Options for the tokenizer or None
250
250
postprocess_opt (list): Options for postprocess processus or None
251
- (extend for CJK)
251
+ custom_opt (dict): Custom options, can be used within preprocess or
252
+ postprocess, default None
252
253
load (bool): whether to load the model during :func:`__init__()`
253
254
timeout (int): Seconds before running :func:`do_timeout()`
254
255
Negative values means no timeout
@@ -259,10 +260,11 @@ class ServerModel(object):
259
260
"""
260
261
261
262
def __init__ (self , opt , model_id , preprocess_opt = None , tokenizer_opt = None ,
262
- postprocess_opt = None , load = False , timeout = - 1 ,
263
+ postprocess_opt = None , custom_opt = None , load = False , timeout = - 1 ,
263
264
on_timeout = "to_cpu" , model_root = "./" , ct2_model = None ):
264
265
self .model_root = model_root
265
266
self .opt = self .parse_opt (opt )
267
+ self .custom_opt = custom_opt
266
268
267
269
self .model_id = model_id
268
270
self .preprocess_opt = preprocess_opt
0 commit comments