someone-in-the-world Claude Sonnet 4.6 commited on
Commit
4883dd8
·
1 Parent(s): b886ed1

Change timestamp column from ISO string to Unix float64

Browse files

Enables numeric sorting on the HF dataset viewer. Dataset repo has
been reset so there are no legacy string-typed rows to conflict.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

Files changed (1) hide show
  1. logging_utils.py +3 -3
logging_utils.py CHANGED
@@ -37,7 +37,7 @@ def log_inference(pil_inputs, output_pil, prompt, seed, steps, guidance_scale,
37
  # a 'huggingface' schema metadata key for the HF viewer to render them.
38
  img_struct = pa.struct([("bytes", pa.binary()), ("path", pa.string())])
39
  hf_meta = _json.dumps({"info": {"features": {
40
- "timestamp": {"dtype": "string", "_type": "Value"},
41
  "prompt": {"dtype": "string", "_type": "Value"},
42
  "seed": {"dtype": "int32", "_type": "Value"},
43
  "steps": {"dtype": "int32", "_type": "Value"},
@@ -51,7 +51,7 @@ def log_inference(pil_inputs, output_pil, prompt, seed, steps, guidance_scale,
51
  "error_message": {"dtype": "string", "_type": "Value"},
52
  }}}).encode()
53
  schema = pa.schema([
54
- ("timestamp", pa.string()),
55
  ("prompt", pa.string()),
56
  ("seed", pa.int32()),
57
  ("steps", pa.int32()),
@@ -79,7 +79,7 @@ def log_inference(pil_inputs, output_pil, prompt, seed, steps, guidance_scale,
79
  output_jpeg = _to_jpeg(output_pil)
80
 
81
  new_table = pa.table({
82
- "timestamp": pa.array([datetime.now(timezone.utc).isoformat()], type=pa.string()),
83
  "prompt": pa.array([prompt], type=pa.string()),
84
  "seed": pa.array([int(seed)], type=pa.int32()),
85
  "steps": pa.array([int(steps)], type=pa.int32()),
 
37
  # a 'huggingface' schema metadata key for the HF viewer to render them.
38
  img_struct = pa.struct([("bytes", pa.binary()), ("path", pa.string())])
39
  hf_meta = _json.dumps({"info": {"features": {
40
+ "timestamp": {"dtype": "float64", "_type": "Value"},
41
  "prompt": {"dtype": "string", "_type": "Value"},
42
  "seed": {"dtype": "int32", "_type": "Value"},
43
  "steps": {"dtype": "int32", "_type": "Value"},
 
51
  "error_message": {"dtype": "string", "_type": "Value"},
52
  }}}).encode()
53
  schema = pa.schema([
54
+ ("timestamp", pa.float64()),
55
  ("prompt", pa.string()),
56
  ("seed", pa.int32()),
57
  ("steps", pa.int32()),
 
79
  output_jpeg = _to_jpeg(output_pil)
80
 
81
  new_table = pa.table({
82
+ "timestamp": pa.array([datetime.now(timezone.utc).timestamp()], type=pa.float64()),
83
  "prompt": pa.array([prompt], type=pa.string()),
84
  "seed": pa.array([int(seed)], type=pa.int32()),
85
  "steps": pa.array([int(steps)], type=pa.int32()),