I’m not aware of any library exporting a PyTorch model to plain Python code, as it would most likely be too slow for the majority of use cases.
I’m not sure how space-limited you are, but maybe you could use the CPU-only PyTorch package or build PyTorch from source and remove all accelerators (CUDA, cudnn, NCCL, MKL, etc.).