作業管理
查詢工作
To programmatically get the list of job summaries, use get_job_summaries().
import qai_hub as hub
client = hub.Client()
job_summaries = client.get_job_summaries(limit=10)
print(job_summaries)
Given a specific job ID from the UI (an ID starting with j e.g. jvgdwk7z5), the job
can be programmatically queried using get_job().
job = client.get_job("jvgdwk7z5")
print(job)
分析工作
分析工作的結果可以使用 ProfileJob 以程式方式獲取,如下所示:
profile = job.download_profile()
print(profile)
打印字典的輸出如下:
{
'estimated_inference_time': 2997,
'estimated_inference_peak_memory': 69177344,
'first_load_time': 2162619,
'first_load_peak_memory': 83742720,
'warm_load_time': 123904,
'warm_load_peak_memory': 73179136,
'compile_time': 0,
'compile_peak_memory': 0,
'compile_memory_increase_range': None,
'compile_memory_peak_range': None,
'first_load_memory_increase_range': (0, 0),
'first_load_memory_peak_range': (26226688, 31730736),
'warm_load_memory_increase_range': (0, 10580480),
'warm_load_memory_peak_range': (12865536, 37318656),
'inference_memory_increase_range': (0, 12160),
'inference_memory_peak_range': (12288, 21276192),
'all_compile_times': [],
'all_first_load_times': [2162619],
'all_warm_load_times': [123904],
'all_inference_times': [9130, .... ]
}
內存以Byte表示,時間以微秒表示。要獲取以毫秒為單位的延遲:
latency_ms = profile["execution_summary"]["execution_time"] / 1000