We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
torchgeo.models.RFC should have a seed argument
The parameters of this model are randomly initialized, but it is not trainable. To have repeatable results with this we need a seed parameter so we can guarantee that parameter init happens the same.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `torchgeo/models/rcf.py`
Content:
```
1 # Copyright (c) Microsoft Corporation. All rights reserved.
2 # Licensed under the MIT License.
3 
4 """Implementation of a random convolutional feature projection model."""
5 
6 from typing import cast
7 
8 import torch
9 import torch.nn.functional as F
10 from torch import Tensor
11 from torch.nn.modules import Conv2d, Module
12 
13 Module.__module__ = "torch.nn"
14 Conv2d.__module__ = "torch.nn"
15 
16 
17 class RCF(Module):
18     """This model extracts random convolutional features (RCFs) from its input.
19 
20     RCFs are used in Multi-task Observation using Satellite Imagery & Kitchen Sinks
21     (MOSAIKS) method proposed in https://www.nature.com/articles/s41467-021-24638-z.
22 
23     .. note::
24 
25         This Module is *not* trainable. It is only used as a feature extractor.
26     """
27 
28     def __init__(
29         self,
30         in_channels: int = 4,
31         features: int = 16,
32         kernel_size: int = 3,
33         bias: float = -1.0,
34     ) -> None:
35         """Initializes the RCF model.
36 
37         This is a static model that serves to extract fixed length feature vectors from
38         input patches.
39 
40         Args:
41             in_channels: number of input channels
42             features: number of features to compute, must be divisible by 2
43             kernel_size: size of the kernel used to compute the RCFs
44             bias: bias of the convolutional layer
45         """
46         super().__init__()
47 
48         assert features % 2 == 0
49 
50         # We register the weight and bias tensors as "buffers". This does two things:
51         # makes them behave correctly when we call .to(...) on the module, and makes
52         # them explicitely _not_ Parameters of the model (which might get updated) if
53         # a user tries to train with this model.
54         self.register_buffer(
55             "weights",
56             torch.randn(
57                 features // 2,
58                 in_channels,
59                 kernel_size,
60                 kernel_size,
61                 requires_grad=False,
62             ),
63         )
64         self.register_buffer(
65             "biases",
66             torch.zeros(  # type: ignore[attr-defined]
67                 features // 2, requires_grad=False
68             )
69             + bias,
70         )
71 
72     def forward(self, x: Tensor) -> Tensor:
73         """Forward pass of the RCF model.
74 
75         Args:
76             x: a tensor with shape (B, C, H, W)
77 
78         Returns:
79             a tensor of size (B, ``self.num_features``)
80         """
81         x1a = F.relu(
82             F.conv2d(x, self.weights, bias=self.biases, stride=1, padding=0),
83             inplace=True,
84         )
85         x1b = F.relu(
86             -F.conv2d(x, self.weights, bias=self.biases, stride=1, padding=0),
87             inplace=False,
88         )
89 
90         x1a = F.adaptive_avg_pool2d(x1a, (1, 1)).squeeze()
91         x1b = F.adaptive_avg_pool2d(x1b, (1, 1)).squeeze()
92 
93         if len(x1a.shape) == 1:  # case where we passed a single input
94             output = torch.cat((x1a, x1b), dim=0)  # type: ignore[attr-defined]
95             return cast(Tensor, output)
96         else:  # case where we passed a batch of > 1 inputs
97             assert len(x1a.shape) == 2
98             output = torch.cat((x1a, x1b), dim=1)  # type: ignore[attr-defined]
99             return cast(Tensor, output)
100
```
--- 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/torchgeo/models/rcf.py b/torchgeo/models/rcf.py
--- a/torchgeo/models/rcf.py
+++ b/torchgeo/models/rcf.py
@@ -3,7 +3,7 @@
 
 """Implementation of a random convolutional feature projection model."""
 
-from typing import cast
+from typing import Optional, cast
 
 import torch
 import torch.nn.functional as F
@@ -31,6 +31,7 @@
         features: int = 16,
         kernel_size: int = 3,
         bias: float = -1.0,
+        seed: Optional[int] = None,
     ) -> None:
         """Initializes the RCF model.
 
@@ -42,11 +43,19 @@
             features: number of features to compute, must be divisible by 2
             kernel_size: size of the kernel used to compute the RCFs
             bias: bias of the convolutional layer
+            seed: random seed used to initialize the convolutional layer
         """
         super().__init__()
 
         assert features % 2 == 0
 
+        if seed is None:
+            generator = None
+        else:
+            generator = torch.Generator().manual_seed(  # type: ignore[attr-defined]
+                seed
+            )
+
         # We register the weight and bias tensors as "buffers". This does two things:
         # makes them behave correctly when we call .to(...) on the module, and makes
         # them explicitely _not_ Parameters of the model (which might get updated) if
