don't use internal exception

This commit is contained in:
Awni Hannun
2024-09-17 16:19:38 -07:00
parent 0164d2058b
commit b0ba2342b1

View File

@@ -14,7 +14,6 @@ from typing import Any, Callable, Dict, Generator, Optional, Tuple, Type, Union
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"