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

Feat/Add a React Native LLaMA demo app for iOS #7134

Merged
merged 11 commits into from
Dec 4, 2024

Conversation

hietalajulius
Copy link
Contributor

@hietalajulius hietalajulius commented Dec 2, 2024

Summary

rnllama.mov

Add React Native demo application for running LLaMA models

This PR introduces a new React Native mobile application demo that showcases running LLaMA language models on iOS devices using ExecuTorch. Key features include:

  • Setup heavily inspired and based on the LLaMA iOS demo app
  • Complete React Native application setup with Expo
  • Native bridge implementation for ExecuTorch integration
  • Model and tokenizer file selection UI
  • Chat interface for interacting with LLaMA models

The demo app serves as a reference implementation for developers looking to integrate ExecuTorch and LLaMA models into React Native mobile applications. It complements the existing native iOS and Android demo apps by demonstrating cross-platform capabilities.

Release notes: examples

Test plan

Tested model initialization and chat functionality on:

  • iPhone 12 Pro with Llama 3.2 SpinQuant 1B model
  • Verified model loading and tokenizer selection
  • Tested chat interactions and response generation

Copy link

pytorch-bot bot commented Dec 2, 2024

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/7134

Note: Links to docs will display an error until the docs builds have been completed.

❌ 1 New Failure

As of commit f7aec5d with merge base a347665 (image):

NEW FAILURE - The following job has failed:

  • pull / unittest-arm / linux-job (gh)
    RuntimeError: Command docker exec -t a66a97a655a5082ceed83358dbf52129843b1e33d3e725822056ed4055c32132 /exec failed with exit code 1

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Dec 2, 2024
@hietalajulius
Copy link
Contributor Author

@shoumikhin let me know if this is something that would be useful / any feedback on it. I know the Android side would be an useful thing to add but did not have time to look into it yet.

@shoumikhin
Copy link
Contributor

Wow, this looks awesome @hietalajulius!
Thanks a ton :)

@facebook-github-bot
Copy link
Contributor

@shoumikhin has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@shoumikhin
Copy link
Contributor

@pytorchbot label "topic: react native"

Copy link

pytorch-bot bot commented Dec 2, 2024

Didn't find following labels among repository labels: topic: react native

@shoumikhin
Copy link
Contributor

shoumikhin commented Dec 2, 2024

@hietalajulius do you think it's possible to add some info on t/s performance and model load time similar to the iOS app, maybe in a follow up PR?
Also, please address the linter issues here https://github.com/pytorch/executorch/actions/runs/12114604187/job/33804322019?pr=7134

@shoumikhin
Copy link
Contributor

@pytorchbot label "release notes: react native llama demo app for ios"

Copy link

pytorch-bot bot commented Dec 2, 2024

Didn't find following labels among repository labels: release notes: react native llama demo app for ios

@shoumikhin
Copy link
Contributor

@pytorchbot label "topic: not user facing"

@hietalajulius
Copy link
Contributor Author

@hietalajulius do you think it's possible to add some info on t/s performance and model load time similar to the iOS app, maybe in a follow up PR? Also, please address the linter issues here https://github.com/pytorch/executorch/actions/runs/12114604187/job/33804322019?pr=7134

@shoumikhin absolutely, let me add those + fix the linting 👍

@hietalajulius
Copy link
Contributor Author

@hietalajulius do you think it's possible to add some info on t/s performance and model load time similar to the iOS app, maybe in a follow up PR? Also, please address the linter issues here https://github.com/pytorch/executorch/actions/runs/12114604187/job/33804322019?pr=7134

@shoumikhin I added the model load time + tokens/sec info now (screen recording in PR description updated to showcase). The newlines that the linting was complaining about are also removed now, there does not seem to be a way to trigger the job on my end to make sure it passes but the errors were quite trivial.

@facebook-github-bot
Copy link
Contributor

@shoumikhin has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@shoumikhin
Copy link
Contributor

@hietalajulius thanks for the update!
Looks like a few linter nits are still around https://github.com/pytorch/executorch/actions/runs/12133164484/job/33829754778?pr=7134

@hietalajulius
Copy link
Contributor Author

@hietalajulius thanks for the update! Looks like a few linter nits are still around https://github.com/pytorch/executorch/actions/runs/12133164484/job/33829754778?pr=7134

@shoumikhin thanks! I should have taken a closer look at the contributing guide earlier, the lintrunner should be good now, had to add an exclusion to the clang format similar to the ios app.

@facebook-github-bot
Copy link
Contributor

@shoumikhin has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@hietalajulius
Copy link
Contributor Author

Hmm looks like still some permission issue with unittest-arm / linux-job, not entirely sure why

@facebook-github-bot facebook-github-bot merged commit afc2472 into pytorch:main Dec 4, 2024
41 of 43 checks passed
zonglinpeng pushed a commit that referenced this pull request Dec 4, 2024
Differential Revision: D66644092

Pull Request resolved: #7134
@shoumikhin
Copy link
Contributor

@hietalajulius many thanks again for the great contribution!

Out internal vulnerability checker has flagged a potential threat from one of the dependencies, can please take a look?
Apparently upgrading the version of the "cookie" package should be ebough.
Below are the details:

Thanks!

@hietalajulius
Copy link
Contributor Author

@hietalajulius many thanks again for the great contribution!

Out internal vulnerability checker has flagged a potential threat from one of the dependencies, can please take a look? Apparently upgrading the version of the "cookie" package should be ebough. Below are the details:

Thanks!

@shoumikhin thanks for the note! Let me check it out, looks like a transitive dependency of remix-run which is a dep of expo server -> let me try overriding it

@hietalajulius
Copy link
Contributor Author

@hietalajulius many thanks again for the great contribution!

Out internal vulnerability checker has flagged a potential threat from one of the dependencies, can please take a look? Apparently upgrading the version of the "cookie" package should be ebough. Below are the details:

Thanks!

@shoumikhin I posted a PR here: #7218, let me know if that works 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. topic: not user facing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants