Repository: pytorch
Issue: AttributeError: 'LinearPackedParams' object has no attribute '_modules'
Labels: needs reproduction,oncall: quantization,module: nn,triaged

### 🐛 Describe the bug

I am trying to run [easyocr](https://github.com/JaidedAI/EasyOCR) library in spark udf and getting the following error. 
 
```
Caused by: org.apache.spark.api.python.PythonException: Traceback (most recent call last):
  File "/tmp/ipykernel_4537/530021952.py", line 107, in get_parsed_output
  File "/home/centos/.local/lib/python3.8/site-packages/pandas/core/frame.py", line 8839, in apply
    return op.apply().__finalize__(self, method="apply")
  File "/home/centos/.local/lib/python3.8/site-packages/pandas/core/apply.py", line 727, in apply
    return self.apply_standard()
  File "/home/centos/.local/lib/python3.8/site-packages/pandas/core/apply.py", line 851, in apply_standard
    results, res_index = self.apply_series_generator()
  File "/home/centos/.local/lib/python3.8/site-packages/pandas/core/apply.py", line 871, in apply_series_generator
    results[i] = results[i].copy(deep=False)
  File "/home/centos/.local/lib/python3.8/site-packages/pandas/core/apply.py", line 138, in f
    return func(x, *args, **kwargs)
  File "/tmp/ipykernel_4537/1144331222.py", line 32, in crop_save
  File "/home/centos/.local/lib/python3.8/site-packages/easyocr/easyocr.py", line 400, in readtext
    result = self.recognize(img_cv_grey, horizontal_list, free_list,\
  File "/home/centos/.local/lib/python3.8/site-packages/easyocr/easyocr.py", line 330, in recognize
    result0 = get_text(self.character, imgH, int(max_width), self.recognizer, self.converter, image_list,\
  File "/home/centos/.local/lib/python3.8/site-packages/easyocr/recognition.py", line 206, in get_text
    result1 = recognizer_predict(recognizer, converter, test_loader,batch_max_length,\
  File "/home/centos/.local/lib/python3.8/site-packages/easyocr/recognition.py", line 101, in recognizer_predict
    model.eval()
  File "/home/centos/.local/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1751, in eval
    return self.train(False)
  File "/home/centos/.local/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1732, in train
    module.train(mode)
  File "/home/centos/.local/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1732, in train
    module.train(mode)
  File "/home/centos/.local/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1732, in train
    module.train(mode)
  [Previous line repeated 1 more time]
  File "/home/centos/.local/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1731, in train
    for module in self.children():
  File "/home/centos/.local/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1618, in children
    for name, module in self.named_children():
  File "/home/centos/.local/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1636, in named_children
    for name, module in self._modules.items():
  File "/home/centos/.local/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1185, in __getattr__
    raise AttributeError("'{}' object has no attribute '{}'".format(
AttributeError: 'LinearPackedParams' object has no attribute '_modules'
```
I am using Centos 7
Python 3.8.12
torch version - 1.11.0+cu102
torchvision version - 0.12.0+cu102


### Versions

--2022-06-26 16:11:47--  https://raw.githubusercontent.com/pytorch/pytorch/master/torch/utils/collect_env.py
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 185.199.110.133, 185.199.111.133, 185.199.108.133, ...
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|185.199.110.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 16906 (17K) [text/plain]
Saving to: 'collect_env.py'

100%[======================================>] 16,906      --.-K/s   in 0s      

2022-06-26 16:11:47 (199 MB/s) - 'collect_env.py' saved [16906/16906]

Collecting environment information...
PyTorch version: 1.11.0+cu102
Is debug build: False
CUDA used to build PyTorch: 10.2
ROCM used to build PyTorch: N/A

OS: CentOS Linux 7 (Core) (x86_64)
GCC version: (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44)
Clang version: Could not collect
CMake version: Could not collect
Libc version: glibc-2.17

Python version: 3.8.12 (default, Jun 25 2022, 20:44:59)  [GCC 4.8.5 20150623 (Red Hat 4.8.5-44)] (64-bit runtime)
Python platform: Linux-3.10.0-1160.59.1.el7.x86_64-x86_64-with-glibc2.17
Is CUDA available: False
CUDA runtime version: No CUDA
GPU models and configuration: No CUDA
Nvidia driver version: No CUDA
cuDNN version: No CUDA
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

Versions of relevant libraries:
[pip3] numpy==1.22.4
[pip3] torch==1.11.0
[pip3] torchvision==0.12.0
[conda] Could not collect

cc @jerryzh168 @jianyuh @raghuramank100 @jamesr66a @vkuzo @albanD @mruberry @jbschlosser @walterddr @kshitij12345 @saketh-are