Skip to content

Android JNI llama cache temperature in class #10287

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

Merged
merged 2 commits into from
Apr 22, 2025

Conversation

kirklandsign
Copy link
Contributor

@kirklandsign kirklandsign commented Apr 17, 2025

So far, for LLM, we can use the new config, with cached temperature from ctor. For llava, we use the old workflow.

We will update the API to move temperature from ctor to generate() next.

Test: instrumentation test

Copy link

pytorch-bot bot commented Apr 17, 2025

🔗 Helpful Links

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

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

❗ 1 Active SEVs

There are 1 currently active SEVs. If your PR is affected, please view them below:

❌ 1 New Failure, 1 Unrelated Failure

As of commit e8b0a67 with merge base 96c10bb (image):

NEW FAILURE - The following job has failed:

BROKEN TRUNK - The following job failed but were present on the merge base:

👉 Rebase onto the `viable/strict` branch to avoid these failures

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

@kirklandsign kirklandsign requested a review from Copilot April 17, 2025 23:27
@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 Apr 17, 2025
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces caching for the temperature parameter in the Android JNI layer for llama models. The changes include adding a new member variable to store temperature, initializing that variable in the constructor, and updating the generation configuration to use the cached value.

  • Added a new member variable (temperature_) to cache the temperature.
  • Assigned the temperature parameter to temperature_ in the constructor.
  • Updated the generation configuration to use temperature_.
Comments suppressed due to low confidence (1)

extension/android/jni/jni_layer_llama.cpp:186

  • Please verify that removing the temperature parameter from the MTKLlamaRunner constructor is intentional. If the temperature was previously required by the runner, additional changes in MTKLlamaRunner or its usage may be needed.
tokenizer_path->toStdString().c_str());

@kirklandsign kirklandsign force-pushed the android-temperature-api branch from 18f75b1 to e26af08 Compare April 17, 2025 23:37
Base automatically changed from export-D73091676 to main April 18, 2025 01:55
@kirklandsign kirklandsign force-pushed the android-temperature-api branch from 9f6ee3b to 6dc4fc0 Compare April 18, 2025 02:34
@kirklandsign kirklandsign force-pushed the android-temperature-api branch from 6dc4fc0 to c11f8dc Compare April 19, 2025 00:09
@kirklandsign kirklandsign changed the title [1/N] Android JNI llama cache temperature in class Android JNI llama cache temperature in class Apr 21, 2025
@kirklandsign kirklandsign marked this pull request as ready for review April 21, 2025 17:34
@facebook-github-bot
Copy link
Contributor

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

@facebook-github-bot facebook-github-bot merged commit 3a66b14 into main Apr 22, 2025
83 of 86 checks passed
@facebook-github-bot facebook-github-bot deleted the android-temperature-api branch April 22, 2025 17:37
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