Commit Graph

13 Commits

Author SHA1 Message Date
Jan Wassenberg 3e18db17f4 Avoid hard-coding kPatchSize. Thanks @Somet2mes for reporting. Fixes #762.
PiperOrigin-RevId: 829308896
2025-11-07 00:32:31 -08:00
Rhett Stucki 824a95793c Fix Image::WriteBinary() writing values to a file one at a time.
PiperOrigin-RevId: 767955187
2025-06-06 00:48:09 -07:00
The gemma.cpp Authors dd7d4a7717 Optimize Image::GetPatch() to copy rows instead of pixels at a time.
PiperOrigin-RevId: 767436146
2025-06-04 22:31:08 -07:00
Jan Wassenberg c8d92948f4 Move fields, io* and blob* from compression/ into io/
PiperOrigin-RevId: 755445712
2025-05-06 11:17:19 -07:00
Daniel Keysers 331d2ccc02 Add support for 448px resolution to PaliGemma and PaliGemma2.
PiperOrigin-RevId: 704361579
2024-12-09 11:38:10 -08:00
Daniel Keysers 583bd93e9a Factor out addition of ViTConfig to a ModelConfig.
Use ModelConfig values for ImageTokens.
Output timing info for image token generation.
Add a method to copy image data into Image class directly.
Minor changes: pipe ModelTraining to more places.

PiperOrigin-RevId: 690572283
2024-10-28 05:29:33 -07:00
Jan Wassenberg 19cfe14c76 Warning fixes (casts) and fix Windows build for aligned_alloc
PiperOrigin-RevId: 689734618
2024-10-25 04:14:04 -07:00
RangerUFO e48fc3abb4 Refactor the overloads of `Image::ReadPPM` method
Remove the `std::istream` overload and directly parse the PPM format on
the span. Load the image bytes in the file using `ReadFileToString`
helper defined in "compression/io.h" instead of `std::ifstream`.
2024-10-18 02:10:29 +08:00
RangerUFO de2f7d7e2c Add an overload of `Image::ReadPPM` method
Make it able to load image data from a `hwy::Span`.
2024-10-16 17:34:11 +08:00
RangerUFO a784b8459d Add an overload of `Image::ReadPPM` method
Make it able to load image data from a stream.
2024-10-16 15:53:27 +08:00
Ray Smith 85958f5fd3 Added MatPtr/MatPtrT/MatStorageT/MatStorage as a dynamically-sized replacement for CompressedArray.
Definition of array size is moved to the constructor.
Allocation is separate and parallelized.
All users of weights_raw.h migrated to CompressedWeights and weights_raw.h deleted.
Replaced all previous ForEachTensor functions with a single unified function.

PiperOrigin-RevId: 684451604
2024-10-10 08:22:30 -07:00
Daniel Keysers dc2e5f1505 PaliGemma: fix image loading.
Use uint8_t to make sure values are not interpreted as signed char.

PiperOrigin-RevId: 680965115
2024-10-01 04:54:04 -07:00
Daniel Keysers f8835fe4a4 Add support for PaliGemma Vision-LM (224x224) to gemma.cpp
See https://arxiv.org/abs/2407.07726 for a description of the model.
Because PaliGemma operates as a prefix-LM on the image+prompt, add support for that.

PiperOrigin-RevId: 677841119
2024-09-23 10:09:38 -07:00