Torch.jit.frontend.NotSupportedError: not supporting functions with variable number of arguments.
Labels: oncall: jit

### 🐛 Describe the bug

Hi,  I'm trying to use torch-mlir to compile **a pytorch yolov5 model** from https://github.com/ultralytics/yolov5 . But I'm having some issues now, when compiling these model. When I call torch_mlir.compile, torch-mlir calls torch.jit.script on the module before importing it into torch-mlir. The  error is due to torch.jit.script not supporting functions with variable number of arguments. 

1. python script
```
import torch 
import torch_mlir 
model = torch.hub.load("ultralytics/yolov5", "yolov5s") 
module = torch_mlir.compile(model, torch.zeros(1,3,640,640), output_type="linalg-on-tensors")
```
2.Error
```
Traceback (most recent call last):
  File "/home/project/iree-demo/pytorch/test-case-generate/yolo/yolo.py", line 35, in <module>
    module = torch_mlir.compile(yolomodel, img, output_type="linalg-on-tensors")
  File "/root/anaconda3/envs/yolo/lib/python3.10/site-packages/torch_mlir/__init__.py", line 404, in compile
    scripted = torch.jit.script(model)
  File "/root/anaconda3/envs/yolo/lib/python3.10/site-packages/torch/jit/_script.py", line 1284, in script
    return torch.jit._recursive.create_script_module(
  File "/root/anaconda3/envs/yolo/lib/python3.10/site-packages/torch/jit/_recursive.py", line 480, in create_script_module
    return create_script_module_impl(nn_module, concrete_type, stubs_fn)
  File "/root/anaconda3/envs/yolo/lib/python3.10/site-packages/torch/jit/_recursive.py", line 542, in create_script_module_impl
    script_module = torch.jit.RecursiveScriptModule._construct(cpp_module, init_fn)
  File "/root/anaconda3/envs/yolo/lib/python3.10/site-packages/torch/jit/_script.py", line 614, in _construct
    init_fn(script_module)
  File "/root/anaconda3/envs/yolo/lib/python3.10/site-packages/torch/jit/_recursive.py", line 520, in init_fn
    scripted = create_script_module_impl(orig_value, sub_concrete_type, stubs_fn)
  File "/root/anaconda3/envs/yolo/lib/python3.10/site-packages/torch/jit/_recursive.py", line 542, in create_script_module_impl
    script_module = torch.jit.RecursiveScriptModule._construct(cpp_module, init_fn)
  File "/root/anaconda3/envs/yolo/lib/python3.10/site-packages/torch/jit/_script.py", line 614, in _construct
    init_fn(script_module)
  File "/root/anaconda3/envs/yolo/lib/python3.10/site-packages/torch/jit/_recursive.py", line 520, in init_fn
    scripted = create_script_module_impl(orig_value, sub_concrete_type, stubs_fn)
  File "/root/anaconda3/envs/yolo/lib/python3.10/site-packages/torch/jit/_recursive.py", line 542, in create_script_module_impl
    script_module = torch.jit.RecursiveScriptModule._construct(cpp_module, init_fn)
  File "/root/anaconda3/envs/yolo/lib/python3.10/site-packages/torch/jit/_script.py", line 614, in _construct
    init_fn(script_module)
  File "/root/anaconda3/envs/yolo/lib/python3.10/site-packages/torch/jit/_recursive.py", line 520, in init_fn
    scripted = create_script_module_impl(orig_value, sub_concrete_type, stubs_fn)
  File "/root/anaconda3/envs/yolo/lib/python3.10/site-packages/torch/jit/_recursive.py", line 542, in create_script_module_impl
    script_module = torch.jit.RecursiveScriptModule._construct(cpp_module, init_fn)
  File "/root/anaconda3/envs/yolo/lib/python3.10/site-packages/torch/jit/_script.py", line 614, in _construct
    init_fn(script_module)
  File "/root/anaconda3/envs/yolo/lib/python3.10/site-packages/torch/jit/_recursive.py", line 520, in init_fn
    scripted = create_script_module_impl(orig_value, sub_concrete_type, stubs_fn)
  File "/root/anaconda3/envs/yolo/lib/python3.10/site-packages/torch/jit/_recursive.py", line 546, in create_script_module_impl
    create_methods_and_properties_from_stubs(concrete_type, method_stubs, property_stubs)
  File "/root/anaconda3/envs/yolo/lib/python3.10/site-packages/torch/jit/_recursive.py", line 397, in create_methods_and_properties_from_stubs
    concrete_type._create_methods_and_properties(property_defs, property_rcbs, method_defs, method_rcbs, method_defaults)
  File "/root/anaconda3/envs/yolo/lib/python3.10/site-packages/torch/jit/_script.py", line 1466, in _recursive_compile_class
    return _compile_and_register_class(obj, rcb, _qual_name)
  File "/root/anaconda3/envs/yolo/lib/python3.10/site-packages/torch/jit/_recursive.py", line 49, in _compile_and_register_class
    ast = get_jit_class_def(obj, obj.__name__)
  File "/root/anaconda3/envs/yolo/lib/python3.10/site-packages/torch/jit/frontend.py", line 234, in get_jit_class_def
    method_defs = [
  File "/root/anaconda3/envs/yolo/lib/python3.10/site-packages/torch/jit/frontend.py", line 235, in <listcomp>
    get_jit_def(obj, name, self_name=self_name, is_classmethod=is_classmethod(obj))
  File "/root/anaconda3/envs/yolo/lib/python3.10/site-packages/torch/jit/frontend.py", line 297, in get_jit_def
    return build_def(parsed_def.ctx, fn_def, type_line, def_name, self_name=self_name, pdt_arg_types=pdt_arg_types)
  File "/root/anaconda3/envs/yolo/lib/python3.10/site-packages/torch/jit/frontend.py", line 335, in build_def
    param_list = build_param_list(ctx, py_def.args, self_name, pdt_arg_types)
  File "/root/anaconda3/envs/yolo/lib/python3.10/site-packages/torch/jit/frontend.py", line 363, in build_param_list
    raise NotSupportedError(ctx_range, _vararg_kwarg_err)
torch.jit.frontend.NotSupportedError: Compiled functions can't take variable number of arguments or use keyword-only arguments with defaults:
  File "/root/anaconda3/envs/yolo/lib/python3.10/warnings.py", line 477
    def __exit__(self, *exc_info):
                       ~~~~~~~~~ <--- HERE
        if not self._entered:
            raise RuntimeError("Cannot exit %r without entering first" % self)
'__torch__.warnings.catch_warnings' is being compiled since it was called from 'SPPF.forward'
  File "/root/.cache/torch/hub/ultralytics_yolov5_master/models/common.py", line 229
    def forward(self, x):
        x = self.cv1(x)
        with warnings.catch_warnings():
             ~~~~~~~~~~~~~~~~~~~~~~~ <--- HERE
            warnings.simplefilter('ignore')  # suppress torch 1.9.0 max_pool2d() warning
            y1 = self.m(x)
```
From torch-mlir community reply, they think this error due to torch.jit.sript. So I'm here for help!

### Versions

### Python Version as shown below
```
conda create -n torch-mlir python=3.10
pip install torch-2.1.0.dev20230523+cpu-cp310-cp310-linux_x86_64.whl
pip install torch_mlir-20230524.848-cp310-cp310-linux_x86_64.whl
pip install torchvision-0.16.0.dev20230523+cpu-cp310-cp310-linux_x86_64.whl
```

cc @EikanWang @jgong5 @wenzhe-nrv @sanchitintel