guarin/fsx-backup / tipsv2 /verify_loading.py
guarin's picture
download
raw
2.7 kB
"""Verify that all tipsv2 and tipsv2-dpt repos load via the three loading APIs.
Each repo is loaded twice per API: once with trust_remote_code=True (remote
custom code) and once with trust_remote_code=False (native transformers
integration). Both must pass.
"""
from transformers import AutoModel, AutoBackbone, Tipsv2VisionModel, Tipsv2TextModel, Tipsv2DptModel
REPOS = [
"guarin/tipsv2-b14",
"guarin/tipsv2-l14",
"guarin/tipsv2-so400m14",
"guarin/tipsv2-g14",
"guarin/tipsv2-b14-dpt",
"guarin/tipsv2-l14-dpt",
"guarin/tipsv2-so400m14-dpt",
"guarin/tipsv2-g14-dpt",
]
LOADERS = [
("AutoModel", AutoModel),
("AutoBackbone", AutoBackbone),
("Tipsv2VisionModel", Tipsv2VisionModel),
("Tipsv2TextModel", Tipsv2TextModel),
("Tipsv2DptModel", Tipsv2DptModel),
]
REMOTE_CODE_MODES = [True, False]
results = {}
for repo in REPOS:
for name, loader in LOADERS:
for trust_remote_code in REMOTE_CODE_MODES:
# AutoBackbone is never wired into the repos' auto_map, so it can only
# resolve through the native integration (trust_remote_code=False).
if trust_remote_code and "auto" not in name.lower():
continue
if "dpt" in repo and "auto" not in name.lower() and "dpt" not in name.lower():
continue
try:
model = loader.from_pretrained(repo, trust_remote_code=trust_remote_code)
results[(repo, name, trust_remote_code)] = ("OK", type(model).__name__)
del model
except Exception as error:
results[(repo, name, trust_remote_code)] = ("FAIL", f"{type(error).__name__}: {error}")
print("\n==================== DETAILS ====================")
for (repo, name, trust_remote_code), (status, info) in results.items():
print(f"[{status}] {repo} via {name} (remote_code={trust_remote_code}) -> {info}")
print("\n\n==================== SUMMARY ====================")
print("Each cell shows [remote_code=True / remote_code=False].")
header = f"{'repo':<28}{'AutoModel':<20}{'AutoBackbone':<20}{'Tipsv2VisionModel':<20}{'Tipsv2TextModel':<20}"
print(header)
print("-" * len(header))
for repo in REPOS:
cells = []
for name, _ in LOADERS:
remote_status = results[(repo, name, True)][0] if (repo, name, True) in results else "-"
native_status = results[(repo, name, False)][0] if (repo, name, False) in results else "-"
cells.append(f"{remote_status}/{native_status}")
print(f"{repo:<28}{cells[0]:<20}{cells[1]:<20}{cells[2]:<20}{cells[3]:<20}")
all_ok = all(status == "OK" for (status, _) in results.values())
print(f"\nAll loads passed: {all_ok}")

Xet Storage Details

Size:
2.7 kB
·
Xet hash:
7f7cec5486a71ae6d48a80dfb3edcd26af7c58547e665eccc57bc2454b1378d2

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.