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

Export stable version #7

Merged
merged 57 commits into from
Nov 25, 2024
Merged
Changes from 1 commit
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
ffa1153
Use Gemma2 2.6B as the default variant
ufownl Jul 31, 2024
3b6b2b9
Filter disabled tokens after prompts tokenization
ufownl Aug 1, 2024
284646f
Implement the shortcut to suggestion prompts for the online demo
ufownl Aug 1, 2024
e1fd9a1
Fix the documents according to the formal names of Gemma2 variants
ufownl Aug 1, 2024
525f6b5
Adapt to `PerClusterPools` APIs of gemma.cpp
ufownl Aug 6, 2024
a2bada4
Adapt to the new structure of `TimingInfo` of gemma.cpp
ufownl Aug 8, 2024
0154519
Avoid redundant memory copying when calling the model
ufownl Aug 9, 2024
58e761a
Adapt to `pin` flag of `PerClusterPools` in gemma.cpp
ufownl Aug 10, 2024
d987f09
Adjust the table layout of available parameters of `cgemma.scheduler`
ufownl Aug 10, 2024
cec1a57
Refactor `session` class
ufownl Aug 10, 2024
127b1ab
Move the random generator from `session` to `instance`
ufownl Aug 11, 2024
f078b8e
Implement the normal mode of the batch interface
ufownl Aug 11, 2024
2c7c2b7
Streamline the implementation of single interface
ufownl Aug 12, 2024
9350aa7
Fix batch arguments parsing issue
ufownl Aug 12, 2024
da85425
Implement stream mode for batch interface
ufownl Aug 12, 2024
f22fc90
Tweak code details and update README.md
ufownl Aug 12, 2024
2ccdd8c
Add the batch call API example to README.md
ufownl Aug 12, 2024
8364fbb
Reduce the number of heap allocations in stream mode
ufownl Aug 12, 2024
b2d8c8c
Fix KV cache size calculation
ufownl Aug 13, 2024
c2928cc
Tweak the examples of batch calls
ufownl Aug 13, 2024
66d4d5c
Tweak the documents
ufownl Aug 13, 2024
d93792a
Update README.md of the online demo
ufownl Aug 13, 2024
d8882d5
Adapt to type renaming of gemma.cpp
ufownl Aug 15, 2024
08044a0
Improve the AI function example
ufownl Aug 17, 2024
cf2a3d7
Tweak the code of examples
ufownl Aug 17, 2024
bc55857
Update README.md
ufownl Aug 17, 2024
8c1396a
Update README.md
ufownl Aug 17, 2024
fa5c08b
Remove the prompt padding in the batch API
ufownl Aug 19, 2024
ca46148
Force GC at the end of the demo chat session
ufownl Sep 12, 2024
a0b6b0a
Adapt to the tokenization of PaliGemma
ufownl Sep 24, 2024
0e980b2
Implement a method to load PPM image
ufownl Sep 25, 2024
9900b68
Implement the single call API with image tokens
ufownl Sep 25, 2024
064af22
PaliGemma sessions do not support batch calling yet
ufownl Sep 25, 2024
a113f5a
Dump/Load image tokens to/from the session state
ufownl Sep 25, 2024
7829d7d
Adjust the constructor parameters of `cgemma.session`
ufownl Sep 26, 2024
d6ac87b
Update README.md
ufownl Sep 26, 2024
46700c3
Fix typos in documents
ufownl Sep 26, 2024
c573339
Fix the generation of PaliGemma
ufownl Sep 26, 2024
f47ef5f
Implement examples for PaliGemma
ufownl Sep 26, 2024
9647ea7
Fix the prompt size calculation of PaliGemma
ufownl Sep 27, 2024
8a1dda3
Adapt to the internal change about position calculation of gemma.cpp
ufownl Oct 11, 2024
cc37fce
Tweak the prompt of AI function example
ufownl Oct 12, 2024
72e8a04
Adjust the parameters of the scheduler
ufownl Oct 12, 2024
8dac6d5
Remove `max_tokens` options according to the changes of gemma.cpp
ufownl Oct 16, 2024
0897dd8
Adapt to the new threading API of gemma.cpp
ufownl Oct 19, 2024
49e116a
Adapt to the new model config implementation of gemma.cpp
ufownl Oct 19, 2024
f3812a2
Update README.md
ufownl Oct 20, 2024
6f028c0
Update the tool and demo according to the changes in the scheduler
ufownl Oct 20, 2024
1b7a5d7
Implement loading an image from a Lua string
ufownl Oct 14, 2024
3f40c7c
Adapt to the change of image loading API of gemma.cpp
ufownl Oct 17, 2024
9c46b6d
Add a test image for PaliGemma
ufownl Oct 25, 2024
b4feafe
Remove the unused code
ufownl Oct 25, 2024
b4b1416
Deconstruct image object when reading PPM image fails
ufownl Oct 28, 2024
a59d01e
Refactor the implementation of `cgemma.image` method
ufownl Oct 29, 2024
4ca1ef6
Add an overload of `cgemma.image` method
ufownl Oct 29, 2024
ae2fd2f
Adapt to the changes of `gcpp::ImageTokens`
ufownl Nov 5, 2024
4f8cbb3
Adapt to the runtime Top-K configuration of gemma.cpp
ufownl Nov 14, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Refactor the implementation of cgemma.image method
  • Loading branch information
ufownl committed Oct 29, 2024
commit a59d01e6ea49f0b935ed7a6886e213a88804fd33
12 changes: 6 additions & 6 deletions src/image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@ int create(lua_State* L) {
size_t len;
auto buf = luaL_checklstring(L, 1, &len);
try {
auto ud = lua_newuserdata(L, sizeof(gcpp::Image));
auto img = new(ud) gcpp::Image;
if (!img->ReadPPM(hwy::Span<const char>(buf, len))) {
if (!img->ReadPPM(std::string(buf, len))) {
img->~Image();
gcpp::Image img;
if (!img.ReadPPM(hwy::Span<const char>(buf, len))) {
if (!img.ReadPPM(std::string(buf, len))) {
throw std::runtime_error("Failed to read PPM image");
}
}
img->Resize();
img.Resize();
auto ud = lua_newuserdata(L, sizeof(gcpp::Image));
new(ud) gcpp::Image(std::move(img));
luaL_getmetatable(L, name);
lua_setmetatable(L, -2);
return 1;
Expand Down