Skip to content

pytorch_experiment.py example not working #28

Description

@weicheng113

following up #14

There maybe some more update again. But it would be good to have pytorch_experiment.py updated also.

use loggers={"visdom": "visdom"} instead of loggers={"vlog": "visdom"}, which is because of pytorchexperiment.vlog(self) implementation.

 exp = MNIST_experiment(config=c, name='experiment', n_epochs=c.n_epochs,
                           seed=42, base_dir='./experiment_dir',
                           loggers={"visdom": "visdom"})

pytorch torchvision.utils.save_image method signature below, but pytorchplotfilelogger.save_image_grid_static

# pytorchplotfilelogger.save_image_grid_static
pytorchplotfilelogger.save_image_grid_static(...):
  tv_save_image(tensor=tensor, filename=img_file, **image_args) # this does not match save_image signature below.

# torchvision.utils.save_image method signature below
def save_image(
    tensor: Union[torch.Tensor, List[torch.Tensor]],
    fp: Union[Text, pathlib.Path, BinaryIO],
    format: Optional[str] = None,
    **kwargs
) -> None:

result in the error below:

Unhandled exception in thread started by <function PytorchPlotFileLogger.save_image_grid_static at 0x000002456711CAF8>
Traceback (most recent call last):
  File "C:\Users\...\lib\site-packages\trixi\logger\file\pytorchplotfilelogger.py", line 183, in save_image_grid_static
    tv_save_image(tensor=tensor, filename=img_file, **image_args)
  File "C:\Users\...t\lib\site-packages\torch\autograd\grad_mode.py", line 28, in decorate_context
    return func(*args, **kwargs)
TypeError: save_image() missing 1 required positional argument: 'fp'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions