mirror of
https://github.com/ollama/ollama.git
synced 2026-04-22 16:55:44 +02:00
restructure
image processing Update model.go Update model.go Update model.go no projector no projector vision model scaffold ... ... wip ... rebase fix patch merger tidy ... Update model_vision.go server: do not attempt to parse offset file as gguf This logic was causing issues for me when importing a gguf that had some padding at the end of the file. The valid gguf would be read, but then it would try to read the offset as a different gguf file. This does not seem right. Update process_image_test.go apply norm prompt processing prompt processing fix post tokenize fix gguf padding + populate the split patch embeddings ... ... another shot at patch embeddings ... patch embedding Update model_vision.go split pixels
This commit is contained in:
47
model/models/qwen25vl/process_image_test.go
Normal file
47
model/models/qwen25vl/process_image_test.go
Normal file
@@ -0,0 +1,47 @@
|
||||
package qwen25vl
|
||||
|
||||
import (
|
||||
"image"
|
||||
_ "image/jpeg" // Register JPEG decoder
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestSmartResize(t *testing.T) {
|
||||
type smartResizeCase struct {
|
||||
TestImage image.Image
|
||||
Expected image.Point
|
||||
}
|
||||
|
||||
// Create an image processor with default values
|
||||
processor := ImageProcessor{
|
||||
imageSize: 560, // Example value
|
||||
numChannels: 3,
|
||||
factor: 28,
|
||||
minPixels: 56 * 56,
|
||||
maxPixels: 14 * 14 * 4 * 1280,
|
||||
}
|
||||
|
||||
cases := []smartResizeCase{
|
||||
{
|
||||
TestImage: image.NewRGBA(image.Rect(0, 0, 1024, 1024)),
|
||||
Expected: image.Point{980, 980},
|
||||
},
|
||||
{
|
||||
TestImage: image.NewRGBA(image.Rect(0, 0, 1024, 768)),
|
||||
Expected: image.Point{1036, 756},
|
||||
},
|
||||
{
|
||||
TestImage: image.NewRGBA(image.Rect(0, 0, 2000, 2000)),
|
||||
Expected: image.Point{980, 980},
|
||||
},
|
||||
}
|
||||
|
||||
for _, c := range cases {
|
||||
b := c.TestImage.Bounds().Max
|
||||
x, y := processor.SmartResize(b.X, b.Y)
|
||||
actual := image.Point{x, y}
|
||||
if actual != c.Expected {
|
||||
t.Errorf("expected: %v, actual: %v", c.Expected, actual)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user