Upload ./qwen_test/ with huggingface_hub
Browse files
qwen_test
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from huggingface_hub import HfApi
|
| 2 |
+
api = HfApi()
|
| 3 |
+
import itertools
|
| 4 |
+
results = api.list_models(expand=["author","spaces","siblings","transformersInfo","lastModified","disabled","trendingScore","safetensors","widgetData","sha"])
|
| 5 |
+
for tmp in itertools.islice(results, 5):
|
| 6 |
+
# 获取模型的详细信息
|
| 7 |
+
model = api.model_info(tmp.id)
|
| 8 |
+
|
| 9 |
+
# 定义一个函数来比较两个对象的属性
|
| 10 |
+
def compare_attributes(obj1, obj2):
|
| 11 |
+
# 获取两个对象的所有属性
|
| 12 |
+
attrs1 = {attr: getattr(obj1, attr) for attr in dir(obj1) if not callable(getattr(obj1, attr)) and not attr.startswith("__")}
|
| 13 |
+
attrs2 = {attr: getattr(obj2, attr) for attr in dir(obj2) if not callable(getattr(obj2, attr)) and not attr.startswith("__")}
|
| 14 |
+
|
| 15 |
+
# 比较属性值
|
| 16 |
+
differences = {}
|
| 17 |
+
for key in set(attrs1.keys()).union(attrs2.keys()):
|
| 18 |
+
value1 = attrs1.get(key)
|
| 19 |
+
value2 = attrs2.get(key)
|
| 20 |
+
if value1 != value2:
|
| 21 |
+
differences[key] = (value1, value2)
|
| 22 |
+
|
| 23 |
+
return differences
|
| 24 |
+
|
| 25 |
+
# 比较tmp和model的属性
|
| 26 |
+
differences = compare_attributes(tmp, model)
|
| 27 |
+
|
| 28 |
+
# 打印出不一致的属性及它们的值
|
| 29 |
+
if differences:
|
| 30 |
+
print(f"ID: {tmp.id}")
|
| 31 |
+
for key, (value_tmp, value_model) in differences.items():
|
| 32 |
+
print(f" Key: {key} is different-tmp:{value_tmp}")
|