Hi,
After training and saving falcon-7b-instruct, I am attempting to load the model for inference using accelerate init_empty_weights, and load_checkpoint_and_dispatch. When the call to load_checkpoint_and_dispatch() is made, AttributeError: âFalconModelâ object has no attribute âmodelâ is returned (specifically by torch/nn/modules/module.py).
As a sanity check, the error does not manifest when using the original foundation falcon-7b-instruct model snapshot. Further, the derived fine-tuned model runs correctly when the accelerate init_empty_weights, and load_checkpoint_and_dispatch methods are not invoked.
After fine-tuning the model is saved as
accelerator.save_model(model, out_path, max_shard_size=â1GBâ) and as unwrapped_model.save_pretrained(out_path, âŚ),
both saved checkpoints run correctly in inference when the empty weights process is not applied.
The resulting config.json from accelerator.save_model() is as follows:
{
â_name_or_pathâ: â/home/jellybean/.cache/huggingface/hub/modelsâtiiuae-falcon-7b-instruct-machine_500/accelerateâ,
âalibiâ: false,
âapply_residual_connection_post_layernormâ: false,
âarchitecturesâ: [
âFalconForCausalLMâ
],
âattention_dropoutâ: 0.0,
âauto_mapâ: {
âAutoModelâ: âtiiuae/falcon-7b-instructâmodeling_falcon.FalconModelâ,
âAutoModelForCausalLMâ: âtiiuae/falcon-7b-instructâmodeling_falcon.FalconForCausalLMâ
},
âbiasâ: false,
âbos_token_idâ: 50256,
âdo_sampleâ: true,
âeos_token_idâ: 50256,
âhidden_dropoutâ: 0.0,
âhidden_sizeâ: 4544,
âinitializer_rangeâ: 0.02,
âlayer_norm_epsilonâ: 1e-05,
âmodel_typeâ: âfalconâ,
âmulti_queryâ: true,
ânew_decoder_architectureâ: false,
ânum_attention_headsâ: 71,
ânum_hidden_layersâ: 32,
ânum_kv_headsâ: 71,
âparallel_attnâ: true,
âtop_kâ: 0,
âtop_pâ: 0.75,
âtorch_dtypeâ: âbfloat16â,
âtransformers_versionâ: â4.34.1â,
âuse_cacheâ: true,
âvocab_sizeâ: 65024
}
I have been trying to determine the cause of this attribute error with no avail. Any help will be greatly appreciated.
Best,
Boris