@@ -59,6 +68,7 @@
                 kernel_size,
                 kernel_size,
                 requires_grad=False,
+                generator=generator,
             ),
         )
         self.register_buffer(

{"golden_diff": "diff --git a/torchgeo/models/rcf.py b/torchgeo/models/rcf.py\n--- a/torchgeo/models/rcf.py\n+++ b/torchgeo/models/rcf.py\n@@ -3,7 +3,7 @@\n \n \"\"\"Implementation of a random convolutional feature projection model.\"\"\"\n \n-from typing import cast\n+from typing import Optional, cast\n \n import torch\n import torch.nn.functional as F\n@@ -31,6 +31,7 @@\n         features: int = 16,\n         kernel_size: int = 3,\n         bias: float = -1.0,\n+        seed: Optional[int] = None,\n     ) -> None:\n         \"\"\"Initializes the RCF model.\n \n@@ -42,11 +43,19 @@\n             features: number of features to compute, must be divisible by 2\n             kernel_size: size of the kernel used to compute the RCFs\n             bias: bias of the convolutional layer\n+            seed: random seed used to initialize the convolutional layer\n         \"\"\"\n         super().__init__()\n \n         assert features % 2 == 0\n \n+        if seed is None:\n+            generator = None\n+        else:\n+            generator = torch.Generator().manual_seed(  # type: ignore[attr-defined]\n+                seed\n+            )\n+\n         # We register the weight and bias tensors as \"buffers\". This does two things:\n         # makes them behave correctly when we call .to(...) on the module, and makes\n         # them explicitely _not_ Parameters of the model (which might get updated) if\n@@ -59,6 +68,7 @@\n                 kernel_size,\n                 kernel_size,\n                 requires_grad=False,\n+                generator=generator,\n             ),\n         )\n         self.register_buffer(\n", "issue": "torchgeo.models.RFC should have a seed argument\nThe parameters of this model are randomly initialized, but it is not trainable. To have repeatable results with this we need a seed parameter so we can guarantee that parameter init happens the same.\n", "before_files": [{"content": "# Copyright (c) Microsoft Corporation. All rights reserved.\n# Licensed under the MIT License.\n\n\"\"\"Implementation of a random convolutional feature projection model.\"\"\"\n\nfrom typing import cast\n\nimport torch\nimport torch.nn.functional as F\nfrom torch import Tensor\nfrom torch.nn.modules import Conv2d, Module\n\nModule.__module__ = \"torch.nn\"\nConv2d.__module__ = \"torch.nn\"\n\n\nclass RCF(Module):\n    \"\"\"This model extracts random convolutional features (RCFs) from its input.\n\n    RCFs are used in Multi-task Observation using Satellite Imagery & Kitchen Sinks\n    (MOSAIKS) method proposed in https://www.nature.com/articles/s41467-021-24638-z.\n\n    .. note::\n\n        This Module is *not* trainable. It is only used as a feature extractor.\n    \"\"\"\n\n    def __init__(\n        self,\n        in_channels: int = 4,\n        features: int = 16,\n        kernel_size: int = 3,\n        bias: float = -1.0,\n    ) -> None:\n        \"\"\"Initializes the RCF model.\n\n        This is a static model that serves to extract fixed length feature vectors from\n        input patches.\n\n        Args:\n            in_channels: number of input channels\n            features: number of features to compute, must be divisible by 2\n            kernel_size: size of the kernel used to compute the RCFs\n            bias: bias of the convolutional layer\n        \"\"\"\n        super().__init__()\n\n        assert features % 2 == 0\n\n        # We register the weight and bias tensors as \"buffers\". This does two things:\n        # makes them behave correctly when we call .to(...) on the module, and makes\n        # them explicitely _not_ Parameters of the model (which might get updated) if\n        # a user tries to train with this model.\n        self.register_buffer(\n            \"weights\",\n            torch.randn(\n                features // 2,\n                in_channels,\n                kernel_size,\n                kernel_size,\n                requires_grad=False,\n            ),\n        )\n        self.register_buffer(\n            \"biases\",\n            torch.zeros(  # type: ignore[attr-defined]\n                features // 2, requires_grad=False\n            )\n            + bias,\n        )\n\n    def forward(self, x: Tensor) -> Tensor:\n        \"\"\"Forward pass of the RCF model.\n\n        Args:\n            x: a tensor with shape (B, C, H, W)\n\n        Returns:\n            a tensor of size (B, ``self.num_features``)\n        \"\"\"\n        x1a = F.relu(\n            F.conv2d(x, self.weights, bias=self.biases, stride=1, padding=0),\n            inplace=True,\n        )\n        x1b = F.relu(\n            -F.conv2d(x, self.weights, bias=self.biases, stride=1, padding=0),\n            inplace=False,\n        )\n\n        x1a = F.adaptive_avg_pool2d(x1a, (1, 1)).squeeze()\n        x1b = F.adaptive_avg_pool2d(x1b, (1, 1)).squeeze()\n\n        if len(x1a.shape) == 1:  # case where we passed a single input\n            output = torch.cat((x1a, x1b), dim=0)  # type: ignore[attr-defined]\n            return cast(Tensor, output)\n        else:  # case where we passed a batch of > 1 inputs\n            assert len(x1a.shape) == 2\n            output = torch.cat((x1a, x1b), dim=1)  # type: ignore[attr-defined]\n            return cast(Tensor, output)\n", "path": "torchgeo/models/rcf.py"}], "after_files": [{"content": "# Copyright (c) Microsoft Corporation. All rights reserved.\n# Licensed under the MIT License.\n\n\"\"\"Implementation of a random convolutional feature projection model.\"\"\"\n\nfrom typing import Optional, cast\n\nimport torch\nimport torch.nn.functional as F\nfrom torch import Tensor\nfrom torch.nn.modules import Conv2d, Module\n\nModule.__module__ = \"torch.nn\"\nConv2d.__module__ = \"torch.nn\"\n\n\nclass RCF(Module):\n    \"\"\"This model extracts random convolutional features (RCFs) from its input.\n\n    RCFs are used in Multi-task Observation using Satellite Imagery & Kitchen Sinks\n    (MOSAIKS) method proposed in https://www.nature.com/articles/s41467-021-24638-z.\n\n    .. note::\n\n        This Module is *not* trainable. It is only used as a feature extractor.\n    \"\"\"\n\n    def __init__(\n        self,\n        in_channels: int = 4,\n        features: int = 16,\n        kernel_size: int = 3,\n        bias: float = -1.0,\n        seed: Optional[int] = None,\n    ) -> None:\n        \"\"\"Initializes the RCF model.\n\n        This is a static model that serves to extract fixed length feature vectors from\n        input patches.\n\n        Args:\n            in_channels: number of input channels\n            features: number of features to compute, must be divisible by 2\n            kernel_size: size of the kernel used to compute the RCFs\n            bias: bias of the convolutional layer\n            seed: random seed used to initialize the convolutional layer\n        \"\"\"\n        super().__init__()\n\n        assert features % 2 == 0\n\n        if seed is None:\n            generator = None\n        else:\n            generator = torch.Generator().manual_seed(  # type: ignore[attr-defined]\n                seed\n            )\n\n        # We register the weight and bias tensors as \"buffers\". This does two things:\n        # makes them behave correctly when we call .to(...) on the module, and makes\n        # them explicitely _not_ Parameters of the model (which might get updated) if\n        # a user tries to train with this model.\n        self.register_buffer(\n            \"weights\",\n            torch.randn(\n                features // 2,\n                in_channels,\n                kernel_size,\n                kernel_size,\n                requires_grad=False,\n                generator=generator,\n            ),\n        )\n        self.register_buffer(\n            \"biases\",\n            torch.zeros(  # type: ignore[attr-defined]\n                features // 2, requires_grad=False\n            )\n            + bias,\n        )\n\n    def forward(self, x: Tensor) -> Tensor:\n        \"\"\"Forward pass of the RCF model.\n\n        Args:\n            x: a tensor with shape (B, C, H, W)\n\n        Returns:\n            a tensor of size (B, ``self.num_features``)\n        \"\"\"\n        x1a = F.relu(\n            F.conv2d(x, self.weights, bias=self.biases, stride=1, padding=0),\n            inplace=True,\n        )\n        x1b = F.relu(\n            -F.conv2d(x, self.weights, bias=self.biases, stride=1, padding=0),\n            inplace=False,\n        )\n\n        x1a = F.adaptive_avg_pool2d(x1a, (1, 1)).squeeze()\n        x1b = F.adaptive_avg_pool2d(x1b, (1, 1)).squeeze()\n\n        if len(x1a.shape) == 1:  # case where we passed a single input\n            output = torch.cat((x1a, x1b), dim=0)  # type: ignore[attr-defined]\n            return cast(Tensor, output)\n        else:  # case where we passed a batch of > 1 inputs\n            assert len(x1a.shape) == 2\n            output = torch.cat((x1a, x1b), dim=1)  # type: ignore[attr-defined]\n            return cast(Tensor, output)\n", "path": "torchgeo/models/rcf.py"}]}