how to put ```trainer.fit()``` in for loop?
I am trying to create multiple model using loop as below.
for client in clients:
    t.manual_seed(10)
    client['model'] = LinearNN(learning_rate = args.lr, i_s = args.input_size,  h1_s = args.hidden1, h2_s = args.hidden2, n_c = args.output, client=client)
    client['optim'] = optim.Adam(client['model'].parameters(), lr= args.lr)

However, trainer.fit() is an async method. To train multiple models, I need to put trainer.fit() in a loop as follows
for client in clients:
     trainer = pl.Trainer(
     max_epochs=args.epochs+1,
     progress_bar_refresh_rate=20,
     )
     trainer.fit(client['model'])

As this is an async method, it gives an error

AttributeError: can't set attribute

as it doesn't wait for finishing trainer.fit().
Is there any way to do that?
Thanks in advance.
Hi!
I'm not entirely sure, but I don't see why the code snippets you shared would not work.

is an async method

What do you mean exactly by "async" method?

it gives an error

Can you share the full error stacktrace and your Lightning version?