Convert tesnor to array problem

I need to save the tensor in a file after converting it into a list of arrays. I tried that

results = []
vec=model(preprocess(image).unsqueeze(0))
vec1=vec.numpy()
for ind in range(1):     
    results.append(vec1[ind])
return results

and got

RuntimeError: Can’t call numpy() on Tensor that requires grad. Use tensor.detach().numpy() instead.

then tried to convert this line vec1=vec.numpy() to vec1=vec.detach().cpu().numpy()
but got killed after some time

The process was most likely killed if you were running out of host memory, so try to reduce the memory requirement of your application.

I am having the same issue, How did you solve this bro?