Skip to content

Compatibility of LazyTransform and AffineTransform | Unconditional #1074

Closed

Description

@Baschdl

In e9d8dff (PR #1045) we currently ignore that LazyTransform and AffineTransform | Unconditional are incompatible typewise but this will probably be an issue which will come up more often.
For example right now in #1068 (https://github.com/sbi-dev/sbi/actions/runs/8364627831/job/22900410899): when passing transform: AffineTransform | Unconditional into Flow(transform: LazyTransform, ...)

neural_net = zuko.flows.Flow(transform, flow_built.base)

Activity

  1. added
    hackathon
    on Mar 21, 2024
  2. Baschdl commented on Mar 21, 2024

    @Baschdl
    ContributorAuthor

    I think we could fix this if we return a LazyTransform here:

    sbi/sbi/utils/sbiutils.py

    Lines 178 to 186 in 89c2bde

    if backend == "nflows":
    return transforms.AffineTransform(shift=-t_mean / t_std, scale=1 / t_std)
    elif backend == "zuko":
    return zuko.flows.Unconditional(
    zuko.transforms.MonotonicAffineTransform,
    shift=-t_mean / t_std,
    scale=1 / t_std,
    buffer=True,
    )

    At least if the backend is zuko. @gmoss13 Maybe we can have a look into this together?

  3. gmoss13 commented on Mar 22, 2024

    @gmoss13
    Contributor

    I think this is an issue on the side of Zuko, as they use Unconditional effectively as a LazyTransform, but don't explicitly inherit from LazyTransform. I will write a wrapper we can use, and in the meantime let the Zuko devs know about this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

hackathon

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions