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

Fix validation for model containing both formats. #948

Open
wants to merge 1 commit into
base: feature/aqua-v1.0.4
Choose a base branch
from

Conversation

lu-ohai
Copy link
Member

@lu-ohai lu-ohai commented Sep 18, 2024

Fix validation for model containing both formats.

  • Currently the logic to validate model only takes care of either SAFETENSORS or GGUF format and misses the case when both formats are present.
  • This PR mostly just refactored the code to new methods and added cases to deal with the case with both formats are present.

Notebook

  • Register model with only SAFETENSORS
Screenshot 2024-09-18 at 3 11 56 PM
  • Register model with only GGUF
    Selecting finetuning for GGUF model will fail
Screenshot 2024-09-18 at 3 21 37 PM Must select GGUF file if there are many Screenshot 2024-09-18 at 3 22 36 PM Screenshot 2024-09-18 at 3 25 48 PM
  • Register model with both SAFETENSORS and GGUF
    Selecting finetuning for GGUF model will fail
Screenshot 2024-09-18 at 6 13 58 PM Screenshot 2024-09-18 at 6 13 26 PM Screenshot 2024-09-18 at 6 16 13 PM

@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Sep 18, 2024
Copy link
Member

@VipulMascarenhas VipulMascarenhas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changes look good, we might have to update and add unit tests as well. Could you run tests and confirm they work fine?

@@ -933,139 +933,186 @@ def _validate_model(
# now as we know that at least one type of model files exist, validate the content of oss path.
# for safetensors, we check if config.json files exist, and for gguf format we check if files with
# gguf extension exist.
for model_format in model_formats:
if ModelFormat.SAFETENSORS in model_formats and ModelFormat.GGUF in model_formats:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This case is only possible for the service models?

We probably can do something like this:

if {ModelFormat.SAFETENSORS, ModelFormat.GGUF}.issubset(set(model_formats)):

Ideally we should come up with the base modelFormatValidator class, and implement different types of the format validators. We can do this in the next iteration.

if (
model_format == ModelFormat.SAFETENSORS
and len(safetensors_model_files) > 0
import_model_details.inference_container == InferenceContainerTypeFamily.AQUA_LLAMA_CPP_CONTAINER_FAMILY
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT:

import_model_details.inference_container.lower()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OCA Verified All contributors have signed the Oracle Contributor Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants