lowe-lab-ucl / cellx-predict

Explainable AI model of cell behavior
BSD 3-Clause "New" or "Revised" License
20 stars 10 forks source link

updated log file with tfrecord files #43

Closed chris-soelistyo closed 1 year ago

laureho commented 1 year ago

@chris-soelistyo I actually got to try this latest feature when I trained a new model and I got an error that I believe is linked to this PR. sorry I didn't spot it during the review!

Traceback (most recent call last):
  File "run_training.py", line 126, in <module>
    train(config)
  File "/home/henriqueslab/laureho/repo_installs/cellx-predict/cellxpredict/train.py", line 162, in train
    write_config_json_file(config)
  File "/home/henriqueslab/laureho/repo_installs/cellx-predict/cellxpredict/session.py", line 21, in write_config_json_file
    json.dump(json_data, json_file, indent=4)
  File "/home/henriqueslab/Programs/miniconda3/envs/cellx-predict/lib/python3.8/json/__init__.py", line 179, in dump
    for chunk in iterable:
  File "/home/henriqueslab/Programs/miniconda3/envs/cellx-predict/lib/python3.8/json/encoder.py", line 431, in _iterencode
    yield from _iterencode_dict(o, _current_indent_level)
  File "/home/henriqueslab/Programs/miniconda3/envs/cellx-predict/lib/python3.8/json/encoder.py", line 405, in _iterencode_dict
    yield from chunks
  File "/home/henriqueslab/Programs/miniconda3/envs/cellx-predict/lib/python3.8/json/encoder.py", line 325, in _iterencode_list
    yield from chunks
  File "/home/henriqueslab/Programs/miniconda3/envs/cellx-predict/lib/python3.8/json/encoder.py", line 438, in _iterencode
    o = _default(o)
  File "/home/henriqueslab/Programs/miniconda3/envs/cellx-predict/lib/python3.8/json/encoder.py", line 179, in default
    raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type PosixPath is not JSON serializable
quantumjot commented 1 year ago

@laureho - do you want to have a go at fixing this?

I think you'll just need to convert the paths in the list to strings, so they can be serialised. Something like:

path_str = [str(p) for p in paths]