/ concept-collection / benchcompress
Sign in
concept-collection / benchcompress
benchcompress / figures / load_results.py
42 lines · 1.1 KBBlameHistoryRaw
1import requests
2import json
3from typing import List
4import numpy as np
5import matplotlib.pyplot as plt
6from matplotlib.axes import Axes
7from pydantic import BaseModel
8from adjustText import adjust_text
10results_url = 'https://tempory.net/f/memobin/benchcompress/global/results.json'
12class BenchmarkResult(BaseModel):
13 compression_ratio: float
14 encode_time: float
15 decode_time: float
16 encode_mb_per_sec: float
17 decode_mb_per_sec: float
18 original_size: int
19 compressed_size: int
20 array_shape: List[int]
21 array_dtype: str
22 timestamp: float
23 cache_status: str
24 dataset: str
25 algorithm: str
26 algorithm_version: str
27 dataset_version: str
28 system_version: str
30class BenchmarkResults(BaseModel):
31 results: List[BenchmarkResult]
33def download_results() -> dict:
34 url = results_url
35 print(f"Downloading results from {url}...")
36 response = requests.get(url)
37 response.raise_for_status()
38 return response.json()
40def load_results_into_models(data: dict) -> BenchmarkResults:
41 """Load the downloaded data into pydantic models."""
42 return BenchmarkResults(**data)
moveopenescclose