load the models and its relative processor, tokenizer. Args: model_name (str): the model name or model path. Returns: None
(model_name:str)
| 406 | |
| 407 | |
| 408 | def _init_llm(model_name:str) -> None: |
| 409 | """ |
| 410 | load the models and its relative processor, tokenizer. |
| 411 | |
| 412 | Args: |
| 413 | model_name (str): the model name or model path. |
| 414 | |
| 415 | Returns: |
| 416 | None |
| 417 | """ |
| 418 | |
| 419 | global _llm, _processor, _tokenizer |
| 420 | |
| 421 | if _llm is None: |
| 422 | _llm = Qwen2VLForConditionalGeneration.from_pretrained(model_name, trust_remote_code=True) |
| 423 | |
| 424 | if _processor is None: |
| 425 | _processor = Qwen2VLProcessor.from_pretrained(model_name, trust_remote_code=True) |
| 426 | |
| 427 | if _tokenizer is None: |
| 428 | _tokenizer = _processor.tokenizer |
| 429 | |
| 430 | |
| 431 | def move_to(device): |
nothing calls this directly
no outgoing calls
no test coverage detected