I'm having a little trouble. I am trying to refact...
# prefect-community
c
I'm having a little trouble. I am trying to refactor a large Flow into a few smaller pieces. If I initialize this
MetaModel
class in the flow it will be successful. If i try to load it in the flow will crash at
fit_model
.
Copy code
# meta = init_meta_model(problem, tinydb, use_default_models)
    # ^^^ this does not work
    meta = MetaModel(problem, tinydb, use_default_models=True)
    model_path = get_models(meta)

    fit_models = fit_model.map(
        model_path=model_path,
        train_data=unmapped(train_data),
        target=unmapped(train_target),
        problem=unmapped(problem),
    )
###
@task
def init_meta_model(problem, db, use_default_models=True):
    meta = MetaModel(problem, db, use_default_models=True)
    return meta
@task
def fit_model(model_path, train_data, target, problem):
    model = joblib.load(model_path)
    model.fit(X=train_data, y=target)
    joblib.dump(model, model_path)

MetaModel.models = ["PATH_TO_MODEL"]
n
Hi @Crawford Collins - it looks like
use_default_models
in
init_meta_model
isn't initialized to
True
as it is in other places, could that perhaps be the issue?