File size: 877 Bytes
c0a2ac4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
def save_html(results, filename):

    rows = ""

    for item in results:

        rows += f"""
        <tr>
            <td>{item['model']}</td>
            <td>{item['parameters']}</td>
            <td>{item['layers']}</td>
            <td>{item['hidden_size']}</td>
            <td>{item['latency_ms']}</td>
            <td>{item['throughput']}</td>
        </tr>
        """

    html = f"""
    <html>
    <head>
        <title>OpenModelLab Comparison</title>
    </head>

    <body>

    <h1>OpenModelLab Model Comparison</h1>

    <table border="1">

    <tr>
        <th>Model</th>
        <th>Parameters</th>
        <th>Layers</th>
        <th>Hidden Size</th>
        <th>Latency(ms)</th>
        <th>Throughput</th>
    </tr>

    {rows}

    </table>

    </body>
    </html>
    """

    with open(filename, "w") as f:
        f.write(html)

    return filename