Pruning: "cannot assign x object to parameter"

Can someone explain what this error message means?

TypeError: cannot assign ‘transformers.pytorch_utils.Conv1D’ object to parameter ‘c_attn_orig’ (torch.nn.Parameter or None required)

I am attempting to use the pytorch pruning function to prune some pre-trained models from HuggingFace

!pip3 install tqdm boto3 requests regex sentencepiece Transformers sacremoses huggingface_hub tokenizers
import torch
import logging
from transformers import pipeline
from transformers import AutoTokenizer
from transformers import AutoModelForCausalLM
import transformers
import torch.nn.utils.prune as prune

model = AutoModelForCausalLM.from_pretrained("microsoft/DialoGPT-medium")
module = model.transformer.h[0].attn
# print(model)
# print(list(module.named_parameters()))
prune.random_unstructured(module, name="c_attn", amount=0.3)

Why am I unable to prune the conv1d layer? Why doesn’t prune convert it to the “torch.nn.Parameter” type in order to assign the “_orig” name to it?