Skip to content
This repository has been archived by the owner on Oct 23, 2023. It is now read-only.

Workaround #198

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

IainBerliner
Copy link

Summary

This is intended to demonstrate the workaround I used in connection to the GitHub issue I created.
It's not meant to actually be merged with the main branch.

Changelog

Modified the file PyTorchCoreJSI.mm to repeatedly try installing __torchlive__ if RCTCxxBridge.runtime is null, rather than just giving up.

Modfied the file install-jsi.ts to run all of it's side-effect logic in a function that gets called immediately, and that does a "return;" if the variable "PlayTorchJSIModule" is null, instead of throwing an error. Also added an extra side effect that adds a function to the global object, that can be used to asynchronously await the existence of __torchlive__, before calling other PyTorch code.

Test Plan

The code present in this pull request should prevent the crash that happens when the conditions I mentioned in the GitHub issue are recreated.

Modified the file PyTorchCoreJSI.mm to repeatedly try installing
\_\_torchlive\_\_ if RCTCxxBridge.runtime is null, rather than
just giving up.

Modfied the file install-jsi.ts to run all of it's side-effect logic in
a function that does a "return;" if the variable "PlayTorchJSIModule" is null,
instead of throwing an error. Also added an extra side effect that adds
a function to the global object, that can be used to await the existence
of \_\_torchlive\_\_, before calling other PyTorch code.
@vercel
Copy link

vercel bot commented Feb 13, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated
playtorch ❌ Failed (Inspect) Feb 13, 2023 at 2:43AM (UTC)

@facebook-github-bot
Copy link
Contributor

Hi @IainBerliner!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at [email protected]. Thanks!

@raedle
Copy link
Contributor

raedle commented Feb 21, 2023

Thanks @IainBerliner!

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

Successfully merging this pull request may close these issues.

3 participants