Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add PEFT Adapter Support for Model Evaluation
This PR adds utilities for handling PEFT adapters during evaluation to avoid the "device meta is invalid" safetensors error that occurs when evaluating fine-tuned models with adapters.
Changes
Problem Solved
When evaluating models with PEFT adapters, the evaluation often fails with:
This happens because safetensors files contain device metadata that becomes invalid when loaded in different environments.
Required Manual Change
IMPORTANT: You need to manually rename
scripts/eval/yamls/hf_lora_eval.ymltoscripts/eval/yamls/hf_lora_eval.yamlin your environment. This PR does not include this renamed file.Testing Note
These functions were tested in the local environment using local_llama_training_instruct.py but have not yet been tested in the Modal cloud environment. The functions are designed to be environment-agnostic, using only standard Python libraries and conditional logic to handle file operations safely.
Suggested Integration Guide for Modal Environment
To integrate these changes in your Modal workflow:
Important Notes
hf_lora_eval.ymltohf_lora_eval.yaml. All the other files in that folder have .yaml extension and configs expect this. This was almost certainly a typo in llm-foundry.These changes enable reliable evaluation of PEFT adapter models across different environments.