Commit Graph

42 Commits

Author SHA1 Message Date
Luca Versari 5862d1f995 Add a benchmark and additional tests.
Also add a script to help running sanitizer builds, and do some cleanup.

Co-authored-by: Andrey Mikhaylov <amik@google.com>
Co-authored-by: Eugene Kliuchnikov <eustas@google.com>
Co-authored-by: Sami Boukortt <sboukortt@google.com>
Co-authored-by: Zoltan Szabadka <szabadka@google.com>
2024-04-06 12:54:52 +02:00
Luca Versari 4c23932289 Improve weight handling.
- Allow scaling of SFP weights
- Allow using uncompressed weights
- Do not try to compress weights in the main model calls
- Reduce code duplication in weight handling with some macros

Co-authored-by: Eugene Kliuchnikov <eustas@google.com>
Co-authored-by: Thomas Fischbacher <tfish@google.com>
Co-authored-by: Zoltan Szabadka <szabadka@google.com>
2024-04-06 11:08:47 +02:00
Zoltan Szabadka 71ead04afb Fix off-by-one errors in generation code and token streaming callback.
In the generation code we were feeding the last token of the prompt
twice through the transformer. The new version fixes that and also
works in the case where Prefill is completely disabled.
2024-04-04 07:56:21 +00:00
Jan Wassenberg ba86c8d590 Remove obsolete copybara tags, faster bazel builds (debug)
PiperOrigin-RevId: 617576799
2024-03-21 04:19:02 +01:00
Jan Wassenberg f8baac80f9 Fix msan error, uninitialized model_training
This arose during the unpacking of LoaderArgs into individual ctor args. Probably better to pass LoaderArgs in, and have only a single ctor to reduce confusion.

Also fix includes.

PiperOrigin-RevId: 617386447
2024-03-21 04:18:55 +01:00
Eric Ye 52940d435f Connect "--weights" parameter to Gemma
PiperOrigin-RevId: 617323257
2024-03-21 04:18:48 +01:00
Eric Ye 89be4c3de8 No public description
PiperOrigin-RevId: 617315030
2024-03-21 04:18:36 +01:00
Jan Wassenberg 30b8a3c1ac Fix build for RPi, missing hn::. Refs #112, thanks long568
PiperOrigin-RevId: 617704418
2024-03-20 20:07:49 -07:00
Jan Wassenberg 06cea2bcdb Remove obsolete copybara tags, faster bazel builds (debug)
PiperOrigin-RevId: 617576799
2024-03-20 23:37:39 +01:00
Jan Wassenberg edaafe335f Fix msan error, uninitialized model_training
This arose during the unpacking of LoaderArgs into individual ctor args. Probably better to pass LoaderArgs in, and have only a single ctor to reduce confusion.

Also fix includes.

PiperOrigin-RevId: 617386447
2024-03-20 23:37:32 +01:00
Eric Ye e2a04b79ed Connect "--weights" parameter to Gemma
PiperOrigin-RevId: 617323257
2024-03-20 23:37:25 +01:00
Eric Ye ffd02c59ad No public description
PiperOrigin-RevId: 617315030
2024-03-20 23:37:12 +01:00
Jan Wassenberg 7d5364bb80 Remove obsolete copybara tags, faster bazel builds (debug)
PiperOrigin-RevId: 617576799
2024-03-20 11:31:59 -07:00
Jan Wassenberg 11d9c51473 Fix msan error, uninitialized model_training
This arose during the unpacking of LoaderArgs into individual ctor args. Probably better to pass LoaderArgs in, and have only a single ctor to reduce confusion.

Also fix includes.

PiperOrigin-RevId: 617386447
2024-03-20 12:13:13 +01:00
Eric Ye 6865819bb7 Connect "--weights" parameter to Gemma
PiperOrigin-RevId: 617323257
2024-03-20 12:13:06 +01:00
Eric Ye fdc3812446 No public description
PiperOrigin-RevId: 617315030
2024-03-20 12:12:54 +01:00
Jan Wassenberg 5e0cafbdc2 Fix msan error, uninitialized model_training
This arose during the unpacking of LoaderArgs into individual ctor args. Probably better to pass LoaderArgs in, and have only a single ctor to reduce confusion.

Also fix includes.

PiperOrigin-RevId: 617386447
2024-03-19 21:12:35 -07:00
Eric Ye fdb1091b9c Connect "--weights" parameter to Gemma
PiperOrigin-RevId: 617323257
2024-03-19 16:08:26 -07:00
Eric Ye 1408784d7b Remove unused ascii banner string
PiperOrigin-RevId: 615504786
2024-03-13 12:21:46 -07:00
austinvhuang 72247614bb fix prefill feedback off-by-1, update fetch commit hash 2024-03-12 15:10:44 -04:00
Copybara-Service ccd055e06b Merge pull request #82 from google:examples
PiperOrigin-RevId: 615066980
2024-03-12 09:24:24 -07:00
Jan Wassenberg 0d406061c0 Detect and print build type. Refs #88
PiperOrigin-RevId: 614906000
2024-03-11 21:58:10 -07:00
austinvhuang 0fc80fad05 libgemma refactor - review changes 2024-03-10 12:55:08 -04:00
austinvhuang 03147effbd update loader arg names: cache -> compressed_weights, model -> weights 2024-03-08 17:32:36 -05:00
austinvhuang dfd2fdc1dd Decouple gemma constructor from loader args, update hello_world example, add convenience version of constructor (no uncompressed weights) 2024-03-08 17:26:03 -05:00
austinvhuang b67e28d1a0 [WIP] remove args from GetWeights, GetCompressedWeights 2024-03-08 00:00:11 -05:00
RangerUFO 170a9b4690 Make `CreateKVCache` a free function rather than a method 2024-03-07 15:52:55 +08:00
RangerUFO b841612e8c Separate KV cache from GemmaImpl 2024-03-07 15:47:31 +08:00
austinvhuang e781007836 [WIP] Remove InferenceArgs from hello_world example, fix ordering of LoaderArgs validation, revert ReplGemma EOT token behavior 2024-03-06 23:21:13 -05:00
austinvhuang 7042316013 [WIP] update GemmaInterface, Gemma, and Generate input parameter specs to remove InferenceArgs. TODO: update hello_world example after git commit hash is available for fetching 2024-03-06 22:22:59 -05:00
austinvhuang 0f6a4b49d5 [WIP] quality tweaks - for constants, defer float cast and use double for intermediate computations, add `model` to EOT token 2024-03-06 15:34:11 -05:00
austinvhuang 10f7a086aa [WIP] decouple GemmaImpl from CLI args 2024-03-06 15:06:41 -05:00
austinvhuang 0ea7b993de remove --log fixing https://github.com/google/gemma.cpp/issues/59, improve command line args help, add copybara #include sort guards in more source files, add README sections on running faster and related projects 2024-02-28 15:18:40 -05:00
Copybara-Service 1a1dd90287 Merge pull request #33 from shirayu:add_eot_option
PiperOrigin-RevId: 610838070
2024-02-27 12:32:01 -08:00
Naoki Kishida 7ab968c957 Copybara import of the project:
--
26b541b666 by kishida <naokikishida@gmail.com>:

add information for the reseting conversation

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/gemma.cpp/pull/40 from kishida:add_info_for_reset_conv 26b541b666
PiperOrigin-RevId: 610418671
2024-02-26 08:39:27 -08:00
Dan Zheng 4c155bd3df Restore reverted changes.
Sync to 84444c93a4.

PiperOrigin-RevId: 610263918
2024-02-25 19:32:07 -08:00
Silvio Traversaro 696597383c Copybara import of the project:
--
19694e1f2e by Silvio Traversaro <silvio@traversaro.it>:

Do not pass explicitly -O2 flag to compiler in Release build

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/gemma.cpp/pull/3 from traversaro:patch-1 19694e1f2e
PiperOrigin-RevId: 610096914
2024-02-24 20:41:33 -08:00
Naoki Kishida 621434e424 reset conversation (#34) 2024-02-24 14:54:19 -08:00
Dan Zheng 5fe31ad0bc Copybara: rename BUILD to BUILD.bazel.
PiperOrigin-RevId: 610039263
2024-02-24 14:45:42 -08:00
Naoki Kishida 902adc5e62
reset conversation (#34) 2024-02-24 17:21:01 -05:00
Yuta Hayashibe 1a95cf3274 Add --eot_line option 2024-02-24 23:27:33 +09:00
Austin Huang e29cd566cf initial commit 2024-02-21 03:31:22 +00:00