mlabonne commited on
Commit
1fdf681
1 Parent(s): 4a64954

Update yall.py

Browse files
Files changed (1) hide show
  1. yall.py +48 -47
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 and data_dict['files']:
68
- file_info = next(iter(data_dict['files'].values()))
69
- filename = file_info['filename']
70
- if filename.endswith("-Nous.md"):
71
- raw_url = file_info['raw_url']
72
- response = requests.get(raw_url)
73
- if response.status_code == 200:
74
- if "Error: File does not exist" not in response.text:
75
- # Parse the markdown table
76
- lines = response.text.split('\n')
77
- if len(lines) >= 3:
78
- values = lines[2].split('|')[1:-1]
79
-
80
- # Extract model name and model id using regular expression
81
- model_match = re.search(r'\[([^\]]+)\]\(https://huggingface.co/([^/]+)/([^)]+)\)', values[0].strip())
82
- if model_match:
83
- model_name = model_match.group(1)
84
- model_id = f"{model_match.group(2)}/{model_match.group(3)}"
85
- print(values[0].strip())
86
- print(model_name)
87
- print(model_id)
88
- print("=============")
89
- else:
90
- model_name = model_id = 'Unknown'
91
-
92
-
93
- # Parse the markdown table
94
- lines = response.text.split('\n')
95
- if len(lines) >= 3:
96
- values = lines[2].split('|')[1:-1]
97
-
98
- # Create a GistInfo object and add it to the list
99
- gist_info = GistInfo(
100
- gist_id=data_dict['id'],
101
- filename=filename,
102
- url=data_dict['html_url'], # Assuming html_url is the URL of the gist
103
- model_name=model_name,
104
- model_id=model_id,
105
- model=values[0].strip(),
106
- agieval=float(values[1].strip()),
107
- gpt4all=float(values[2].strip()),
108
- truthfulqa=float(values[3].strip()),
109
- bigbench=float(values[4].strip()),
110
- average=float(values[5].strip()),
111
- )
112
- gist_infos.append(gist_info)
 
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)