Ejemplo n.º 1
0
def test_update_dynamic_profiling_result():
    model = ModelService.get_models('ResNet50')[0]
    dummy_info_tuple = InfoTuple(avg=1, p50=1, p95=1, p99=1)
    updated_info_tuple = InfoTuple(avg=1, p50=2, p95=1, p99=1)
    dpr = DynamicProfileResultBO(device_id='gpu:01',
                                 device_name='Tesla K40c',
                                 batch=1,
                                 memory=ProfileMemory(1000, 2000, 0.5),
                                 latency=ProfileLatency(
                                     init_latency=dummy_info_tuple,
                                     preprocess_latency=dummy_info_tuple,
                                     inference_latency=updated_info_tuple,
                                     postprocess_latency=dummy_info_tuple,
                                 ),
                                 throughput=ProfileThroughput(
                                     batch_formation_throughput=1,
                                     preprocess_throughput=1,
                                     inference_throughput=1,
                                     postprocess_throughput=1,
                                 ))
    # check update
    assert ModelService.update_dynamic_profiling_result(model.id, dpr)
    # check result
    model = ModelService.get_models('ResNet50')[0]
    assert model.profile_result.dynamic_results[0].memory.memory_usage == 2000
    assert model.profile_result.dynamic_results[
        0].latency.inference_latency.p50 == 2
Ejemplo n.º 2
0
def test_update_dynamic_profiling_result():
    model = ModelService.get_models_by_name('ResNet50')[0]
    dpr = DynamicProfileResultBO(
        'gpu:01', 'Tesla K40c', 1, ProfileMemory(1000, 2000, 1000),
        ProfileLatency((1, 1, 1), (1, 1, 1), (1, 1, 1), (1, 1, 1)),
        ProfileThroughput((1, 1, 1), (1, 1, 1), (1, 1, 1), (1, 1, 1)))
    # check update
    assert ModelService.update_dynamic_profiling_result(model.id, dpr)
    # check result
    model = ModelService.get_models_by_name('ResNet50')[0]
    assert model.profile_result.dynamic_results[0].memory.cpu_memory == 2000