Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
(fix)Made minor changes in the tests to account for the changes
  • Loading branch information
vector15-05 committed Oct 1, 2026
commit 8f4996f69d50c19997ba318c13abb5ed3694cfe5
2 changes: 1 addition & 1 deletion src/huggingface_hub/serialization/_torch.py
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ def load_torch_model(
[`ImportError`](https://docs.python.org/3/library/exceptions.html#ImportError)
If safetensors or torch is not installed when trying to load a .safetensors file or a PyTorch checkpoint respectively.
[`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError)
If the checkpoint path is invalid or if the checkpoint format cannot be determined.
If the checkpoint format cannot be determined.

Example:
```python
Expand Down
4 changes: 4 additions & 0 deletions tests/test_repocard_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,10 @@ def test_model_index_to_eval_results_source_null(self):
assert eval_results[0].source_name is None
assert eval_results[0].source_url is None

def test_model_index_to_eval_results_empty(self):
with pytest.raises(ValueError, match="`model_index` must be a non-empty list."):
model_index_to_eval_results([])

def test_card_data_requires_model_name_for_eval_results(self):

with pytest.raises(ValueError, match="`eval_results` requires `model_name` to be set."):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_serialization.py
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,7 @@ def test_load_state_dict_missing_file(safe_serialization):

def test_load_torch_model_directory_does_not_exist():
"""Test proper error handling when directory does not contain a valid checkpoint."""
with pytest.raises(ValueError, match="Checkpoint path does_not_exist does not exist"):
with pytest.raises(FileNotFoundError, match="Checkpoint path does_not_exist does not exist"):
load_torch_model(Mock(), "does_not_exist")


Expand Down
Loading