MCPcopy Create free account
hub / github.com/AI-Hypercomputer/maxtext / collate_results

Function collate_results

src/MaxText/inference_microbenchmark.py:209–220  ·  view source on GitHub ↗

Adds model/cache size info and optionally config info to results.

(config, results, model_size, cache_size, num_model_params, incl_config=False)

Source from the content-addressed store, hash-verified

207
208
209def collate_results(config, results, model_size, cache_size, num_model_params, incl_config=False):
210 """Adds model/cache size info and optionally config info to results."""
211 results["sizes"] = {
212 "model_size_in_gb": model_size / 1e9,
213 "cache_size_in_gb": cache_size / 1e9,
214 "model_params_in_billions": num_model_params / 1e9,
215 }
216 if incl_config:
217 results["config"] = {}
218 for k, v in dict(config.get_keys()).items():
219 results["config"][k] = str(v) if k == "dtype" else v # json fails with original dtype
220 return results
221
222
223def flatten_dict(dictionary, prefix="", sep="_"):

Callers 1

run_benchmarksFunction · 0.85

Calls 1

get_keysMethod · 0.45

Tested by

no test coverage detected