Update yall.py
Browse files
yall.py
CHANGED
|
@@ -62,54 +62,55 @@ def create_yall():
|
|
| 62 |
|
| 63 |
# List to store the GistInfo objects
|
| 64 |
gist_infos = []
|
| 65 |
-
|
| 66 |
for data_dict in data:
|
| 67 |
-
if 'files' in data_dict
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
|
|
|
| 113 |
|
| 114 |
# Sort the list by average
|
| 115 |
gist_infos = sorted(gist_infos, key=lambda x: x.average, reverse=True)
|
|
|
|
| 62 |
|
| 63 |
# List to store the GistInfo objects
|
| 64 |
gist_infos = []
|
| 65 |
+
|
| 66 |
for data_dict in data:
|
| 67 |
+
if 'files' not in data_dict or not data_dict['files']:
|
| 68 |
+
continue
|
| 69 |
+
|
| 70 |
+
file_info = next(iter(data_dict['files'].values()))
|
| 71 |
+
filename = file_info['filename']
|
| 72 |
+
if not filename.endswith("-Nous.md"):
|
| 73 |
+
continue
|
| 74 |
+
|
| 75 |
+
raw_url = file_info['raw_url']
|
| 76 |
+
response = requests.get(raw_url)
|
| 77 |
+
if response.status_code != 200 or "Error: File does not exist" in response.text:
|
| 78 |
+
continue
|
| 79 |
+
|
| 80 |
+
# Parse the markdown table
|
| 81 |
+
lines = response.text.split('\n')
|
| 82 |
+
if len(lines) < 3:
|
| 83 |
+
continue
|
| 84 |
+
|
| 85 |
+
values = lines[2].split('|')[1:-1]
|
| 86 |
+
|
| 87 |
+
# Extract model name and model id using regular expression
|
| 88 |
+
model_match = re.search(r'\[([^\]]+)\]\(https://huggingface.co/([^/]+)/([^)]+)\)', values[0].strip())
|
| 89 |
+
if model_match:
|
| 90 |
+
model_name = model_match.group(1)
|
| 91 |
+
model_id = f"{model_match.group(2)}/{model_match.group(3)}"
|
| 92 |
+
print(values[0].strip())
|
| 93 |
+
print(model_name)
|
| 94 |
+
print(model_id)
|
| 95 |
+
print("=============")
|
| 96 |
+
else:
|
| 97 |
+
model_name = model_id = 'Unknown'
|
| 98 |
+
|
| 99 |
+
# Create a GistInfo object and add it to the list
|
| 100 |
+
gist_info = GistInfo(
|
| 101 |
+
gist_id=data_dict['id'],
|
| 102 |
+
filename=filename,
|
| 103 |
+
url=data_dict['html_url'], # Assuming html_url is the URL of the gist
|
| 104 |
+
model_name=model_name,
|
| 105 |
+
model_id=model_id,
|
| 106 |
+
model=values[0].strip(),
|
| 107 |
+
agieval=float(values[1].strip()),
|
| 108 |
+
gpt4all=float(values[2].strip()),
|
| 109 |
+
truthfulqa=float(values[3].strip()),
|
| 110 |
+
bigbench=float(values[4].strip()),
|
| 111 |
+
average=float(sum([values[1],values[2],values[4]]/3.strip()),
|
| 112 |
+
)
|
| 113 |
+
gist_infos.append(gist_info)
|
| 114 |
|
| 115 |
# Sort the list by average
|
| 116 |
gist_infos = sorted(gist_infos, key=lambda x: x.average, reverse=True)
|