Skip to content

Conversation

lu-ohai
Copy link
Member

@lu-ohai lu-ohai commented Jul 29, 2024

Added Logic to Download Model from HugginFace

  • Added download_from_hf: Optional[bool] = True and local_dir: Optional[str] = None to ImportModelDetails
  • Added logic to download and validate model from hugginface

Notebook

  • SAFETENSORS
Screenshot 2024-07-29 at 3 29 52 PM Screenshot 2024-07-29 at 3 30 12 PM
  • GGUF
Screenshot 2024-07-29 at 3 37 24 PM Screenshot 2024-07-29 at 3 37 08 PM

@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Jul 29, 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.

added minor comments, rest looks good!

f"The model path {os_path} does not container either {ModelFormat.SAFETENSORS} "
f"or {ModelFormat.GGUF} files. Please check if the path is correct or the model "
f"The model {model_name} does not contain either {ModelFormat.SAFETENSORS.value} "
f"or {ModelFormat.GGUF.value} files in {os_path} or HugginFace. Please check if the path is correct or the model "
Copy link
Member

Choose a reason for hiding this comment

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

typo, HugginFace with Hugging Face repository.

).siblings
except Exception as e:
huggingface_err_message = str(e)
raise Exception(
Copy link
Member

Choose a reason for hiding this comment

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

replace Exception with AquaRuntimeError so that it doesn't trigger error 500?

I'm thinking if we should raise exception here or let user proceed with a warning. Fine to keep exception now, we can discuss in team sync regarding this.

Copy link
Member Author

Choose a reason for hiding this comment

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

This is the same code as the previous version

os.makedirs(local_dir, exist_ok=True)
# Copy the model from the cache to destination
snapshot_download(
repo_id=model_name, local_dir=local_dir, local_dir_use_symlinks=False
Copy link
Member

Choose a reason for hiding this comment

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

local_dir_use_symlinks has been deprecated in 0.23.4 which is being used for this iteration. We should remove this parameter otherwise it shows unnecessary deprecation logs to the user when this runs.

Copy link
Member Author

Choose a reason for hiding this comment

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

Same from the previous version. Let me remove it.

@lu-ohai lu-ohai merged commit 31575c1 into ODSC-60499/register-os-model-validation Jul 29, 2024
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.

2 participants