pminervini commited on
Commit
3b32224
1 Parent(s): 1109e5f
Files changed (1) hide show
  1. fix-requests-cli.py +26 -3
fix-requests-cli.py CHANGED
@@ -26,6 +26,29 @@ model_lst = [m for m in model_lst]
26
  id_to_model = {m.id: m for m in model_lst}
27
 
28
  for path in json_files:
29
- with open(path, 'r') as file:
30
- data = json.load(file)
31
- breakpoint()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
  id_to_model = {m.id: m for m in model_lst}
27
 
28
  for path in json_files:
29
+ with open(path, 'r') as fr:
30
+ data = json.load(fr)
31
+
32
+ model_id = data['model']
33
+ if model_id in id_to_model:
34
+ model = id_to_model[model_id]
35
+
36
+ to_overwrite = False
37
+
38
+ is_finetuned = any(tag.startswith('base_model:') for tag in id_to_model[data['model']].tags)
39
+
40
+ if is_finetuned:
41
+ data["model_type"] = "fine-tuned"
42
+ to_overwrite = True
43
+
44
+ is_instruction_tuned = 'instruct' in model_id
45
+ if is_instruction_tuned:
46
+ data["model_type"] = "instruction-tuned"
47
+ to_overwrite = True
48
+
49
+ if to_overwrite is True:
50
+ with open(path, 'w') as fw:
51
+ json.dump(data, fw)
52
+
53
+ else:
54
+ print(f'Model {model_id} not found')