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

Prevent restricted types from being connected until valid type is determined #928

Closed
joeyballentine opened this issue Sep 10, 2022 · 4 comments · Fixed by #939
Closed

Prevent restricted types from being connected until valid type is determined #928

joeyballentine opened this issue Sep 10, 2022 · 4 comments · Fixed by #939

Comments

@joeyballentine
Copy link
Member

This may or may not be a good idea, but right now you can connect a node without a type to a node with a restricted type, then do things that determine that node's type to something that would normally not let you connect it.

So basically I just think we shouldn't allow connections unless the type is determined to be a valid type.

This may cause problems for untypable things though, so I don't know if it's actually a good idea to do.

@RunDevelopment
Copy link
Member

Could you give an example?

Right now, I image a case with 3 nodes A, B, and C. C only accepts images with exactly 3 channels. B outputs an image with the same number of channels as its input image. A produces an image with 1 channel. If you connect B to C, and after that A to B, then chainner will allow the connections, but the chain will now error. Is this what you mean?

@joeyballentine
Copy link
Member Author

Yes exactly. If you connected A to B first, then you wouldn't be allowed to connect B to C. But in the way you described, you can bypass the restriction and get a runtime error

@RunDevelopment
Copy link
Member

and get a runtime error

No, the type system will give a static error.

image

@joeyballentine
Copy link
Member Author

That only applies when the output type is determined by the input given (and therefore has a never type).

If for example you were doing a restriction on model type and the output is merely determined by the models scale, then this would not apply.

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

Successfully merging a pull request may close this issue.

2 participants