Save and load the nsql-llama-2-7B model

#18
by Or111 - opened

Hi,
I am trying to save and load the nsql-llama-2-7B model after I have finetuned him.
I can see that the model is saved but I can not load it.
this is the code:

'''
from transformers import default_data_collator, Trainer, TrainingArguments
from transformers import AutoTokenizer, AutoModelForCausalLM
import torch

trainer.save_model("./my_model")
model.save_pretrained("./my_model1")

model2 = AutoModelForCausalLM.from_pretrained("./my_model1", load_in_8bit=True, torch_dtype=torch.bfloat16, device_map='auto')
model3 = AutoModelForCausalLM.from_pretrained("./my_model1")
'''
loading the model with AutoPeftModelForCausalLM caused a crash:
'''
from peft import AutoPeftModelForCausalLM

model = AutoPeftModelForCausalLM.from_pretrained("./my_model1", local_files_only=True)
'''
both model2 and model3 failed.
The error is:
my_model1 does not appear to have a file named config.json

my_model files:
adapter_config.json, adapter_model.bin , adapter_model.safetensors, README.md, training_args.bin
my_model1 files:
adapter_config.json, adapter_model.safetensors, logs/ README.md

note that removing the adapter_ prefix from the files didn't help and caused the error:
Should have a model_type key in its config.json, or contain one of the following strings in its name: albert, align, altclip, audio-spectrogram-transformer, autoformer, bark, bart, beit, bert, bert-generation, big_bird, bigbird_pegasus, biogpt, bit, blenderbot, blenderbot-small, blip, blip-2, bloom, bridgetower, camembert, canine, chinese_clip, clap, clip, clipseg, codegen, conditional_detr, convbert, convnext, convnextv2, cpmant, ctrl, cvt, data2vec-audio, data2vec-text, data2vec-vision, deberta, deberta-v2, decision_transformer, deformable_detr, deit, deta, detr, dinat, distilbert, donut-swin, dpr, dpt, efficientformer, efficientnet, electra, encodec, encoder-decoder, ernie, ernie_m, esm, falcon, flaubert, flava, fnet, focalnet, fsmt, funnel, git, glpn, gpt-sw3, gpt2, gpt_bigcode, gpt_neo, gpt_neox, gpt_neox_japanese, gptj, gptsan-japanese, graphormer, groupvit, hubert, ibert, imagegpt, informer, instructblip, jukebox, layoutlm, layoutlmv2, layoutlmv3, led, levit, lilt, llama, longformer, longt5, luke, lxmert, m2m_100, marian, markuplm, mask2former, maskformer, maskformer-swin, mbart, mctct, mega, megatron-bert, mgp-str, mobilebert, mobilenet_v1, mobilenet_v2, mobilevit, mobilevitv2, mpnet, mra, mt5, musicgen, mvp, nat, nezha, nllb-moe, nystromformer, oneformer, open-llama, openai-gpt, opt, owlvit, pegasus, pegasus_x, perceiver, pix2struct, plbart, poolformer, prophetnet, qdqbert, rag, realm, reformer, regnet, re...

Sign up or log in to comment