-
-
Notifications
You must be signed in to change notification settings - Fork 51
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
[BUG?] tuple
+ jaxtyping.Num
+ torch.Tensor
= _BeartypeCallHintPepRaiseDesynchronizationException
= 🤮
#312
Comments
In short, you give us nothing but suffering, salty tears, and unreadable exception messages that yield neither consolation nor explication. The above images depict my feelings. @beartype wants to help you – but @beartype has no idea how to help you. Although @beartype is publicly BFFLs with both @patrick-kidger: Do any of the above moon runes mean anything to you? I assume: "No. Please stop pinging me. Your moon runes are your own problem. @MaximilienLC: Would you be able to provide a minimal-reproducible example (MRE) exhibiting this issue? @patrick-kidger wants to help you – but @patrick-kidger has no idea how to help you. The above images depict his feelings, too. |
_BeartypeCallHintPepRaiseDesynchronizationException
tuple
+ jaxtyping.Num
+ torch.Tensor
= _BeartypeCallHintPepRaiseDesynchronizationException
= 🤮
Hmm, this is an odd one! |
Hey both, thanks for the quick replies, will provide more info in the coming day(s), but days might turn into week(s) due to current time constraints 😅 |
Soooooo, I tried reproducing the error a few times in the same environment but it was never raised again 👻 . Anyways here is a type hint that was checked a few lines prior and passed (method argument):
and here's the one that did not:
In jaxtyping notation, the input (
|
Yeah. Nothing suspicious there, I'm afraid. @beartype's support for PEP 484- and 585-compliant Likewise, I trust @patrick-kidger. @patrick-kidger knows things I have only dreamed of in my darkest and most eldritch nightmares. So, the issue probably isn't in You are now thinking to yourself: "@leycec's about to say that I am the problem, isn't he? But I don't wanna be the problem." Parallelism: Python's Bad Boy Rears Its Ugly Head AgainWell, not quite. Instead, I believe that non-deterministic parallelism is the problem – by which I mean some combination of low-level preemptive multi-threading and/or -processing. Although the Python Global Interpreter Lock (GIL) infamously prohibits preemptive multi-threading from pure-Python, that same constraint doesn't apply to low-level things outside Python like C, C++, CUDA, or Rust extensions. Clearly, @beartype and That only leaves something in your full stack as the culprit, @MaximilienLC. Something that is neither @beartype nor Let's See If @leycec Knows What He Is Talking AboutThankfully, this is easy to validate on your end. @MaximilienLC, would you mind temporarily guarding all calls to your problematic function with a standard non-reentrant thread lock: e.g., from threading import Lock
muh_lock = Lock()
with muh_lock:
call_muh_problem_func() If you get deadlocks (i.e., if your app halts at the If the issue still re-arises, however, either:
tl;drFirst, try |
Thanks for the detailed answer @leycec. Unfortunately this time I really won't have the bandwidth to test and report in the coming days. I'll edit my answer when I do 😅 |
Totally. I'm in a similar leaky boat. The waters are rising and all I have is this blue bucket. 🪣 🛥️ On a more pragmatic note, simply disabling @beatrype on problematic callables and classes might be the sanest short-term "solution" for your team: e.g., # Import the requisite machinery.
from beartype import beartype, BeartypeConf, BeartypeStrategy
# Dynamically create a new @nobeartype decorator disabling type-checking.
nobeartype = beartype(conf=BeartypeConf(strategy=BeartypeStrategy.O0))
# Avoid type-checking *ANY* methods or attributes of this class.
@nobeartype
class UncheckedDangerClassIsDangerous(object):
# This method raises *NO* type-checking violation despite returning a
# non-"None" value.
def unchecked_danger_method_is_dangerous(self) -> None:
return 'This string is not "None". Sadly, nobody cares anymore.' When times are desperate, even @beartype lies down. |
Hey Cecil, hope all is well!
Not sure what happened but your brain child asked me to post it so here I am.
tuple
+jaxtyping.Num
on atorch.Tensor
.This is on a remote machine and I can not reproduce the error on my local machine.
Have fun (or not)!
Max
The text was updated successfully, but these errors were encountered: