Gemma model support

Started by sybersitizen, August 01, 2025, 01:43:43 AM

Previous topic - Next topic

sybersitizen

I see there is a Gemma 2b model that appears to not be supported in IMatch:

https://ollama.com/library/gemma3n

Is there a reason why it's not? My GPU VRAM is only 4GB, so I'm seeking the smallest possible model.

Mario

Neither Ollama nor LM Studio offer currently support for the "vision" version of Gemma3n:4b. That's all still in the works.

Both LM Studio and Ollama offer a wide range of models. For IMatch, only vision-capable models are of interest.

sybersitizen

I see. So, once LM Studio and Ollama offer vision support for the new models, IMatch can as well.

sybersitizen

Oh ... I've just been reading that there are QAT (quantization aware trained) versions of the Gemma 3 models that are smaller in size:

https://developers.googleblog.com/en/gemma-3-quantized-aware-trained-state-of-the-art-ai-to-consumer-gpus/

https://ollama.com/library/gemma3

The 4b QAT model should work easily in 4GB but I suppose IMatch would have to be modified in order to support it?

Mario

#4
IMatch supports models via Ollama and LM Studio. Neither offer currently support for Gemma3n models with vision.
LM Studio specifically states for the Gemma3n model: GGUFs are currently text-only. We are working to expand capabilities and remove this limitation.

When LM Studio or Ollama add support for this (I assume they have to wait until llama.cpp adds support for this new model type) I will run some tests to see if they are any good for IMatch's use cases and if so, add support for them.

sybersitizen

Quote from: Mario on August 02, 2025, 10:23:08 AMIMatch supports models via Ollama and LM Studio. Neither offer currently support for Gemma3n models with vision.

The links I provided are about Gemma 3 models, not 3n. They're just smaller because they're quantized variants.

If you scroll down on the Ollama library page, you'll see commands for loading the quantized variants, which I assume means they are supported:

Quantization aware trained models (QAT)
The quantization aware trained Gemma 3 models preserves similar quality as half precision models (BF16) while maintaining a lower memory footprint (3x less compared to non-quantized models).

1B parameter model

ollama run gemma3:1b-it-qat

4B parameter model

ollama run gemma3:4b-it-qat

12B parameter model

ollama run gemma3:12b-it-qat

27B parameter model

ollama run gemma3:27b-it-qat

Mario

#6
The smallest Gemma3 model on that page with vision is
ollama run gemma3:4b
which is supported by IMatch for several months now.

You can try to use any of the other models if you want and let me know if they work.
Edit "C:\ProgramData\photools.com\IMatch6\config\ai-services-202501.json" on your machine. Search for Gemma 3 and see how a model is configured. The name you use after ollama run is the model name / key in this file.
It's not hard. Use an editor like Visual Studio code that does syntax highlighting for JSON and also can show errors.

Unless there is  breaking change and the model you try requires different parameters or anything, this will work fine (keep a copy of your modified configuration file, when you install a new IMatch version, the configuration file is replaced by the installer).

Download the Ollama model of your choice and add it's name to the config file. Restart IMatch and select the new model for an AutoTagger setting. Let me know if it works.

Quantized models may use less memory, but often perform a lot worse than the original model. Since the original model is 4b, it's already a quantized and downsampled model (from the original 27b Gemma model).

sybersitizen

Thanks for explaining how to modify the config file. Might be a little deeper than I want to delve, but I'll think about it.

Mario

Quote from: sybersitizen on August 02, 2025, 06:49:34 PMThanks for explaining how to modify the config file. Might be a little deeper than I want to delve, but I'll think about it.
This might be. But that's what I would have to do to check if your suggested model is any good for IMatch. And I have many other IMatch things to do as well. You can take your time, learn something new (always exciting) and let us know if the model works and how good it works.