Unit test failure C3M4: 'stem.0.0.weight'

In the C3M4_Assignment of PyTorch: Advanced Architectures and Deployment I am getting a unit test error that seems odd:

Failed test case: Error while executing tests: 'stem.0.0.weight'.
Expected: Execution without errors
Got: Exception raised

It is actually a key error. I have traced the test, and it is this one:
```

            # parameters unchanged in original
            t = test_case()
            changed = [k for k, v in model.state_dict().items() if not torch.equal(v, orig_state[k])]
            if changed:
                t.failed = True
                t.msg = f"Original model parameters were modified: {changed[:5]}..."
                t.want = "No mutation of input model weights"
                t.got = "Weights changed"
            cases.append(t)

All the other unit tests are succeeding, which makes it hard to determine what is going wrong exactly where.

Does anyone have information on this?

can you DM the screenshot of the codes for which you failed the test

happy to help

@Sanne_de_Roever

  1. for the first line code, you probably got confused with instructions.

kindly remove this part of the code

Safe pattern:

if hasattr(torch.backends, "quantized") and hasattr(torch.backends.quantized, "engine"):
    try:
        torch.backends.quantized.engine = backend  # e.g., "fbgemm" or "qnnpack"
    except Exception:
        pass  # leave current engine if unsupported

instead after deep copy code, next line would be evaluate the qat with qat.eval()

  1. next for the subsequent code where instruction mentions fuse the eligible model, here you have used model as eligible model where as the previous code line had assigned it as qat.

  2. your 3rd code line is correct

  3. your fourth code line also is correct but with qat training to be fine tuned need to be the first code line for the 4 instructions, instead you mentioned it in the last.

good luck!!

Regard
Dr. Deepti