add llama vision

This commit is contained in:
jeromeku 2025-03-30 11:44:52 -07:00
commit d7308fb984
2 changed files with 17 additions and 2 deletions

View file

@ -1,6 +1,7 @@
from unsloth.registry.registry import ModelInfo, ModelMeta, _register_models
_IS_LLAMA_REGISTERED = False
_IS_LLAMA_VISION_REGISTERED = False
class LlamaModelInfo(ModelInfo):
@classmethod
@ -65,7 +66,16 @@ def register_llama_models():
_register_models(LlamaMeta3_2)
_IS_LLAMA_REGISTERED = True
def register_llama_vision_models():
global _IS_LLAMA_VISION_REGISTERED
if _IS_LLAMA_VISION_REGISTERED:
return
_register_models(LlamaMeta3_2_Vision)
_IS_LLAMA_VISION_REGISTERED = True
register_llama_models()
register_llama_vision_models()
if __name__ == "__main__":
from unsloth.registry.registry import MODEL_REGISTRY, _check_model_info

View file

@ -113,13 +113,18 @@ def register_model(
def _check_model_info(model_id: str, properties: list[str] = ["lastModified"]):
from huggingface_hub import HfApi
from huggingface_hub import ModelInfo as HfModelInfo
from huggingface_hub.utils import RepositoryNotFoundError
api = HfApi()
try:
model_info: HfModelInfo = api.model_info(model_id, expand=properties)
except Exception as e:
print(f"Error getting model info for {model_id}: {e}")
model_info = None
if isinstance(e, RepositoryNotFoundError):
print(f"\u2718 {model_id} not found")
model_info = None
else:
raise e
return model_info