[WIP] Fix model loading collate_fn non-static (#1990)

* Fix model loading collate_fn non-static

* Fix serialization

* Add tests to reproduce the error

* Comment the change to let the tests fail

* Finish changes
This commit is contained in:
Jonáš Kulhánek authored and GitHub committed 2023-05-29 00:56:41 -07:00
1 parent ba08a8f530
commit a0d5307dd7
4 files changed
+404 -2

No files matched your search

+19
View File
@@ -1,3 +1,4 @@
from pathlib import Path
from typing import Any
import pytest
@@ -102,3 +103,21 @@ def test_data_manager_type_can_be_serialized(config):
assert isinstance(obj, tmp2)
finally:
globals().pop("tmp2")
def _dummy_function():
return True
def test_deserialize_config1():
with open(Path(__file__).parent / "configs" / "test_config1.yml", "r") as f:
config_str = f.read()
obj = yaml.load(config_str, Loader=yaml.Loader)
obj.pipeline.datamanager.collate_fn([1, 2, 3])
def test_deserialize_config2():
with open(Path(__file__).parent / "configs" / "test_config2.yml", "r") as f:
config_str = f.read()
obj = yaml.load(config_str, Loader=yaml.Loader)
obj.pipeline.datamanager.collate_fn([1, 2, 3])