BindsNet error (Can't pickle obj)

username: GIdia
cooked: <pre><code>for step, batch in enumerate(tqdm(dataloader)):
    # Get next input sample.
    inpts = {"X": batch["encoded_image"].view(time, 1, 1, 28, 28)}
    if gpu:
        inpts = {k: v.cuda() for k, v in inpts.items()}

    if step % update_interval == 0 and step &gt; 0:
        # Convert the array of labels into a tensor
        label_tensor = torch.tensor(labels)

        # Get network predictions.
        all_activity_pred = all_activity(
            spikes=spike_record, assignments=assignments, n_labels=n_classes
        )
        proportion_pred = proportion_weighting(
            spikes=spike_record,
            assignments=assignments,
            proportions=proportions,
            n_labels=n_classes,
        )

        # Compute network accuracy according to available classification strategies.
        accuracy["all"].append(
            100
            * torch.sum(label_tensor.long() == all_activity_pred).item()
            / len(label_tensor)
        )
        accuracy["proportion"].append(
            100
            * torch.sum(label_tensor.long() == proportion_pred).item()
            / len(label_tensor)
        )

        print(
            "\nAll activity accuracy: %.2f (last), %.2f (average), %.2f (best)"
            % (
                accuracy["all"][-1],
                np.mean(accuracy["all"]),
                np.max(accuracy["all"]),
            )
        )
        print(
            "Proportion weighting accuracy: %.2f (last), %.2f (average), %.2f (best)\n"
            % (
                accuracy["proportion"][-1],
                np.mean(accuracy["proportion"]),
                np.max(accuracy["proportion"]),
            )
        )

        # Assign labels to excitatory layer neurons.
        assignments, proportions, rates = assign_labels(
            spikes=spike_record,
            labels=label_tensor,
            n_labels=n_classes,
            rates=rates,
        )

        labels = []

    labels.append(batch["label"])

    # Run the network on the input.
    network.run(inpts=inpts, time=time, input_time_dim=1)

    # Get voltage recording.
    exc_voltages = exc_voltage_monitor.get("v")
    inh_voltages = inh_voltage_monitor.get("v")

    # Add to spikes recording.
    spike_record[step % update_interval] = spikes["Ae"].get("s").squeeze()

    # Optionally plot various simulation information.
    if plot:
        image = batch["image"].view(28, 28)
        inpt = inpts["X"].view(time, 784).sum(0).view(28, 28)
        input_exc_weights = network.connections[("X", "Ae")].w
        square_weights = get_square_weights(
            input_exc_weights.view(784, n_neurons), n_sqrt, 28
        )
        square_assignments = get_square_assignments(assignments, n_sqrt)
        spikes_ = {layer: spikes[layer].get("s") for layer in spikes}
        voltages = {"Ae": exc_voltages, "Ai": inh_voltages}
        #
        inpt_axes, inpt_ims = plot_input(
            image, inpt, label=labels[step], axes=inpt_axes, ims=inpt_ims
        )
        spike_ims, spike_axes = plot_spikes(spikes_, ims=spike_ims, axes=spike_axes)
        weights_im = plot_weights(square_weights, im=weights_im)
        assigns_im = plot_assignments(square_assignments, im=assigns_im)
        perf_ax = plot_performance(accuracy, ax=perf_ax)
        voltage_ims, voltage_axes = plot_voltages(
            voltages, ims=voltage_ims, axes=voltage_axes, plot_type="line"
        )

        plt.pause(1e-8)

    network.reset_()  # Reset state variables.  
</code></pre>
<p>File “C:/Users/user/PycharmProjects/bindsnet-master/bindsnet-master/examples/mnist/eth_mnist.py”, line 164, in <br>
for step, batch in enumerate(tqdm(dataloader)):<br>
File “C:\Users\user\Anaconda3\envs\myspace\lib\site-packages\tqdm_tqdm.py”, line 1034, in <strong>iter</strong><br>
for obj in iterable:<br>
File “C:\Users\user\Anaconda3\envs\myspace\lib\site-packages\torch\utils\data\dataloader.py”, line 278, in <strong>iter</strong><br>
return _MultiProcessingDataLoaderIter(self)<br>
File “C:\Users\user\Anaconda3\envs\myspace\lib\site-packages\torch\utils\data\dataloader.py”, line 682, in <strong>init</strong><br>
w.start()<br>
File “C:\Users\user\Anaconda3\envs\myspace\lib\multiprocessing\process.py”, line 112, in start<br>
self._popen = self._Popen(self)<br>
File “C:\Users\user\Anaconda3\envs\myspace\lib\multiprocessing\context.py”, line 223, in _Popen<br>
return _default_context.get_context().Process._Popen(process_obj)<br>
File “C:\Users\user\Anaconda3\envs\myspace\lib\multiprocessing\context.py”, line 322, in _Popen<br>
return Popen(process_obj)<br>
File “C:\Users\user\Anaconda3\envs\myspace\lib\multiprocessing\popen_spawn_win32.py”, line 89, in <strong>init</strong><br>
reduction.dump(process_obj, to_child)<br>
File “C:\Users\user\Anaconda3\envs\myspace\lib\multiprocessing\reduction.py”, line 60, in dump<br>
ForkingPickler(file, protocol).dump(obj)<br>
AttributeError: Can’t pickle local object ‘create_torchvision_dataset_wrapper..TorchvisionDatasetWrapper’<br>
0%|          | 0/60000 [00:00&lt;?, ?it/s]</p>
<p>Process finished with exit code 1</p>
<p>I get the following error but I can’t figure out why. Has anyone solved the same error?</p>

username: XiaoYunKai
cooked: <p>I have met the same question, and I also don’t know how to solve it, did you fix it?</p>