Repository: pytorch
Issue: Assertion on the existence of RRef user-facing methods' docstrings
Labels: oncall: distributed,triaged,better-engineering,module: rpc

## 🐛 Bug

What is the rationale behind [asserting the existence of documentation strings](https://github.com/pytorch/pytorch/blob/57bffc3a8e4fee0cce31e1ff1f662ccf7b16db57/torch/distributed/rpc/api.py#L397) at runtime? Could you not check the existence via unit tests and/or when building documentation on your CI/CD pipelines? Could you not, perhaps, change the assertion to read:

```python
if docstring is None:
   continue
```

## To Reproduce

Steps to reproduce the behavior:

1. `import torch`

The command gives the following:

```ipython
In [1]: import torch
---------------------------------------------------------------------------
AssertionError                            Traceback (most recent call last)
<ipython-input-1-eb42ca6e4af3> in <module>
----> 1 import torch

~/.local/lib/python3.8/site-packages/torch/__init__.py in <module>
    522
    523 # needs to be after the above ATen bindings so we can overwrite from Python side
--> 524 from .functional import *
    525
    526

~/.local/lib/python3.8/site-packages/torch/functional.py in <module>
      4
      5 import torch
----> 6 import torch.nn.functional as F
      7 from torch.types import _size
      8 from ._lowrank import svd_lowrank, pca_lowrank

~/.local/lib/python3.8/site-packages/torch/nn/__init__.py in <module>
----> 1 from .modules import *
      2 from .parameter import Parameter
      3 from .parallel import DataParallel
      4 from . import init
      5 from . import utils

~/.local/lib/python3.8/site-packages/torch/nn/modules/__init__.py in <module>
      1 from .module import Module
----> 2 from .linear import Identity, Linear, Bilinear
      3 from .conv import Conv1d, Conv2d, Conv3d, \
      4     ConvTranspose1d, ConvTranspose2d, ConvTranspose3d
      5 from .activation import Threshold, ReLU, Hardtanh, ReLU6, Sigmoid, Tanh, \

~/.local/lib/python3.8/site-packages/torch/nn/modules/linear.py in <module>
      4 from torch import Tensor
      5 from torch.nn.parameter import Parameter
----> 6 from .. import functional as F
      7 from .. import init
      8 from .module import Module

~/.local/lib/python3.8/site-packages/torch/nn/functional.py in <module>
     10 from . import grad  # noqa: F401
     11 from torch import _VF
---> 12 from .._jit_internal import boolean_dispatch, List, Optional, _overload, Tuple
     13 from ..overrides import has_torch_function, handle_torch_function
     14

~/.local/lib/python3.8/site-packages/torch/_jit_internal.py in <module>
     16 # Explicitly ask to import `torch.distributed.__init__` first.
     17 # Otherwise, "AttributeError: module 'torch' has no attribute 'distributed'" is raised.
---> 18 import torch.distributed.rpc
     19 from torch._six import builtins
     20 from torch._utils_internal import get_source_lines_and_file

~/.local/lib/python3.8/site-packages/torch/distributed/rpc/__init__.py in <module>
     21
     22 if is_available():
---> 23     from . import api, backend_registry, functions, _set_profiler_node_id
     24     from . import (
     25         _disable_jit_rref_pickle,

~/.local/lib/python3.8/site-packages/torch/distributed/rpc/api.py in <module>
    395     """
    396     docstring = getattr(method, "__doc__", None)
--> 397     assert docstring is not None, "RRef user-facing methods should all have docstrings."
    398
    399     # Do surgery on pybind11 generated docstrings.

AssertionError: RRef user-facing methods should all have docstrings.
```

## Expected behavior

`torch` should be imported.

## Environment

 - PyTorch Version (e.g., 1.0): `1.7.1`
 - OS (e.g., Linux): SUSE Linux Enterprise Server 15 SP2
 - How you installed PyTorch (`conda`, `pip`, source): `pip`
 - Build command you used (if compiling from source): N/A
 - Python version: `3.8.7`
 - CUDA/cuDNN version: N/A
 - GPU models and configuration: N/A
 - Any other relevant information: Python built from source _without_ docstrings

## Additional context

We are a production unit, and we disable the building of documentation strings in our runtime images when building Python from source:

```
./configure --enable-shared --without-doc-strings --with-system-ffi --with-system-expat
```

When/if we test `torch` with the following build configuration:

```
./configure --enable-shared --with-system-ffi --with-system-expat
```

`import torch` proceeds happily.

cc @pietern @mrshenli @pritamdamania87 @zhaojuanmao @satgera @gqchen @aazzolini @rohan-varma @jjlilley @osalpekar @jiayisuse @mrzzd @agolynski @SciPioneer @H-Huang @cbalioglu