don't use internal exception (#990)

This commit is contained in:
Awni Hannun 2024-09-17 16:22:48 -07:00 committed by GitHub
parent 6c2369e4b9
commit f530f56df2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -14,7 +14,6 @@ from typing import Any, Callable, Dict, Generator, List, Optional, Tuple, Type,
import mlx.core as mx import mlx.core as mx
import mlx.nn as nn import mlx.nn as nn
from huggingface_hub import snapshot_download from huggingface_hub import snapshot_download
from huggingface_hub.utils._errors import RepositoryNotFoundError
from mlx.utils import tree_flatten from mlx.utils import tree_flatten
from transformers import PreTrainedTokenizer from transformers import PreTrainedTokenizer
@ -91,7 +90,7 @@ def get_model_path(path_or_hf_repo: str, revision: Optional[str] = None) -> Path
], ],
) )
) )
except RepositoryNotFoundError: except:
raise ModelNotFoundError( raise ModelNotFoundError(
f"Model not found for path or HF repo: {path_or_hf_repo}.\n" f"Model not found for path or HF repo: {path_or_hf_repo}.\n"
"Please make sure you specified the local path or Hugging Face" "Please make sure you specified the local path or Hugging Face"