Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Map rag model to device in eval rag script #75

Merged
merged 3 commits into from
Dec 4, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions dalm/eval/eval_rag.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,11 @@ def evaluate_rag(
)
# peft config and wrapping
rag_model.attach_pre_trained_peft_layers(retriever_peft_model_path, generator_peft_model_path, device)
# mapping rag retriever and generator model to device
if retriever_peft_model_path is None:
rag_model.retriever_model.eval().to(device)
if generator_peft_model_path is None:
rag_model.generator_model.eval().to(device)
unique_passage_dataset, passage_embeddings_array = get_passage_embeddings(
processed_datasets,
passage_column_name,
Expand Down