Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLI fails with torch.dtype arguments #446

Closed
ioangatop opened this issue Feb 1, 2024 · 1 comment · Fixed by #448
Closed

CLI fails with torch.dtype arguments #446

ioangatop opened this issue Feb 1, 2024 · 1 comment · Fixed by #448
Labels
bug Something isn't working

Comments

@ioangatop
Copy link
Contributor

ioangatop commented Feb 1, 2024

🐛 Bug report

The CLI seems to not be able to handle torch.dtype arguments; pretty important for torchvision ToDtype transform.

To reproduce

Using the CLI:

# main.py
import torch
from jsonargparse import CLI


def interface(dtype: torch.dtype) -> None:
    print(f"dtype: {dtype} ({type(dtype)})")

CLI(interface)

Run with:

python3 main.py torch.float32

Expected behaviour:

The above to print:

dtype: torch.float32 (<class 'torch.dtype'>)

Environment

  • jsonargparse version (e.g., 4.8.0):
  • Python version (e.g., 3.9):
  • How jsonargparse was installed (e.g. pip install jsonargparse[all]):
  • OS (e.g., Linux):
@ioangatop ioangatop added the bug Something isn't working label Feb 1, 2024
@ioangatop ioangatop changed the title CLI fails with torch.dtype arguments CLI fails with torch.dtype arguments Feb 1, 2024
@mauvilsa
Copy link
Member

mauvilsa commented Feb 5, 2024

Thank you for repointing! This should be fixed with the pull request that was just merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants