| | from huggingface_hub import HfApi |
| | api = HfApi() |
| | import itertools |
| | results = api.list_models(expand=["author","spaces","siblings","transformersInfo","lastModified","disabled","trendingScore","safetensors","widgetData","sha"]) |
| | for tmp in itertools.islice(results, 5): |
| | |
| | model = api.model_info(tmp.id) |
| |
|
| | |
| | def compare_attributes(obj1, obj2): |
| | |
| | attrs1 = {attr: getattr(obj1, attr) for attr in dir(obj1) if not callable(getattr(obj1, attr)) and not attr.startswith("__")} |
| | attrs2 = {attr: getattr(obj2, attr) for attr in dir(obj2) if not callable(getattr(obj2, attr)) and not attr.startswith("__")} |
| |
|
| | |
| | differences = {} |
| | for key in set(attrs1.keys()).union(attrs2.keys()): |
| | value1 = attrs1.get(key) |
| | value2 = attrs2.get(key) |
| | if value1 != value2: |
| | differences[key] = (value1, value2) |
| | |
| | return differences |
| |
|
| | |
| | differences = compare_attributes(tmp, model) |
| |
|
| | |
| | if differences: |
| | print(f"ID: {tmp.id}") |
| | for key, (value_tmp, value_model) in differences.items(): |
| | print(f" Key: {key} is different-tmp:{value_tmp}") |
| |
|