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

How to modify max seq len in android llama demo app? #3674

Open
CHNtentes opened this issue May 20, 2024 · 1 comment
Open

How to modify max seq len in android llama demo app? #3674

CHNtentes opened this issue May 20, 2024 · 1 comment
Assignees
Labels
module: examples Issues related to demos under examples directory

Comments

@CHNtentes
Copy link

Hi,
I tried android llama demo app. While it works, I don't know how to make generated text longer.
I already set max length to 4096 when exporting pte model, and when I use llama_main cli I can set seq_len to 4096.
How do I modify this value in demo app code?

@mergennachin mergennachin added the module: examples Issues related to demos under examples directory label May 20, 2024
@afwcole
Copy link

afwcole commented Jun 6, 2024

Hey I ran into this issue aswell. You have to edit the sequence length in the jni_layer_llama.cpp file. can be found in the following folder "extension/android/jni/jni_layer_llama.cpp" for the generate function.

It is set to 128 but you will have to change it 4096
jint generate( facebook::jni::alias_ref<jstring> prompt, facebook::jni::alias_ref<ExecuTorchLlamaCallbackJni> callback) { runner_->generate( prompt->toStdString(), **4096,** [callback](std::string result) { callback->onResult(result); }, [callback](const Runner::Stats& result) { callback->onStats(result); }); return 0; }

Here is the link to the line you have to change here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module: examples Issues related to demos under examples directory
Projects
None yet
Development

No branches or pull requests

4 participants