@@ -316,21 +316,18 @@ class Engine(EngineBase):
316
316
317
317
Args:
318
318
model_path (str): The hugging face model path.
319
- tokenizer (lmdeploy.Tokenizer): an instance of lmdeploy.Tokenizer
320
319
engine_config (PytorchEngineConfig): The config of the Engine.
321
320
trust_remote_code (bool): Trust remote code.
322
321
"""
323
322
324
323
def __init__ (self ,
325
324
model_path : str ,
326
- tokenizer : object ,
327
325
engine_config : PytorchEngineConfig = None ,
328
326
trust_remote_code : bool = True ) -> None :
329
327
# make sure engine config exist
330
328
engine_config = _update_engine_config (engine_config )
331
329
332
330
# dist args
333
- self .tokenizer = tokenizer
334
331
self .tp = engine_config .tp
335
332
self .dp = engine_config .dp
336
333
self .dp_rank = engine_config .dp_rank
@@ -358,15 +355,11 @@ def __init__(self,
358
355
misc_config = _build_misc_config (engine_config )
359
356
360
357
# build model agent
361
- raw_tokenizer = None
362
- if tokenizer is not None :
363
- raw_tokenizer = tokenizer .model .model
364
358
self .executor = build_executor (model_path ,
365
359
cache_config = cache_config ,
366
360
backend_config = backend_config ,
367
361
dist_config = dist_config ,
368
362
misc_config = misc_config ,
369
- tokenizer = raw_tokenizer ,
370
363
adapters = adapters ,
371
364
device_type = engine_config .device_type ,
372
365
distributed_executor_backend = engine_config .distributed_executor_backend ,
@@ -406,7 +399,6 @@ def __init__(self,
406
399
@classmethod
407
400
def from_pretrained (cls ,
408
401
pretrained_model_name_or_path : str ,
409
- tokenizer : object ,
410
402
engine_config : PytorchEngineConfig = None ,
411
403
trust_remote_code : bool = True ,
412
404
** kwargs ):
@@ -423,7 +415,6 @@ def from_pretrained(cls,
423
415
on huggingface.co, such as "InternLM/internlm-chat-7b",
424
416
"Qwen/Qwen-7B-Chat ", "baichuan-inc/Baichuan2-7B-Chat"
425
417
and so on.
426
- tokenizer (lmdeploy.Tokenizer): an instance of lmdeploy.Tokenizer
427
418
engine_config (PytorchEngineConfig): Pytorch engine config.
428
419
trust_remote_code (bool): Trust remote code
429
420
"""
@@ -432,13 +423,11 @@ def from_pretrained(cls,
432
423
backend = engine_config .mp_engine_backend
433
424
return build_mp_engine (backend = backend ,
434
425
model_path = pretrained_model_name_or_path ,
435
- tokenizer = tokenizer ,
436
426
engine_config = engine_config ,
437
427
trust_remote_code = trust_remote_code )
438
428
if len (kwargs ) > 0 :
439
429
logger .debug (f'Get unexpected kwargs: { kwargs } ' )
440
430
return cls (model_path = pretrained_model_name_or_path ,
441
- tokenizer = tokenizer ,
442
431
engine_config = engine_config ,
443
432
trust_remote_code = trust_remote_code )
444
433
0 commit comments