停止 Metaflow 并行处理每个步骤

Stop Metaflow from parallelising foreach steps

我最近开始使用 Metaflow 进行超参数搜索。我对所有参数使用 foreach,如下所示:

from metaflow import FlowSpec, step

@step
def start_hpo(self):
    self.next(self.train_model, foreach='hpo_parameters')

@step
def train_model(self):
    # Trains model...

这在按预期启动步骤 train_model 时有效,但不幸的是,它希望同时并行化所有步骤。这会导致我的 gpu / cpu 内存不足 运行 立即导致步骤失败。

有没有办法告诉 Metaflow 线性执行这些步骤/一次一个或其他解决方法?

谢谢

@BBQuercus 您可以使用 --max-workers 标志来限制并行化。

目前,我们 运行 并行任务不超过 16 个,您可以将其覆盖为 python myflow.py run --max-workers 32 例如。