MCPcopy
hub / github.com/yerfor/GeneFacePlusPlus / JSONOutputFormat

Class JSONOutputFormat

modules/commons/improved_diffusion/logger.py:98–110  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

96
97
98class JSONOutputFormat(KVWriter):
99 def __init__(self, filename):
100 self.file = open(filename, "wt")
101
102 def writekvs(self, kvs):
103 for k, v in sorted(kvs.items()):
104 if hasattr(v, "dtype"):
105 kvs[k] = float(v)
106 self.file.write(json.dumps(kvs) + "\n")
107 self.file.flush()
108
109 def close(self):
110 self.file.close()
111
112
113class CSVOutputFormat(KVWriter):

Callers 1

make_output_formatFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected