Skip to content

Fix problems in hello_world - #649

Merged
copybara-service[bot] merged 2 commits into
google:devfrom
KaranocaVe:main
Aug 8, 2025
Merged

copybara-service[bot] merged 2 commits into
google:devfrom
KaranocaVe:main

Conversation

@KaranocaVe

Copy link
Copy Markdown
Contributor

This pull request makes several updates to the examples/hello_world project, including configuration changes, dependency updates, and code improvements. The most important changes involve upgrading dependencies, modifying runtime logic, and refining the documentation.

Dependency Updates:

I will rely on updating to the latest version that can compile normally (the original dependency version will cause header files to be missing).

  • examples/hello_world/CMakeLists.txt: Updated the highway and sentencepiece dependencies to newer Git tags (bfc36a6e633af94e63ac4b91c687bf0354cb24e0 and 9045b2f60fa2b323dfac0eaef8fc17565036f9f9, respectively). Also updated the gemma.cpp dependency to a newer Git tag (4a924f179448dc83e46a2af9520c61b4ef56174c). [1] [2]

Code Improvements:

  • examples/hello_world/run.cc: Refactored the accept_token logic in model.Generate to use std::function<bool(int, float)> and replaced contains with find for better compatibility and clarity.
  • examples/hello_world/run.cc: Fixed a minor formatting issue in the main function declaration by adjusting whitespace.

Documentation Updates:

@google-cla

google-cla Bot commented Jul 30, 2025

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@KaranocaVe KaranocaVe changed the title Fix problems in hellow_word Fix problems in hello_word Jul 30, 2025
@KaranocaVe KaranocaVe changed the title Fix problems in hello_word Fix problems in hello_world Jul 30, 2025
jan-wassenberg
jan-wassenberg previously approved these changes Jul 30, 2025

@jan-wassenberg jan-wassenberg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for updating this example code :)

Comment thread examples/hello_world/run.cc Outdated
// Placeholder for internal init, do not modify.
}
int main(int argc, char **argv) { {
// Placeholder for internal init, do not modify.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This placeholder is no longer necessary and can be removed :)

@jan-wassenberg jan-wassenberg added copybara-import Trigger Copybara for merging pull requests and removed copybara-import Trigger Copybara for merging pull requests labels Jul 30, 2025
@jan-wassenberg

Copy link
Copy Markdown
Member

Merging failed and I've been investigating why. Just realized that the patch is targeting main branch, but this doesn't work with our tooling. Can you please send a PR for the dev branch?

@KaranocaVe KaranocaVe changed the title Fix problems in hello_world 修复hello_world中的问题 Jul 31, 2025
@KaranocaVe KaranocaVe changed the title 修复hello_world中的问题 Fix problems in hello_world Jul 31, 2025
@KaranocaVe
KaranocaVe changed the base branch from main to dev July 31, 2025 14:33
@KaranocaVe
KaranocaVe dismissed jan-wassenberg’s stale review July 31, 2025 14:33

The base branch was changed.

@KaranocaVe

Copy link
Copy Markdown
Contributor Author

Merging failed and I've been investigating why. Just realized that the patch is targeting main branch, but this doesn't work with our tooling. Can you please send a PR for the dev branch?

I have change the target

@jan-wassenberg

Copy link
Copy Markdown
Member

There were several merge issues. I've patched the PR and we will land it soon.

@copybara-service
copybara-service Bot merged commit 2e9c93a into google:dev Aug 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

copybara-import Trigger Copybara for merging pull requests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants