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

.report() print issue with torch.SymInt / torch.SymFloat from torch.compile'd modules #60

Open
kylevedder opened this issue Jul 18, 2024 · 1 comment

Comments

@kylevedder
Copy link

Currently, readable_size() is defined to be

def readable_size(num_bytes: int) -> str:
    return '' if isnan(num_bytes) else '{:.2f}'.format(calmsize(num_bytes))

to inspect my error, I changed it to:

def readable_size(num_bytes: int) -> str:
    calm_res = calmsize(num_bytes)
    try:
        return '' if isnan(num_bytes) else '{:.2f}'.format(calm_res)
    except:
        breakpoint()

Where I have the following trace in PDB:

> /miniconda/lib/python3.11/site-packages/pytorch_memlab/utils.py(9)readable_size()->None
-> breakpoint()
(Pdb) num_bytes
512*ceiling(19*s0/128)
(Pdb) type(num_bytes)
<class 'torch.SymInt'>
(Pdb) calm_res
[rank0]:W0718 17:36:47.217000 140136914814784 torch/fx/experimental/symbolic_shapes.py:3991] Ignored guard Round(ceiling(19*s0/128)/2048) == 4, this could result in accuracy problems
4M<ByteSize amount=ceiling(19*s0/128)/2048>
(Pdb) type(calm_res)
<class 'calmsize.calmsize.ByteSize'>
(Pdb) '{:.2f}'.format(calm_res)
*** TypeError: unsupported format string passed to SymFloat.__format__

This appears to be caused by a lack of support for torch.SymInt by calmsize, which are a product of torch.compile'd modules.

@Stonesjtu
Copy link
Owner

Can you post a minimal reproduce snippet to get SymInt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants