mirror of
https://github.com/ggml-org/llama.cpp.git
synced 2025-06-27 12:05:03 +00:00
convert : explicitly disable trust_remote_code for AutoConfig (#13246)
This commit is contained in:
@ -419,7 +419,9 @@ class ModelBase:
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def load_hparams(dir_model: Path):
|
def load_hparams(dir_model: Path):
|
||||||
try:
|
try:
|
||||||
return AutoConfig.from_pretrained(dir_model).to_dict()
|
# for security reason, we don't allow loading remote code by default
|
||||||
|
# if a model need remote code, we will fallback to config.json
|
||||||
|
return AutoConfig.from_pretrained(dir_model, trust_remote_code=False).to_dict()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.warning(f"Failed to load model config from {dir_model}: {e}")
|
logger.warning(f"Failed to load model config from {dir_model}: {e}")
|
||||||
logger.warning("Trying to load config.json instead")
|
logger.warning("Trying to load config.json instead")
|
||||||
|
Reference in New Issue
Block a user