internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: pytorch/examples

Issue:
cudnn deterministic not guaranteed when seed already set in imagenet
## Context
* Pytorch version: not related
* Operating System and version: not related

## Your Environment
* Is it a CPU or GPU environment?: GPU
* Which example are you using: `imagenet/main.py` https://github.com/pytorch/examples/blob/32f0c1e1073913e75fa75b848bccdbf011b2a569/imagenet/main.py

## Expected Behavior
The whole training will be deterministic when the seed is set, according to the annotations here:

https://github.com/pytorch/examples/blob/32f0c1e1073913e75fa75b848bccdbf011b2a569/imagenet/main.py#L91-L95

## Current Behavior

The `cudnn.benchmark = true` here will indeed introduce nondeterminism, according to [PyTorch docs](https://pytorch.org/docs/stable/notes/randomness.html#cuda-convolution-benchmarking)

https://github.com/pytorch/examples/blob/32f0c1e1073913e75fa75b848bccdbf011b2a569/imagenet/main.py#L207


I will send a pr soon.



Discussion:

Resolving patch:
diff --git a/imagenet/main.py b/imagenet/main.py
--- a/imagenet/main.py
+++ b/imagenet/main.py
@@ -88,6 +88,7 @@ def main():
         random.seed(args.seed)
         torch.manual_seed(args.seed)
         cudnn.deterministic = True
+        cudnn.benchmark = False
         warnings.warn('You have chosen to seed training. '
                       'This will turn on the CUDNN deterministic setting, '
                       'which can slow down your training considerably! '
@@ -204,7 +205,6 @@ def main_worker(gpu, ngpus_per_node, args):
         else:
             print("=> no checkpoint found at '{}'".format(args.resume))
 
-    cudnn.benchmark = True
 
     # Data loading code
     if args.dummy:


Test patch:
Repository: pytorch/examples

Issue:
The GPU load is unbalanced
https://github.com/pytorch/examples/blob/2ee8d43dbe420be152fd5ce0d80b43b419a0e352/distributed/ddp-tutorial-series/multigpu_torchrun.py#L39
When I run the code and resume from a existed .pt file. The memory usage of GPU0 is significantly higher than other GPUs. 
It can be solved by adding a parameter "map_location".
`snapshot = torch.load(snapshot_path, map_location=torch.device('cuda', int(os.environ["LOCAL_RANK"])))`
## My Environment
cudatoolkit 10.2
pytorch 12.1



Discussion:
@lianchengmingjue good catch! By default, torch.load() first loads the snapshot to CPU then moves to the device it was saved from(I guess it's GPU0). In this case, all ranks load the snapshot to GPU0. We should always use "map_location" in torch.load() to load files saved in other environment. Because it might be saved in GPUx which doesn't exist in your host and cause a failure during loading. Please feel free to send a PR for the fix. 
cc: @suraj813 

Resolving patch:
diff --git a/distributed/ddp-tutorial-series/multinode.py b/distributed/ddp-tutorial-series/multinode.py
--- a/distributed/ddp-tutorial-series/multinode.py
+++ b/distributed/ddp-tutorial-series/multinode.py
@@ -37,7 +37,8 @@ def __init__(
         self.model = DDP(self.model, device_ids=[self.local_rank])
 
     def _load_snapshot(self, snapshot_path):
-        snapshot = torch.load(snapshot_path)
+        loc = f"cuda:{self.gpu_id}"
+        snapshot = torch.load(snapshot_path, map_location=loc)
         self.model.load_state_dict(snapshot["MODEL_STATE"])
         self.epochs_run = snapshot["EPOCHS_RUN"]
         print(f"Resuming training from snapshot at Epoch {self.epochs_run}")


Test patch:
Repository: pytorch/examples

Issue:
word Language Model bug
self.decoder = nn.Linear(**ninp**, ntoken) in model.py line 124 shoud be "nhid" 


Discussion:
Would you like to make a PR for this? Just make sure that code still runs and updated README as needed

Resolving patch:
diff --git a/word_language_model/model.py b/word_language_model/model.py
--- a/word_language_model/model.py
+++ b/word_language_model/model.py
@@ -121,7 +121,7 @@ def __init__(self, ntoken, ninp, nhead, nhid, nlayers, dropout=0.5):
         self.transformer_encoder = TransformerEncoder(encoder_layers, nlayers)
         self.encoder = nn.Embedding(ntoken, ninp)
         self.ninp = ninp
-        self.decoder = nn.Linear(ninp, ntoken)
+        self.decoder = nn.Linear(nhid, ntoken)
 
         self.init_weights()
 


Test patch:
Repository: pytorch/examples

Issue:
Add `save_model` arg to `mnist_hogwild` example
Currently the example doesn't support the `--save_model` argument like the other examples



Discussion:

Resolving patch:
diff --git a/mnist_hogwild/main.py b/mnist_hogwild/main.py
--- a/mnist_hogwild/main.py
+++ b/mnist_hogwild/main.py
@@ -30,7 +30,9 @@
 parser.add_argument('--cuda', action='store_true', default=False,
                     help='enables CUDA training')
 parser.add_argument('--mps', action='store_true', default=False,
-                        help='enables macOS GPU training')
+                    help='enables macOS GPU training')
+parser.add_argument('--save_model', action='store_true', default=False,
+                    help='save the trained model to state_dict')
 parser.add_argument('--dry-run', action='store_true', default=False,
                     help='quickly check a single pass')
 
@@ -96,5 +98,8 @@ def forward(self, x):
     for p in processes:
         p.join()
 
+    if args.save_model:
+        torch.save(model.state_dict(), "MNIST_hogwild.pt")
+
     # Once training is complete, we can test the model
     test(args, model, device, dataset2, kwargs)


Test patch:
Repository: ansible-collections/community.vmware

Issue:
vmware_guest_snapshot_info documentation is outdated on website, as folder is now a required parameter
_From @NeverUsedID on Jun 17, 2020 08:57_

<!--- Verify first that your improvement is not already reported on GitHub -->
<!--- Also test if the latest release and devel branch are affected too -->
<!--- Complete *all* sections as described, this form is processed automatically -->

##### SUMMARY
Like in https://github.com/ansible/ansible/issues/22644 for vmware_guest_snapshot,  the documentation for vmware_guest_snapshot_info is outdated, as the folder parameter is now REQUIRED.

<!--- HINT: Did you know the documentation has an "Edit on GitHub" link on every page ? -->

The "Edit on Github Button" does not work, as it throws a 404

##### ISSUE TYPE
- Documentation Report

##### COMPONENT NAME

vmware_guest_snapshot_info


##### ANSIBLE VERSION
<!--- Paste verbatim output from "ansible --version" between quotes -->
```
ansible 2.9.9
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/home/ansible/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/dist-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.12 (default, Apr 15 2020, 17:07:12) [GCC 5.4.0 20160609]

```

##### CONFIGURATION
<!--- Paste verbatim output from "ansible-config dump --only-changed" between quotes -->
```paste below

```

##### OS / ENVIRONMENT
<!--- Provide all relevant information below, e.g. OS version, browser, etc. -->

##### ADDITIONAL INFORMATION
<!--- Describe how this improves the documentation, e.g. before/after situation or screenshots -->

<!--- HINT: You can paste gist.github.com links for larger files -->


_Copied from original issue: ansible/ansible#70111_


Discussion:

Resolving patch:
diff --git a/plugins/modules/vmware_guest_snapshot_info.py b/plugins/modules/vmware_guest_snapshot_info.py
--- a/plugins/modules/vmware_guest_snapshot_info.py
+++ b/plugins/modules/vmware_guest_snapshot_info.py
@@ -48,7 +48,7 @@
    folder:
      description:
      - Destination folder, absolute or relative path to find an existing guest.
-     - This is required only, if multiple virtual machines with same name are found on given vCenter.
+     - This is required parameter, if C(name) is supplied.
      - The folder should include the datacenter. ESX's datacenter is ha-datacenter
      - 'Examples:'
      - '   folder: /ha-datacenter/vm'
@@ -78,6 +78,7 @@
     username: "{{ vcenter_username }}"
     password: "{{ vcenter_password }}"
     datacenter: "{{ datacenter_name }}"
+    folder: "/{{ datacenter_name }}/vm/"
     name: "{{ guest_name }}"
   delegate_to: localhost
   register: snapshot_info


Test patch:
Repository: ansible-collections/community.vmware

Issue:
vmware_cluster: Stop eating exceptions
##### SUMMARY
vmware_cluster ignores a `vim.fault.DuplicateName` which is never a good idea:

https://github.com/ansible-collections/vmware/blob/aee551dc1d1f8a57f58f2da47bef7678b2461973/plugins/modules/vmware_cluster.py#L414-L416

##### ISSUE TYPE
- Bug Report

##### COMPONENT NAME
vmware_cluster

##### ANSIBLE VERSION
```
ansible 2.10.1rc2
  config file = None
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.7/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 3.7.5 (default, Aug  9 2020, 02:16:00) [GCC 7.3.0]
```

##### EXPECTED RESULTS
The module should fail instead of crashing.


##### ACTUAL RESULTS
The module crashes.



Discussion:

Resolving patch:
diff --git a/plugins/modules/vmware_cluster.py b/plugins/modules/vmware_cluster.py
--- a/plugins/modules/vmware_cluster.py
+++ b/plugins/modules/vmware_cluster.py
@@ -411,9 +411,6 @@ def state_create_cluster(self):
             if not self.module.check_mode:
                 self.datacenter.hostFolder.CreateClusterEx(self.cluster_name, cluster_config_spec)
             self.module.exit_json(changed=True)
-        except vim.fault.DuplicateName:
-            # To match other vmware_* modules
-            pass
         except vmodl.fault.InvalidArgument as invalid_args:
             self.module.fail_json(msg="Cluster configuration specification"
                                       " parameter is invalid : %s" % to_native(invalid_args.msg))


Test patch:
Repository: ansible-collections/community.vmware

Issue:
vmware_object_role_permission: Missing required parameters in examples
##### SUMMARY
Examples missing required fields of hostname, username, and password, while other module examples include these.

##### ISSUE TYPE
- Documentation Report

##### COMPONENT NAME
vmware_object_role_permission

##### ADDITIONAL INFORMATION
PR #422 


Discussion:

Resolving patch:
diff --git a/plugins/modules/vmware_object_role_permission.py b/plugins/modules/vmware_object_role_permission.py
--- a/plugins/modules/vmware_object_role_permission.py
+++ b/plugins/modules/vmware_object_role_permission.py
@@ -11,7 +11,7 @@
 __metaclass__ = type
 
 
-DOCUMENTATION = '''
+DOCUMENTATION = r'''
 ---
 module: vmware_object_role_permission
 short_description: Manage local roles on an ESXi host
@@ -73,9 +73,12 @@
 
 '''
 
-EXAMPLES = '''
+EXAMPLES = r'''
 - name: Assign user to VM folder
   community.vmware.vmware_object_role_permission:
+    hostname: '{{ esxi_hostname }}'
+    username: '{{ esxi_username }}'
+    password: '{{ esxi_password }}'
     role: Admin
     principal: user_bob
     object_name: services
@@ -84,6 +87,9 @@
 
 - name: Remove user from VM folder
   community.vmware.vmware_object_role_permission:
+    hostname: '{{ esxi_hostname }}'
+    username: '{{ esxi_username }}'
+    password: '{{ esxi_password }}'
     role: Admin
     principal: user_bob
     object_name: services
@@ -92,6 +98,9 @@
 
 - name: Assign finance group to VM folder
   community.vmware.vmware_object_role_permission:
+    hostname: '{{ esxi_hostname }}'
+    username: '{{ esxi_username }}'
+    password: '{{ esxi_password }}'
     role: Limited Users
     group: finance
     object_name: Accounts
@@ -100,6 +109,9 @@
 
 - name: Assign view_user Read Only permission at root folder
   community.vmware.vmware_object_role_permission:
+    hostname: '{{ esxi_hostname }}'
+    username: '{{ esxi_username }}'
+    password: '{{ esxi_password }}'
     role: ReadOnly
     principal: view_user
     object_name: rootFolder


Test patch:
Repository: ansible-collections/community.vmware

Issue:
Documentation fix needed in community.vmware.vsphere_file module
##### SUMMARY

There is module called **community.vmware.vsphere_file** . There is one task _Query a file on a datastore_  to get information of already existing file on vsphere. But In Documentation there mentioned **state : touch** . But state:touch is used to create new blank file on vsphere,not to get existing file information. In order to Query a file the state attribute value should `file` not touch.   

 **state :  file**

Correct code :

- name: Query a file on a datastore
  community.vmware.vsphere_file:
    host: '{{ vhost }}'
    username: '{{ vuser }}'
    password: '{{ vpass }}'
    datacenter: DC1 Someplace
    datastore: datastore1
    path: some/remote/file
    **state: file**
  delegate_to: localhost
  ignore_errors: true

##### ISSUE TYPE
- Documentation Report

##### COMPONENT NAME

community.vmware.vsphere_file

##### ANSIBLE VERSION

```
ansible 2.10.9
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.6/site-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 3.6.8 (default, Aug 13 2020, 07:46:32) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]


```



Discussion:

Resolving patch:
diff --git a/plugins/modules/vsphere_file.py b/plugins/modules/vsphere_file.py
--- a/plugins/modules/vsphere_file.py
+++ b/plugins/modules/vsphere_file.py
@@ -105,7 +105,7 @@
     datacenter: DC1 Someplace
     datastore: datastore1
     path: some/remote/file
-    state: touch
+    state: file
   delegate_to: localhost
   ignore_errors: true
 


Test patch:
Repository: ansible-collections/community.vmware

Issue:
vmware_host_lockdown crashes on failure
##### SUMMARY
Today, I wanted to enable lockdown mode on a host. This failed, although I didn't find out yet why. But that's not important. The bug is that the module includes `vim` from `pyvmomi` instead of `pyVmomi` and doesn't check that this works:

https://github.com/ansible-collections/community.vmware/blob/f418bdaa6a678c09b6fb9115d927d8c44d50060f/plugins/modules/vmware_host_lockdown.py#L123-L126

I think nobody ran into this issue yet because enabling or disabling lockdown seldom fails (in my experience) and `vim` is only used in this case:

https://github.com/ansible-collections/community.vmware/blob/f418bdaa6a678c09b6fb9115d927d8c44d50060f/plugins/modules/vmware_host_lockdown.py#L176-L182

##### ISSUE TYPE
- Bug Report

##### COMPONENT NAME
vmware_host_lockdown

##### ANSIBLE VERSION
```
ansible [core 2.11.6] 
  config file = None
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.9/site-packages/ansible
  ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.9.1 (default, Aug 19 2021, 02:58:42) [GCC 10.2.0]
  jinja version = 3.0.2
  libyaml = True
```

##### COLLECTION VERSION
```
# /usr/lib/python3.9/site-packages/ansible_collections
Collection       Version
---------------- -------
community.vmware 1.15.0
```

##### CONFIGURATION
```

```

##### OS / ENVIRONMENT
VMware Photon OS 4.0 and vSphere 7.0U2, but this is irrelevant.


##### STEPS TO REPRODUCE
Tricky. As I've said, enabling / disabling lockdown usually works.

##### EXPECTED RESULTS
A failure.


##### ACTUAL RESULTS
```
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: NameError: name 'vim' is not defined
```


Discussion:

Resolving patch:
diff --git a/plugins/modules/vmware_host_lockdown.py b/plugins/modules/vmware_host_lockdown.py
--- a/plugins/modules/vmware_host_lockdown.py
+++ b/plugins/modules/vmware_host_lockdown.py
@@ -121,9 +121,10 @@
 '''
 
 try:
-    from pyvmomi import vim
+    from pyVmomi import vim
+    HAS_PYVMOMI = True
 except ImportError:
-    pass
+    HAS_PYVMOMI = False
 
 from ansible.module_utils.basic import AnsibleModule
 from ansible_collections.community.vmware.plugins.module_utils.vmware import vmware_argument_spec, PyVmomi
@@ -207,6 +208,9 @@ def main():
         ]
     )
 
+    if not HAS_PYVMOMI:
+        module.fail_json(msg='pyvmomi required for this module')
+
     vmware_lockdown_mgr = VmwareLockdownManager(module)
     vmware_lockdown_mgr.ensure()
 


Test patch:
Repository: ansible-collections/community.vmware

Issue:
vsphere_copy: Remove deprecated parameters
##### SUMMARY
The parameters `host` and `login` are deprecated and should be removed in version 3.

##### ISSUE TYPE
- Feature Idea

##### COMPONENT NAME
vsphere_copy

##### ADDITIONAL INFORMATION
#1194

https://github.com/ansible-collections/community.vmware/blob/67b9506a306da2caec9a2eda60003fd54a9df71e/plugins/modules/vsphere_copy.py#L143-L146


Discussion:

Resolving patch:
diff --git a/plugins/modules/vsphere_copy.py b/plugins/modules/vsphere_copy.py
--- a/plugins/modules/vsphere_copy.py
+++ b/plugins/modules/vsphere_copy.py
@@ -18,10 +18,6 @@
 author:
 - Dag Wieers (@dagwieers)
 options:
-  hostname:
-    aliases: ['host']
-  username:
-    aliases: ['login']
   src:
     description:
       - The file to push to vCenter.
@@ -125,8 +121,6 @@ def vmware_path(datastore, datacenter, path):
 def main():
     argument_spec = vmware_argument_spec()
     argument_spec.update(dict(
-        hostname=dict(required=False, aliases=['host']),
-        username=dict(required=False, aliases=['login']),
         src=dict(required=True, aliases=['name']),
         datacenter=dict(required=False),
         datastore=dict(required=True),
@@ -140,11 +134,6 @@ def main():
         supports_check_mode=False,
     )
 
-    if module.params.get('host'):
-        module.deprecate("The 'host' option is being replaced by 'hostname'", version='3.0.0', collection_name='community.vmware')
-    if module.params.get('login'):
-        module.deprecate("The 'login' option is being replaced by 'username'", version='3.0.0', collection_name='community.vmware')
-
     hostname = module.params['hostname']
     username = module.params['username']
     password = module.params.get('password')


Test patch:
Repository: ansible-collections/community.vmware

Issue:
integration tests fail for vmware_guest_instant_clone
##### SUMMARY
The integration tests for `vmware_guest_instant_clone` fail in the CI but I don't understand why.

I've been seeing this for a couple of days in #1553.

##### ISSUE TYPE
- Bug Report

##### COMPONENT NAME
vmware_guest_instant_clone

##### ANSIBLE VERSION
CI

##### COLLECTION VERSION
main

##### CONFIGURATION
CI

##### OS / ENVIRONMENT
CI

##### STEPS TO REPRODUCE
#1554

##### EXPECTED RESULTS
works

##### ACTUAL RESULTS
`Folder not found.` [here](https://ansible.softwarefactory-project.io/zuul/build/460f0dc7728e4688adf96b8e3f63fa9d)


Discussion:
I think there might be a problem with [pyVmomi 8.0.0.1](https://pypi.org/project/pyvmomi/8.0.0.1/) which has been released a few days ago. When I [require pyVmomi==7.0.3 instead of pyVmomi>=6.7](https://github.com/ansible-collections/community.vmware/pull/1554/commits/4a6ebcf00bcb6008c3ab5495e736e39b3a800659) the integration tests [succeed](https://ansible.softwarefactory-project.io/zuul/build/5775c3d1baac4806b152963d2ac05da8).
I think the problem might be here:

https://github.com/ansible-collections/community.vmware/blob/ef21aa90340d96f730954ef6c326b34a2d2de963/plugins/module_utils/vmware.py#L292

With pyVmomi 7.0.3 `part_obj.childType` is a `<class 'pyVmomi.VmomiSupport.str[]'>` and looks like this:

```
part_obj.childType:(str) [
   'Folder',
   'VirtualMachine',
   'VirtualApp'
]
```

With pyVmomi 8.0.0.1 it's a `<class 'pyVmomi.VmomiSupport.type[]'>` and looks like this:

```
part_obj.childType:(type) [
   vim.Folder,
   vim.VirtualMachine,
   vim.VirtualApp
]
```

Resolving patch:
diff --git a/plugins/module_utils/vmware.py b/plugins/module_utils/vmware.py
--- a/plugins/module_utils/vmware.py
+++ b/plugins/module_utils/vmware.py
@@ -289,7 +289,7 @@ def find_folder_by_fqpn(content, folder_name, datacenter_name=None, folder_type=
         for part in folder_parts:
             folder_obj = None
             for part_obj in parent_obj.childEntity:
-                if part_obj.name == part and 'Folder' in part_obj.childType:
+                if part_obj.name == part and ('Folder' in part_obj.childType or vim.Folder in part_obj.childType):
                     folder_obj = part_obj
                     parent_obj = part_obj
                     break


Test patch:
Repository: ansible-collections/community.vmware

Issue:
Missing Quotation mark in vmware_object_rename error message
<!--- Verify first that your issue is not already reported on GitHub -->
<!--- Also test if the latest release and devel branch are affected too -->
<!--- Complete *all* sections as described, this form is processed automatically -->

##### SUMMARY
A question mark before `object type` is missing

https://github.com/ansible-collections/community.vmware/blob/b5eb08db178ead605a0f233f8a88ef6435b5c709/plugins/modules/vmware_object_rename.py#L275

##### ISSUE TYPE
- Bug Report

##### COMPONENT NAME
vmware_object_rename



Discussion:

Resolving patch:
diff --git a/plugins/modules/vmware_object_rename.py b/plugins/modules/vmware_object_rename.py
--- a/plugins/modules/vmware_object_rename.py
+++ b/plugins/modules/vmware_object_rename.py
@@ -272,7 +272,7 @@ def ensure_state(self):
             self.module.exit_json(**results)
 
         if not all_vmware_objs:
-            msg = "Failed to find object with %s '%s' and %s' object type"
+            msg = "Failed to find object with %s '%s' and '%s' object type"
             if self.object_name:
                 msg = msg % ('name', self.object_name, self.object_type)
             elif self.object_moid:


Test patch: