More trust_remote_code=trust_remote_code (#1899)

This commit is contained in:
EgrorBs 2023-05-08 05:48:20 +03:00 committed by GitHub
parent 56a5969658
commit d3ea70f453
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -204,9 +204,9 @@ def load_model(model_name):
checkpoint = Path(f'{shared.args.model_dir}/{model_name}') checkpoint = Path(f'{shared.args.model_dir}/{model_name}')
if shared.args.load_in_8bit and params.get('max_memory', None) is not None and params['device_map'] == 'auto': if shared.args.load_in_8bit and params.get('max_memory', None) is not None and params['device_map'] == 'auto':
config = AutoConfig.from_pretrained(checkpoint) config = AutoConfig.from_pretrained(checkpoint, trust_remote_code=trust_remote_code)
with init_empty_weights(): with init_empty_weights():
model = LoaderClass.from_config(config) model = LoaderClass.from_config(config, trust_remote_code=trust_remote_code)
model.tie_weights() model.tie_weights()
params['device_map'] = infer_auto_device_map( params['device_map'] = infer_auto_device_map(