Skip to content

Problems with locally downloading an adapter model with save_pretrained #646

Answered by hSterz
ashleys0 asked this question in Q&A
Discussion options

You must be logged in to vote

Hey @ashleys0 , I tried to reproduce the problem. The following code works for me:


model = AutoAdapterModel.from_pretrained("allenai/specter2_base")
model.load_adapter("allenai/specter2", source="hf", load_as="specter2_proximity", set_active=True)
model.save_pretrained(local_dir_path)
model.set_active_adapters("specter2_proximity")
model.eval()

model_local = AutoAdapterModel.from_pretrained(local_dir_path)
model_local.set_active_adapters("specter2_proximity")
model_local.eval()

tokenizer = AutoTokenizer.from_pretrained("allenai/specter2_base")

text = "Some text"
input_data = tokenizer(text, return_tensors="pt")

out1 = model(**input_data)
out2 = model_local(**input_data)

assert torch…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by calpt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants