We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Get Sphinx to render Google-style API docs correctly
In the API docs on RTD https://docs.rastervision.io/en/latest/api.html, the line breaks in the docs aren't rendered correctly. In particular, the `lr` argument for the PyTorch backends is on the same line as the `batch_size` argument, which obscures the `lr` argument. I think this is because we are using Google style PyDocs which aren't natively supported by Sphinx. However, there is a plugin for doing this:

https://stackoverflow.com/questions/7033239/how-to-preserve-line-breaks-when-generating-python-docs-using-sphinx

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `docs/conf.py`
Content:
```
1 from pallets_sphinx_themes import ProjectLink, get_version
2 
3 # -*- coding: utf-8 -*-
4 #
5 # Configuration file for the Sphinx documentation builder.
6 #
7 # This file does only contain a selection of the most common options. For a
8 # full list see the documentation:
9 # http://www.sphinx-doc.org/en/stable/config
10 
11 # -- Path setup --------------------------------------------------------------
12 
13 # If extensions (or modules to document with autodoc) are in another directory,
14 # add these directories to sys.path here. If the directory is relative to the
15 # documentation root, use os.path.abspath to make it absolute, like shown here.
16 #
17 # import os
18 # import sys
19 # sys.path.insert(0, os.path.abspath('.'))
20 
21 
22 # -- Project information -----------------------------------------------------
23 
24 project = 'Raster Vision'
25 copyright = '2018, Azavea'
26 author = 'Azavea'
27 
28 # The short X.Y version
29 version = '0.10'
30 # The full version, including alpha/beta/rc tags
31 release = '0.10.0'
32 
33 
34 # -- General configuration ---------------------------------------------------
35 
36 # If your documentation needs a minimal Sphinx version, state it here.
37 #
38 # needs_sphinx = '1.0'
39 
40 # Add any Sphinx extension module names here, as strings. They can be
41 # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
42 # ones.
43 extensions = [
44     'sphinx.ext.autodoc',
45     'sphinx.ext.intersphinx',
46     'pallets_sphinx_themes',
47     'sphinxcontrib.programoutput'
48 ]
49 
50 # https://read-the-docs.readthedocs.io/en/latest/faq.html#i-get-import-errors-on-libraries-that-depend-on-c-modules
51 import sys
52 from unittest.mock import MagicMock
53 
54 class Mock(MagicMock):
55     @classmethod
56     def __getattr__(cls, name):
57         return MagicMock()
58 
59 MOCK_MODULES = ['pyproj', 'h5py']
60 sys.modules.update((mod_name, Mock()) for mod_name in MOCK_MODULES)
61 
62 autodoc_mock_imports = ['torch', 'torchvision', 'pycocotools']
63 
64 intersphinx_mapping = {'python': ('https://docs.python.org/3/', None)}
65 
66 # Add any paths that contain templates here, relative to this directory.
67 templates_path = ['_templates']
68 
69 # The suffix(es) of source filenames.
70 # You can specify multiple suffix as a list of string:
71 #
72 # source_suffix = ['.rst', '.md']
73 source_suffix = '.rst'
74 
75 # The master toctree document.
76 master_doc = 'index'
77 
78 # The language for content autogenerated by Sphinx. Refer to documentation
79 # for a list of supported languages.
80 #
81 # This is also used if you do content translation via gettext catalogs.
82 # Usually you set "language" from the command line for these cases.
83 language = None
84 
85 # List of patterns, relative to source directory, that match files and
86 # directories to ignore when looking for source files.
87 # This pattern also affects html_static_path and html_extra_path .
88 exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', 'README.md']
89 
90 # The name of the Pygments (syntax highlighting) style to use.
91 # pygments_style = 'sphinx'
92 
93 # HTML -----------------------------------------------------------------
94 
95 html_theme = 'click'
96 html_theme_options = {'index_sidebar_logo': False}
97 html_context = {
98     'project_links': [
99         ProjectLink('Quickstart', 'quickstart.html'),
100         ProjectLink('Documentation TOC', 'index.html#documentation'),
101         ProjectLink('API Reference TOC', 'index.html#api-reference'),
102         ProjectLink('Project Website', 'https://rastervision.io/'),
103         ProjectLink('PyPI releases', 'https://pypi.org/project/rastervision/'),
104         ProjectLink('GitHub', 'https://github.com/azavea/raster-vision'),
105         ProjectLink('Gitter Channel', 'https://gitter.im/azavea/raster-vision'),
106         ProjectLink('Raster Vision Examples', 'https://github.com/azavea/raster-vision-examples'),
107         ProjectLink('AWS Batch Setup', 'https://github.com/azavea/raster-vision-aws'),
108         ProjectLink('Issue Tracker', 'https://github.com/azavea/raster-vision/issues/'),
109         ProjectLink('CHANGELOG', 'changelog.html'),
110         ProjectLink('Azavea', 'https://www.azavea.com/'),
111     ],
112     'css_files': [
113         '_static/rastervision.css',
114         'https://media.readthedocs.org/css/badge_only.css'
115     ]
116 }
117 html_sidebars = {
118     'index': ['project.html', 'versions.html', 'searchbox.html'],
119     '**': ['project.html', 'localtoc.html', 'relations.html', 'versions.html', 'searchbox.html'],
120 }
121 singlehtml_sidebars = {'index': ['project.html', 'versions.html', 'localtoc.html']}
122 html_static_path = ['_static']
123 html_favicon = '_static/raster-vision-icon.png'
124 html_logo = '_static/raster-vision-logo.png'
125 html_title = 'Raster Vision Documentation ({})'.format(version)
126 html_show_sourcelink = False
127 html_domain_indices = False
128 html_experimental_html5_writer = True
129 
130 # -- Options for HTMLHelp output ---------------------------------------------
131 
132 # Output file base name for HTML help builder.
133 htmlhelp_basename = 'RasterVisiondoc'
134 
135 
136 # -- Options for LaTeX output ------------------------------------------------
137 
138 latex_elements = {
139     # The paper size ('letterpaper' or 'a4paper').
140     #
141     # 'papersize': 'letterpaper',
142 
143     # The font size ('10pt', '11pt' or '12pt').
144     #
145     # 'pointsize': '10pt',
146 
147     # Additional stuff for the LaTeX preamble.
148     #
149     # 'preamble': '',
150 
151     # Latex figure (float) alignment
152     #
153     # 'figure_align': 'htbp',
154 }
155 
156 # Grouping the document tree into LaTeX files. List of tuples
157 # (source start file, target name, title,
158 #  author, documentclass [howto, manual, or own class]).
159 latex_documents = [
160     (master_doc, 'RasterVision.tex', 'Raster Vision Documentation',
161      'Azavea', 'manual'),
162 ]
163 
164 
165 # -- Options for manual page output ------------------------------------------
166 
167 # One entry per manual page. List of tuples
168 # (source start file, name, description, authors, manual section).
169 man_pages = [
170     (master_doc, 'RasterVisoin-{}.tex', html_title,
171      [author], 'manual')
172 ]
173 
174 
175 # -- Options for Texinfo output ----------------------------------------------
176 
177 # Grouping the document tree into Texinfo files. List of tuples
178 # (source start file, target name, title, author,
179 #  dir menu entry, description, category)
180 texinfo_documents = [
181     (master_doc, 'RasterVision', 'Raster Vision Documentation',
182      author, 'RasterVision', 'One line description of project.',
183      'Miscellaneous'),
184 ]
185 
186 
187 # -- Extension configuration -------------------------------------------------
188 
189 programoutput_prompt_template = '> {command}\n{output}'
190 
191 # -- Options for todo extension ----------------------------------------------
192 
193 # If true, `todo` and `todoList` produce output, else they produce nothing.
194 todo_include_todos = True
195
```

