Skip to content
Open
Changes from all commits
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
11 changes: 5 additions & 6 deletions tests/models/test_modeling_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,12 @@ def load_model(path):
kwargs["subfolder"] = subfolder
return UNet2DConditionModel.from_pretrained(path, **kwargs)

# Download outside of `pytest.warns` so that a Hub hiccup surfaces as the network error it is,
# instead of a misleading "DID NOT WARN".
path = snapshot_download(repo_id=repo_id) if use_local else repo_id

with pytest.warns(FutureWarning) as warning:
if use_local:
with tempfile.TemporaryDirectory() as tmpdirname:
tmpdirname = snapshot_download(repo_id=repo_id)
_ = load_model(tmpdirname)
else:
_ = load_model(repo_id)
_ = load_model(path)

warning_messages = " ".join(str(w.message) for w in warning)
assert "This serialization format is now deprecated to standardize the serialization" in warning_messages
Expand Down
Loading