Fix Deepseek OCR Lora Model Load (#3738)
* fix deepseek ocr lora_model load: trust_remote_code option check for import error in autoconfig/peftconfig from_pretrained error handle import * Apply suggestion from @gemini-code-assist[bot] Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Apply suggestion from @gemini-code-assist[bot] Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Apply suggestion from @gemini-code-assist[bot] Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Apply suggestion from @gemini-code-assist[bot] Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --------- Co-authored-by: Daniel Han <danielhanchen@gmail.com> Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
This commit is contained in:
parent
0f5bf8833c
commit
ac0835d49f
1 changed files with 12 additions and 2 deletions
|
|
@ -289,6 +289,8 @@ class FastLanguageModel(FastLlamaModel):
|
|||
trust_remote_code = trust_remote_code,
|
||||
)
|
||||
is_model = True
|
||||
except ImportError:
|
||||
raise
|
||||
except Exception as error:
|
||||
autoconfig_error = str(error)
|
||||
if "architecture" in autoconfig_error:
|
||||
|
|
@ -305,6 +307,8 @@ class FastLanguageModel(FastLlamaModel):
|
|||
trust_remote_code = trust_remote_code,
|
||||
)
|
||||
is_peft = True
|
||||
except ImportError:
|
||||
raise
|
||||
except Exception as error:
|
||||
peft_error = str(error)
|
||||
if "architecture" in peft_error:
|
||||
|
|
@ -326,7 +330,8 @@ class FastLanguageModel(FastLlamaModel):
|
|||
"Please separate the LoRA and base models to 2 repos."
|
||||
)
|
||||
model_types = get_transformers_model_type(
|
||||
peft_config if peft_config is not None else model_config
|
||||
peft_config if peft_config is not None else model_config,
|
||||
trust_remote_code = trust_remote_code,
|
||||
)
|
||||
if len(model_types) == 1:
|
||||
model_type = model_types[0]
|
||||
|
|
@ -826,6 +831,8 @@ class FastModel(FastBaseModel):
|
|||
trust_remote_code = trust_remote_code,
|
||||
)
|
||||
is_model = True
|
||||
except ImportError:
|
||||
raise
|
||||
except Exception as error:
|
||||
autoconfig_error = str(error)
|
||||
if "architecture" in autoconfig_error:
|
||||
|
|
@ -842,6 +849,8 @@ class FastModel(FastBaseModel):
|
|||
trust_remote_code = trust_remote_code,
|
||||
)
|
||||
is_peft = True
|
||||
except ImportError:
|
||||
raise
|
||||
except Exception as error:
|
||||
peft_error = str(error)
|
||||
if "architecture" in peft_error:
|
||||
|
|
@ -861,7 +870,8 @@ class FastModel(FastBaseModel):
|
|||
"Please separate the LoRA and base models to 2 repos."
|
||||
)
|
||||
model_types = get_transformers_model_type(
|
||||
peft_config if peft_config is not None else model_config
|
||||
peft_config if peft_config is not None else model_config,
|
||||
trust_remote_code = trust_remote_code,
|
||||
)
|
||||
model_types_all = ",".join(model_types) + ","
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue