RobvanGastel/meta-fsl-nas

excuse me

Closed this issue · 4 comments

Hi! I noticed your code doesnt use '-- do_unrolled_architecture_steps' to update alpah, does this affect the fianl accuracy?
When I set 'do_unrolled_architecture_steps',there have bugs in code:'RuntimeError: One of the differentiated Tensors appears to not have been used in the graph. Set allow_unused=True if this is the desired behavior'.Do you konw how to deal with it?
I'm sorry to bother you,do you konw how to deal with it? Thanks very much

I think the error is in the two computation graphs being disjoint (of the weights and alpha update), in the second degree DARTS update. I don't use the unrolling step approximation as I'm using the first degree DARTS updates to keep computation times low. What is your end goal by using these unrolling steps?

I'm sorry I didn't catch your meaning,I don‘t understand what's the difference between the second degree DARTS and the first degree DARTS . If don't use the unrolling step (like this phase in 'darts.py'), how could alpha updates?

phase 2. architect step (alpha)

    if not warm_up:  # only update alphas outside warm up phase
        alpha_optim.zero_grad()
        if config.do_unrolled_architecture_steps:
            architect.virtual_step(
                train_X, train_y, lr, w_optim)  # (calc w`)
        architect.backward(train_X, train_y, val_X, val_y, lr, w_optim)
        alpha_optim.step()

The original DARTS paper discusses two approaches to update the alpha values, in the case of MetaNAS first-order DARTS is used. In which, during the update of ∇α L_val(w - ξ ∇w L_train(w, α), α), the ξ = 0, for the second degree DARTS update, the chain rule is used and an unrolling step is done (for further explanation see the original DARTS paper, https://arxiv.org/abs/1806.09055). Therefore, the unrolling step of the weights are ignored as this step is part of the second degree optimization.

Furthermore, the alphas are updated during the architect.backward step in combination with the alpha optimizer step.

I see. Thank you very much for your patient answer!