Path: `rastervision/backend/pytorch_chip_classification_config.py`
Content:
```
1 from copy import deepcopy
2 
3 import rastervision as rv
4 
5 from rastervision.backend.pytorch_chip_classification import (
6     PyTorchChipClassification)
7 from rastervision.backend.simple_backend_config import (
8     SimpleBackendConfig, SimpleBackendConfigBuilder)
9 from rastervision.backend.api import PYTORCH_CHIP_CLASSIFICATION
10 
11 
12 class TrainOptions():
13     def __init__(self,
14                  batch_size=None,
15                  lr=None,
16                  one_cycle=None,
17                  num_epochs=None,
18                  model_arch=None,
19                  sync_interval=None,
20                  debug=None,
21                  log_tensorboard=None,
22                  run_tensorboard=None):
23         self.batch_size = batch_size
24         self.lr = lr
25         self.one_cycle = one_cycle
26         self.num_epochs = num_epochs
27         self.model_arch = model_arch
28         self.sync_interval = sync_interval
29         self.debug = debug
30         self.log_tensorboard = log_tensorboard
31         self.run_tensorboard = run_tensorboard
32 
33     def __setattr__(self, name, value):
34         if name in ['batch_size', 'num_epochs', 'sync_interval']:
35             value = int(value) if isinstance(value, float) else value
36         super().__setattr__(name, value)
37 
38 
39 class PyTorchChipClassificationConfig(SimpleBackendConfig):
40     train_opts_class = TrainOptions
41     backend_type = PYTORCH_CHIP_CLASSIFICATION
42     backend_class = PyTorchChipClassification
43 
44 
45 class PyTorchChipClassificationConfigBuilder(SimpleBackendConfigBuilder):
46     config_class = PyTorchChipClassificationConfig
47 
48     def _applicable_tasks(self):
49         return [rv.CHIP_CLASSIFICATION]
50 
51     def with_train_options(self,
52                            batch_size=8,
53                            lr=1e-4,
54                            one_cycle=True,
55                            num_epochs=1,
56                            model_arch='resnet18',
57                            sync_interval=1,
58                            debug=False,
59                            log_tensorboard=True,
60                            run_tensorboard=True):
61         """Set options for training models.
62 
63         Args:
64             batch_size: (int) the batch size
65             weight_decay: (float) the weight decay
66             lr: (float) the learning rate if using a fixed LR
67                 (ie. one_cycle is False),
68                 or the maximum LR to use if one_cycle is True
69             one_cycle: (bool) True if cyclic learning rate scheduler should
70                 be used. This
71                 cycles the LR once during the course of training and seems to
72                 result in a pretty consistent improvement. See lr for more
73                 details.
74             num_epochs: (int) number of epochs (sweeps through training set) to
75                 train model for
76             model_arch: (str) classification model backbone to use for UNet
77                 architecture. Any option in torchvision.models is valid, for
78                 example, resnet18.
79             sync_interval: (int) sync training directory to cloud every
80                 sync_interval epochs.
81             debug: (bool) if True, save debug chips (ie. visualizations of
82                 input to model during training) during training and use
83                 single-core for creating minibatches.
84             log_tensorboard: (bool) if True, write events to Tensorboard log
85                 file
86             run_tensorboard: (bool) if True, run a Tensorboard server at
87                 port 6006 that uses the logs generated by the log_tensorboard
88                 option
89         """
90         b = deepcopy(self)
91         b.train_opts = TrainOptions(
92             batch_size=batch_size,
93             lr=lr,
94             one_cycle=one_cycle,
95             num_epochs=num_epochs,
96             model_arch=model_arch,
97             sync_interval=sync_interval,
98             debug=debug,
99             log_tensorboard=log_tensorboard,
100             run_tensorboard=run_tensorboard)
101         return b
102 
103     def with_pretrained_uri(self, pretrained_uri):
104         """pretrained_uri should be uri of exported model file."""
105         return super().with_pretrained_uri(pretrained_uri)
106
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/docs/conf.py b/docs/conf.py
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -44,7 +44,8 @@
     'sphinx.ext.autodoc',
     'sphinx.ext.intersphinx',
     'pallets_sphinx_themes',
-    'sphinxcontrib.programoutput'
+    'sphinxcontrib.programoutput',
+    'sphinxcontrib.napoleon',
 ]
 
 # https://read-the-docs.readthedocs.io/en/latest/faq.html#i-get-import-errors-on-libraries-that-depend-on-c-modules
diff --git a/rastervision/backend/pytorch_chip_classification_config.py b/rastervision/backend/pytorch_chip_classification_config.py
--- a/rastervision/backend/pytorch_chip_classification_config.py
+++ b/rastervision/backend/pytorch_chip_classification_config.py
@@ -73,9 +73,8 @@
                 details.
             num_epochs: (int) number of epochs (sweeps through training set) to
                 train model for
-            model_arch: (str) classification model backbone to use for UNet
-                architecture. Any option in torchvision.models is valid, for
-                example, resnet18.
+            model_arch: (str) Any classification model option in
+                torchvision.models is valid, for example, resnet18.
             sync_interval: (int) sync training directory to cloud every
                 sync_interval epochs.
             debug: (bool) if True, save debug chips (ie. visualizations of

{"golden_diff": "diff --git a/docs/conf.py b/docs/conf.py\n--- a/docs/conf.py\n+++ b/docs/conf.py\n@@ -44,7 +44,8 @@\n     'sphinx.ext.autodoc',\n     'sphinx.ext.intersphinx',\n     'pallets_sphinx_themes',\n-    'sphinxcontrib.programoutput'\n+    'sphinxcontrib.programoutput',\n+    'sphinxcontrib.napoleon',\n ]\n \n # https://read-the-docs.readthedocs.io/en/latest/faq.html#i-get-import-errors-on-libraries-that-depend-on-c-modules\ndiff --git a/rastervision/backend/pytorch_chip_classification_config.py b/rastervision/backend/pytorch_chip_classification_config.py\n--- a/rastervision/backend/pytorch_chip_classification_config.py\n+++ b/rastervision/backend/pytorch_chip_classification_config.py\n@@ -73,9 +73,8 @@\n                 details.\n             num_epochs: (int) number of epochs (sweeps through training set) to\n                 train model for\n-            model_arch: (str) classification model backbone to use for UNet\n-                architecture. Any option in torchvision.models is valid, for\n-                example, resnet18.\n+            model_arch: (str) Any classification model option in\n+                torchvision.models is valid, for example, resnet18.\n             sync_interval: (int) sync training directory to cloud every\n                 sync_interval epochs.\n             debug: (bool) if True, save debug chips (ie. visualizations of\n", "issue": "Get Sphinx to render Google-style API docs correctly\nIn the API docs on RTD https://docs.rastervision.io/en/latest/api.html, the line breaks in the docs aren't rendered correctly. In particular, the `lr` argument for the PyTorch backends is on the same line as the `batch_size` argument, which obscures the `lr` argument. I think this is because we are using Google style PyDocs which aren't natively supported by Sphinx. However, there is a plugin for doing this:\r\n\r\nhttps://stackoverflow.com/questions/7033239/how-to-preserve-line-breaks-when-generating-python-docs-using-sphinx\n", "before_files": [{"content": "from pallets_sphinx_themes import ProjectLink, get_version\n\n# -*- coding: utf-8 -*-\n#\n# Configuration file for the Sphinx documentation builder.\n#\n# This file does only contain a selection of the most common options. For a\n# full list see the documentation:\n# http://www.sphinx-doc.org/en/stable/config\n\n# -- Path setup --------------------------------------------------------------\n\n# If extensions (or modules to document with autodoc) are in another directory,\n# add these directories to sys.path here. If the directory is relative to the\n# documentation root, use os.path.abspath to make it absolute, like shown here.\n#\n# import os\n# import sys\n# sys.path.insert(0, os.path.abspath('.'))\n\n\n# -- Project information -----------------------------------------------------\n\nproject = 'Raster Vision'\ncopyright = '2018, Azavea'\nauthor = 'Azavea'\n\n# The short X.Y version\nversion = '0.10'\n# The full version, including alpha/beta/rc tags\nrelease = '0.10.0'\n\n\n# -- General configuration ---------------------------------------------------\n\n# If your documentation needs a minimal Sphinx version, state it here.\n#\n# needs_sphinx = '1.0'\n\n# Add any Sphinx extension module names here, as strings. They can be\n# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom\n# ones.\nextensions = [\n    'sphinx.ext.autodoc',\n    'sphinx.ext.intersphinx',\n    'pallets_sphinx_themes',\n    'sphinxcontrib.programoutput'\n]\n\n# https://read-the-docs.readthedocs.io/en/latest/faq.html#i-get-import-errors-on-libraries-that-depend-on-c-modules\nimport sys\nfrom unittest.mock import MagicMock\n\nclass Mock(MagicMock):\n    @classmethod\n    def __getattr__(cls, name):\n        return MagicMock()\n\nMOCK_MODULES = ['pyproj', 'h5py']\nsys.modules.update((mod_name, Mock()) for mod_name in MOCK_MODULES)\n\nautodoc_mock_imports = ['torch', 'torchvision', 'pycocotools']\n\nintersphinx_mapping = {'python': ('https://docs.python.org/3/', None)}\n\n# Add any paths that contain templates here, relative to this directory.\ntemplates_path = ['_templates']\n\n# The suffix(es) of source filenames.\n# You can specify multiple suffix as a list of string:\n#\n# source_suffix = ['.rst', '.md']\nsource_suffix = '.rst'\n\n# The master toctree document.\nmaster_doc = 'index'\n\n# The language for content autogenerated by Sphinx. Refer to documentation\n# for a list of supported languages.\n#\n# This is also used if you do content translation via gettext catalogs.\n# Usually you set \"language\" from the command line for these cases.\nlanguage = None\n\n# List of patterns, relative to source directory, that match files and\n# directories to ignore when looking for source files.\n# This pattern also affects html_static_path and html_extra_path .\nexclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', 'README.md']\n\n# The name of the Pygments (syntax highlighting) style to use.\n# pygments_style = 'sphinx'\n\n# HTML -----------------------------------------------------------------\n\nhtml_theme = 'click'\nhtml_theme_options = {'index_sidebar_logo': False}\nhtml_context = {\n    'project_links': [\n        ProjectLink('Quickstart', 'quickstart.html'),\n        ProjectLink('Documentation TOC', 'index.html#documentation'),\n        ProjectLink('API Reference TOC', 'index.html#api-reference'),\n        ProjectLink('Project Website', 'https://rastervision.io/'),\n        ProjectLink('PyPI releases', 'https://pypi.org/project/rastervision/'),\n        ProjectLink('GitHub', 'https://github.com/azavea/raster-vision'),\n        ProjectLink('Gitter Channel', 'https://gitter.im/azavea/raster-vision'),\n        ProjectLink('Raster Vision Examples', 'https://github.com/azavea/raster-vision-examples'),\n        ProjectLink('AWS Batch Setup', 'https://github.com/azavea/raster-vision-aws'),\n        ProjectLink('Issue Tracker', 'https://github.com/azavea/raster-vision/issues/'),\n        ProjectLink('CHANGELOG', 'changelog.html'),\n        ProjectLink('Azavea', 'https://www.azavea.com/'),\n    ],\n    'css_files': [\n        '_static/rastervision.css',\n        'https://media.readthedocs.org/css/badge_only.css'\n    ]\n}\nhtml_sidebars = {\n    'index': ['project.html', 'versions.html', 'searchbox.html'],\n    '**': ['project.html', 'localtoc.html', 'relations.html', 'versions.html', 'searchbox.html'],\n}\nsinglehtml_sidebars = {'index': ['project.html', 'versions.html', 'localtoc.html']}\nhtml_static_path = ['_static']\nhtml_favicon = '_static/raster-vision-icon.png'\nhtml_logo = '_static/raster-vision-logo.png'\nhtml_title = 'Raster Vision Documentation ({})'.format(version)\nhtml_show_sourcelink = False\nhtml_domain_indices = False\nhtml_experimental_html5_writer = True\n\n# -- Options for HTMLHelp output ---------------------------------------------\n\n# Output file base name for HTML help builder.\nhtmlhelp_basename = 'RasterVisiondoc'\n\n\n# -- Options for LaTeX output ------------------------------------------------\n\nlatex_elements = {\n    # The paper size ('letterpaper' or 'a4paper').\n    #\n    # 'papersize': 'letterpaper',\n\n    # The font size ('10pt', '11pt' or '12pt').\n    #\n    # 'pointsize': '10pt',\n\n    # Additional stuff for the LaTeX preamble.\n    #\n    # 'preamble': '',\n\n    # Latex figure (float) alignment\n    #\n    # 'figure_align': 'htbp',\n}\n\n# Grouping the document tree into LaTeX files. List of tuples\n# (source start file, target name, title,\n#  author, documentclass [howto, manual, or own class]).\nlatex_documents = [\n    (master_doc, 'RasterVision.tex', 'Raster Vision Documentation',\n     'Azavea', 'manual'),\n]\n\n\n# -- Options for manual page output ------------------------------------------\n\n# One entry per manual page. List of tuples\n# (source start file, name, description, authors, manual section).\nman_pages = [\n    (master_doc, 'RasterVisoin-{}.tex', html_title,\n     [author], 'manual')\n]\n\n\n# -- Options for Texinfo output ----------------------------------------------\n\n# Grouping the document tree into Texinfo files. List of tuples\n# (source start file, target name, title, author,\n#  dir menu entry, description, category)\ntexinfo_documents = [\n    (master_doc, 'RasterVision', 'Raster Vision Documentation',\n     author, 'RasterVision', 'One line description of project.',\n     'Miscellaneous'),\n]\n\n\n# -- Extension configuration -------------------------------------------------\n\nprogramoutput_prompt_template = '> {command}\\n{output}'\n\n# -- Options for todo extension ----------------------------------------------\n\n# If true, `todo` and `todoList` produce output, else they produce nothing.\ntodo_include_todos = True\n", "path": "docs/conf.py"}, {"content": "from copy import deepcopy\n\nimport rastervision as rv\n\nfrom rastervision.backend.pytorch_chip_classification import (\n    PyTorchChipClassification)\nfrom rastervision.backend.simple_backend_config import (\n    SimpleBackendConfig, SimpleBackendConfigBuilder)\nfrom rastervision.backend.api import PYTORCH_CHIP_CLASSIFICATION\n\n\nclass TrainOptions():\n    def __init__(self,\n                 batch_size=None,\n                 lr=None,\n                 one_cycle=None,\n                 num_epochs=None,\n                 model_arch=None,\n                 sync_interval=None,\n                 debug=None,\n                 log_tensorboard=None,\n                 run_tensorboard=None):\n        self.batch_size = batch_size\n        self.lr = lr\n        self.one_cycle = one_cycle\n        self.num_epochs = num_epochs\n        self.model_arch = model_arch\n        self.sync_interval = sync_interval\n        self.debug = debug\n        self.log_tensorboard = log_tensorboard\n        self.run_tensorboard = run_tensorboard\n\n    def __setattr__(self, name, value):\n        if name in ['batch_size', 'num_epochs', 'sync_interval']:\n            value = int(value) if isinstance(value, float) else value\n        super().__setattr__(name, value)\n\n\nclass PyTorchChipClassificationConfig(SimpleBackendConfig):\n    train_opts_class = TrainOptions\n    backend_type = PYTORCH_CHIP_CLASSIFICATION\n    backend_class = PyTorchChipClassification\n\n\nclass PyTorchChipClassificationConfigBuilder(SimpleBackendConfigBuilder):\n    config_class = PyTorchChipClassificationConfig\n\n    def _applicable_tasks(self):\n        return [rv.CHIP_CLASSIFICATION]\n\n    def with_train_options(self,\n                           batch_size=8,\n                           lr=1e-4,\n                           one_cycle=True,\n                           num_epochs=1,\n                           model_arch='resnet18',\n                           sync_interval=1,\n                           debug=False,\n                           log_tensorboard=True,\n                           run_tensorboard=True):\n        \"\"\"Set options for training models.\n\n        Args:\n            batch_size: (int) the batch size\n            weight_decay: (float) the weight decay\n            lr: (float) the learning rate if using a fixed LR\n                (ie. one_cycle is False),\n                or the maximum LR to use if one_cycle is True\n            one_cycle: (bool) True if cyclic learning rate scheduler should\n                be used. This\n                cycles the LR once during the course of training and seems to\n                result in a pretty consistent improvement. See lr for more\n                details.\n            num_epochs: (int) number of epochs (sweeps through training set) to\n                train model for\n            model_arch: (str) classification model backbone to use for UNet\n                architecture. Any option in torchvision.models is valid, for\n                example, resnet18.\n            sync_interval: (int) sync training directory to cloud every\n                sync_interval epochs.\n            debug: (bool) if True, save debug chips (ie. visualizations of\n                input to model during training) during training and use\n                single-core for creating minibatches.\n            log_tensorboard: (bool) if True, write events to Tensorboard log\n                file\n            run_tensorboard: (bool) if True, run a Tensorboard server at\n                port 6006 that uses the logs generated by the log_tensorboard\n                option\n        \"\"\"\n        b = deepcopy(self)\n        b.train_opts = TrainOptions(\n            batch_size=batch_size,\n            lr=lr,\n            one_cycle=one_cycle,\n            num_epochs=num_epochs,\n            model_arch=model_arch,\n            sync_interval=sync_interval,\n            debug=debug,\n            log_tensorboard=log_tensorboard,\n            run_tensorboard=run_tensorboard)\n        return b\n\n    def with_pretrained_uri(self, pretrained_uri):\n        \"\"\"pretrained_uri should be uri of exported model file.\"\"\"\n        return super().with_pretrained_uri(pretrained_uri)\n", "path": "rastervision/backend/pytorch_chip_classification_config.py"}], "after_files": [{"content": "from pallets_sphinx_themes import ProjectLink, get_version\n\n# -*- coding: utf-8 -*-\n#\n# Configuration file for the Sphinx documentation builder.\n#\n# This file does only contain a selection of the most common options. For a\n# full list see the documentation:\n# http://www.sphinx-doc.org/en/stable/config\n\n# -- Path setup --------------------------------------------------------------\n\n# If extensions (or modules to document with autodoc) are in another directory,\n# add these directories to sys.path here. If the directory is relative to the\n# documentation root, use os.path.abspath to make it absolute, like shown here.\n#\n# import os\n# import sys\n# sys.path.insert(0, os.path.abspath('.'))\n\n\n# -- Project information -----------------------------------------------------\n\nproject = 'Raster Vision'\ncopyright = '2018, Azavea'\nauthor = 'Azavea'\n\n# The short X.Y version\nversion = '0.10'\n# The full version, including alpha/beta/rc tags\nrelease = '0.10.0'\n\n\n# -- General configuration ---------------------------------------------------\n\n# If your documentation needs a minimal Sphinx version, state it here.\n#\n# needs_sphinx = '1.0'\n\n# Add any Sphinx extension module names here, as strings. They can be\n# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom\n# ones.\nextensions = [\n    'sphinx.ext.autodoc',\n    'sphinx.ext.intersphinx',\n    'pallets_sphinx_themes',\n    'sphinxcontrib.programoutput',\n    'sphinxcontrib.napoleon',\n]\n\n# https://read-the-docs.readthedocs.io/en/latest/faq.html#i-get-import-errors-on-libraries-that-depend-on-c-modules\nimport sys\nfrom unittest.mock import MagicMock\n\nclass Mock(MagicMock):\n    @classmethod\n    def __getattr__(cls, name):\n        return MagicMock()\n\nMOCK_MODULES = ['pyproj', 'h5py']\nsys.modules.update((mod_name, Mock()) for mod_name in MOCK_MODULES)\n\nautodoc_mock_imports = ['torch', 'torchvision', 'pycocotools']\n\nintersphinx_mapping = {'python': ('https://docs.python.org/3/', None)}\n\n# Add any paths that contain templates here, relative to this directory.\ntemplates_path = ['_templates']\n\n# The suffix(es) of source filenames.\n# You can specify multiple suffix as a list of string:\n#\n# source_suffix = ['.rst', '.md']\nsource_suffix = '.rst'\n\n# The master toctree document.\nmaster_doc = 'index'\n\n# The language for content autogenerated by Sphinx. Refer to documentation\n# for a list of supported languages.\n#\n# This is also used if you do content translation via gettext catalogs.\n# Usually you set \"language\" from the command line for these cases.\nlanguage = None\n\n# List of patterns, relative to source directory, that match files and\n# directories to ignore when looking for source files.\n# This pattern also affects html_static_path and html_extra_path .\nexclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', 'README.md']\n\n# The name of the Pygments (syntax highlighting) style to use.\n# pygments_style = 'sphinx'\n\n# HTML -----------------------------------------------------------------\n\nhtml_theme = 'click'\nhtml_theme_options = {'index_sidebar_logo': False}\nhtml_context = {\n    'project_links': [\n        ProjectLink('Quickstart', 'quickstart.html'),\n        ProjectLink('Documentation TOC', 'index.html#documentation'),\n        ProjectLink('API Reference TOC', 'index.html#api-reference'),\n        ProjectLink('Project Website', 'https://rastervision.io/'),\n        ProjectLink('PyPI releases', 'https://pypi.org/project/rastervision/'),\n        ProjectLink('GitHub', 'https://github.com/azavea/raster-vision'),\n        ProjectLink('Gitter Channel', 'https://gitter.im/azavea/raster-vision'),\n        ProjectLink('Raster Vision Examples', 'https://github.com/azavea/raster-vision-examples'),\n        ProjectLink('AWS Batch Setup', 'https://github.com/azavea/raster-vision-aws'),\n        ProjectLink('Issue Tracker', 'https://github.com/azavea/raster-vision/issues/'),\n        ProjectLink('CHANGELOG', 'changelog.html'),\n        ProjectLink('Azavea', 'https://www.azavea.com/'),\n    ],\n    'css_files': [\n        '_static/rastervision.css',\n        'https://media.readthedocs.org/css/badge_only.css'\n    ]\n}\nhtml_sidebars = {\n    'index': ['project.html', 'versions.html', 'searchbox.html'],\n    '**': ['project.html', 'localtoc.html', 'relations.html', 'versions.html', 'searchbox.html'],\n}\nsinglehtml_sidebars = {'index': ['project.html', 'versions.html', 'localtoc.html']}\nhtml_static_path = ['_static']\nhtml_favicon = '_static/raster-vision-icon.png'\nhtml_logo = '_static/raster-vision-logo.png'\nhtml_title = 'Raster Vision Documentation ({})'.format(version)\nhtml_show_sourcelink = False\nhtml_domain_indices = False\nhtml_experimental_html5_writer = True\n\n# -- Options for HTMLHelp output ---------------------------------------------\n\n# Output file base name for HTML help builder.\nhtmlhelp_basename = 'RasterVisiondoc'\n\n\n# -- Options for LaTeX output ------------------------------------------------\n\nlatex_elements = {\n    # The paper size ('letterpaper' or 'a4paper').\n    #\n    # 'papersize': 'letterpaper',\n\n    # The font size ('10pt', '11pt' or '12pt').\n    #\n    # 'pointsize': '10pt',\n\n    # Additional stuff for the LaTeX preamble.\n    #\n    # 'preamble': '',\n\n    # Latex figure (float) alignment\n    #\n    # 'figure_align': 'htbp',\n}\n\n# Grouping the document tree into LaTeX files. List of tuples\n# (source start file, target name, title,\n#  author, documentclass [howto, manual, or own class]).\nlatex_documents = [\n    (master_doc, 'RasterVision.tex', 'Raster Vision Documentation',\n     'Azavea', 'manual'),\n]\n\n\n# -- Options for manual page output ------------------------------------------\n\n# One entry per manual page. List of tuples\n# (source start file, name, description, authors, manual section).\nman_pages = [\n    (master_doc, 'RasterVisoin-{}.tex', html_title,\n     [author], 'manual')\n]\n\n\n# -- Options for Texinfo output ----------------------------------------------\n\n# Grouping the document tree into Texinfo files. List of tuples\n# (source start file, target name, title, author,\n#  dir menu entry, description, category)\ntexinfo_documents = [\n    (master_doc, 'RasterVision', 'Raster Vision Documentation',\n     author, 'RasterVision', 'One line description of project.',\n     'Miscellaneous'),\n]\n\n\n# -- Extension configuration -------------------------------------------------\n\nprogramoutput_prompt_template = '> {command}\\n{output}'\n\n# -- Options for todo extension ----------------------------------------------\n\n# If true, `todo` and `todoList` produce output, else they produce nothing.\ntodo_include_todos = True\n", "path": "docs/conf.py"}, {"content": "from copy import deepcopy\n\nimport rastervision as rv\n\nfrom rastervision.backend.pytorch_chip_classification import (\n    PyTorchChipClassification)\nfrom rastervision.backend.simple_backend_config import (\n    SimpleBackendConfig, SimpleBackendConfigBuilder)\nfrom rastervision.backend.api import PYTORCH_CHIP_CLASSIFICATION\n\n\nclass TrainOptions():\n    def __init__(self,\n                 batch_size=None,\n                 lr=None,\n                 one_cycle=None,\n                 num_epochs=None,\n                 model_arch=None,\n                 sync_interval=None,\n                 debug=None,\n                 log_tensorboard=None,\n                 run_tensorboard=None):\n        self.batch_size = batch_size\n        self.lr = lr\n        self.one_cycle = one_cycle\n        self.num_epochs = num_epochs\n        self.model_arch = model_arch\n        self.sync_interval = sync_interval\n        self.debug = debug\n        self.log_tensorboard = log_tensorboard\n        self.run_tensorboard = run_tensorboard\n\n    def __setattr__(self, name, value):\n        if name in ['batch_size', 'num_epochs', 'sync_interval']:\n            value = int(value) if isinstance(value, float) else value\n        super().__setattr__(name, value)\n\n\nclass PyTorchChipClassificationConfig(SimpleBackendConfig):\n    train_opts_class = TrainOptions\n    backend_type = PYTORCH_CHIP_CLASSIFICATION\n    backend_class = PyTorchChipClassification\n\n\nclass PyTorchChipClassificationConfigBuilder(SimpleBackendConfigBuilder):\n    config_class = PyTorchChipClassificationConfig\n\n    def _applicable_tasks(self):\n        return [rv.CHIP_CLASSIFICATION]\n\n    def with_train_options(self,\n                           batch_size=8,\n                           lr=1e-4,\n                           one_cycle=True,\n                           num_epochs=1,\n                           model_arch='resnet18',\n                           sync_interval=1,\n                           debug=False,\n                           log_tensorboard=True,\n                           run_tensorboard=True):\n        \"\"\"Set options for training models.\n\n        Args:\n            batch_size: (int) the batch size\n            weight_decay: (float) the weight decay\n            lr: (float) the learning rate if using a fixed LR\n                (ie. one_cycle is False),\n                or the maximum LR to use if one_cycle is True\n            one_cycle: (bool) True if cyclic learning rate scheduler should\n                be used. This\n                cycles the LR once during the course of training and seems to\n                result in a pretty consistent improvement. See lr for more\n                details.\n            num_epochs: (int) number of epochs (sweeps through training set) to\n                train model for\n            model_arch: (str) Any classification model option in\n                torchvision.models is valid, for example, resnet18.\n            sync_interval: (int) sync training directory to cloud every\n                sync_interval epochs.\n            debug: (bool) if True, save debug chips (ie. visualizations of\n                input to model during training) during training and use\n                single-core for creating minibatches.\n            log_tensorboard: (bool) if True, write events to Tensorboard log\n                file\n            run_tensorboard: (bool) if True, run a Tensorboard server at\n                port 6006 that uses the logs generated by the log_tensorboard\n                option\n        \"\"\"\n        b = deepcopy(self)\n        b.train_opts = TrainOptions(\n            batch_size=batch_size,\n            lr=lr,\n            one_cycle=one_cycle,\n            num_epochs=num_epochs,\n            model_arch=model_arch,\n            sync_interval=sync_interval,\n            debug=debug,\n            log_tensorboard=log_tensorboard,\n            run_tensorboard=run_tensorboard)\n        return b\n\n    def with_pretrained_uri(self, pretrained_uri):\n        \"\"\"pretrained_uri should be uri of exported model file.\"\"\"\n        return super().with_pretrained_uri(pretrained_uri)\n", "path": "rastervision/backend/pytorch_chip_classification_config.py"}]}