geowatch.monkey.monkey_torch module

geowatch.monkey.monkey_torch.fix_gelu_issue(method)[source]

Torch 1.12 added an approximate parameter that our old models dont have. Monkey patch it in.

References

https://github.com/pytorch/pytorch/pull/61439

geowatch.monkey.monkey_torch.fix_package_modules()[source]
geowatch.monkey.monkey_torch.add_safe_globals()[source]

Stop gap to allow for loading of common classes now that torch load disallows de-serialization of unknown classes. Safely handles cases where attributes might not exist in different Python/NumPy versions.

References

https://github.com/huggingface/transformers/pull/34632