Exemple #1
0
def collect_metrics_data(query):
    repo = Repo.default_repo()
    runs_dict = {}
    runs = repo.query_metrics(query=query)
    for run_trace_collection in runs.iter_runs():
        run = None
        traces_list = []
        for trace in run_trace_collection.iter():
            if not run:
                run = run_trace_collection.run
            iters, values = trace.values.sparse_numpy()
            traces_list.append({
                'name': trace.name,
                'context': trace.context.to_dict(),
                'values': values,
                'iters': iters,
                'epochs': trace.epochs.values_numpy(),
                'timestamps': trace.timestamps.values_numpy()
            })
        if run:
            runs_dict[run.hash] = {
                'traces': traces_list,
                'params': run[...],
                'props': get_run_props(run),
            }
Exemple #2
0
def collect_runs_data(query):
    repo = Repo.default_repo()
    runs = repo.query_runs(query)
    runs_dict = {}
    for run_trace_collection in runs.iter_runs():
        run = run_trace_collection.run
        runs_dict[run.hash] = {
            'params': run[...],
            'traces': run.collect_sequence_info(sequence_types='metric'),
            'props': get_run_props(run)
        }
Exemple #3
0
async def run_params_api(run_id: str):
    # Get project
    project = Project()
    if not project.exists():
        raise HTTPException(status_code=404)
    run = project.repo.get_run(hashname=run_id)
    if not run:
        raise HTTPException(status_code=404)

    response = {
        'params': run[...],
        'traces': run.get_traces_overview(),
        'props': get_run_props(run)
    }
    return JSONResponse(response)
Exemple #4
0
    def _pack_run_data(run_: Run, traces_: list):
        _rec_range = (
            trcs_rec_range if record_range_missing or calc_total_ranges else rec_range
        )

        run_dict = {
            run_.hash: {
                'ranges': {
                    'record_range': [_rec_range.start, _rec_range.stop],
                    'record_slice': [rec_slice.start, rec_slice.stop, rec_slice.step],
                },
                'params': run_.get(...),
                'traces': traces_,
                'props': get_run_props(run_),
            }
        }
        encoded_tree = encode_tree(run_dict)
        return collect_run_streamable_data(encoded_tree)
Exemple #5
0
async def run_params_api(run_id: str, sequence: Optional[Tuple[str, ...]] = Query(())):
    # Get project
    project = Project()
    if not project.exists():
        raise HTTPException(status_code=404)
    run = project.repo.get_run(run_id)
    if not run:
        raise HTTPException(status_code=404)

    if sequence != ():
        try:
            project.repo.validate_sequence_types(sequence)
        except ValueError as e:
            raise HTTPException(status_code=400, detail=str(e))
    else:
        sequence = project.repo.available_sequence_types()

    response = {
        'params': run.get(...),
        'traces': run.collect_sequence_info(sequence, skip_last_value=True),
        'props': get_run_props(run)
    }
    return JSONResponse(response)