Datasets:

Modalities:
Tabular
Text
Formats:
json
Size:
< 1K
Libraries:
Datasets
Dask
License:
File size: 2,245 Bytes
a695c54
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import json
import os
from datetime import datetime

import pandas as pd


def generate_request(model_id, precision, model_type, params, index):
    data = {
        "model": model_id,
        "base_model": "",
        "revision": "main",
        "private": False,
        "precision": precision,
        "weight_type": "Original",
        "status": "FINISHED",
        "submitted_time": (datetime.now() + pd.Timedelta(hours=index)).strftime(
            "%Y-%m-%dT%H:%M:%SZ"
        ),
        "model_type": f"\ud83d\udfe2 : {model_type} if model_type == 'pretrained' else model_type",
        "likes": 0,
        "params": params,
        "license": "custom",
        "architecture": "",
        "sender": "mariagrandury",
    }

    os.makedirs(f"{model_id}", exist_ok=True)
    with open(f"{model_id}_eval_request_False_{precision}_Original.json", "w") as f:
        json.dump(data, f)


def generate_requests(selection: str):
    df = pd.read_csv("scripts/models.csv")
    df = df[["model_id", "precision", "model_type", "params", "iberobench"]]

    if selection == "pretrained":
        df = df[df["model_type"] == "pretrained"]
    elif selection == "pretrained_new":
        df = df[df["model_type"] == "pretrained"]
        df = df[df["iberobench"] == False]
    elif selection == "instruction":
        df = df[df["model_type"] == "instruction-tuned"]

    for index, row in df.iterrows():
        model_id, precision, model_type, params, iberobench = row
        generate_request(
            model_id=model_id,
            precision=precision,
            model_type=model_type,
            params=params,
            index=index,
        )


if __name__ == "__main__":
    import argparse

    parser = argparse.ArgumentParser(description="Generate model requests.")
    parser.add_argument("--pretrained", action="store_true")
    parser.add_argument("--pretrained_new", action="store_true")
    parser.add_argument("--instruction", action="store_true")
    args = parser.parse_args()

    if args.pretrained:
        generate_requests("pretrained")
    elif args.pretrained_new:
        generate_requests("pretrained_new")
    elif args.instruction:
        generate_requests("instruction")
    else:
        generate_requests()