-
Notifications
You must be signed in to change notification settings - Fork 27.9k
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
Adds GGUF support for Gemma models #35887
base: main
Are you sure you want to change the base?
Conversation
Extends GGUF compatibility to include Gemma alongside existing Gemma2 support - Adds Gemma configuration mapping - Reuses Gemma2 tensor processor for Gemma models - Includes test coverage for Gemma GGUF integration
Can you take a look at this PR @SunMarc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM ! Just a nit cc @Isotr0py
def test_gemma_fp32(self): | ||
model = AutoModelForCausalLM.from_pretrained( | ||
self.gemma_model_id, | ||
gguf_file=self.fp32_gemma_model_id, | ||
torch_dtype=torch.float16, | ||
) | ||
|
||
tokenizer = AutoTokenizer.from_pretrained(self.gemma_model_id, gguf_file=self.fp32_gemma_model_id) | ||
text = tokenizer(self.example_text, return_tensors="pt")["input_ids"] | ||
out = model.generate(text, max_new_tokens=10) | ||
|
||
EXPECTED_TEXT = "Hello, I'm looking for a way to make" | ||
self.assertEqual(tokenizer.decode(out[0], skip_special_tokens=True), EXPECTED_TEXT) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add also a test weights conversion. test_gemma_weights_conversion_fp32
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Extends GGUF compatibility to include Gemma alongside existing Gemma2 support
#33260
Before submitting
Pull Request section?
to it if that's the case.
documentation guidelines, and
here are tips on formatting docstrings.
Who can review?
Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.