if callable(getattr(model, "train_on_batch", None)):
_train_batches(model, dataset, train_config, metrics_functions)
elif callable(getattr(model, "fit", None)):
_fit(model, dataset, train_config)
else:
"model is not adapted to the experimental_train yet"
model.train(dataset)
return
if train_config["validate_best"] or train_config["test_best"]:
try:
model_config["load_path"] = model_config["save_path"]
After Change
def train_model_from_config(config_path: str):
config = read_json(config_path)
if "chainer" in config:
return train_chainer(config_path)
reader_config = config["dataset_reader"]
reader = get_model(reader_config["name"])()
data_path = expand_path(reader_config.get("data_path", ""))
data = reader.read(data_path)