Skip to content

Update Model Card for Mamba#37863

Merged
stevhliu merged 5 commits intohuggingface:mainfrom
ParagEkbote:Improve-Model-Card-For-Mamb
May 21, 2025
Merged

Update Model Card for Mamba#37863
stevhliu merged 5 commits intohuggingface:mainfrom
ParagEkbote:Improve-Model-Card-For-Mamb

Conversation

@ParagEkbote
Copy link
Copy Markdown
Contributor

@ParagEkbote ParagEkbote commented Apr 29, 2025

What does this PR do?

As described in the issue, this PR updates the model card for Mamba. Please let me know if any modifications are required and I will make the necessary changes.

Refs #36979

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).

Who can review?

@stevhliu

@github-actions
Copy link
Copy Markdown
Contributor

Hi 👋, thank you for opening this pull request! The pull request is converted to draft by default. The CI will be paused while the PR is in draft mode. When it is ready for review, please click the Ready for review button (at the bottom of the PR page). This will assign reviewers and trigger CI.

@github-actions github-actions Bot marked this pull request as draft April 29, 2025 13:33
@ParagEkbote ParagEkbote marked this pull request as ready for review April 29, 2025 13:34
@github-actions github-actions Bot requested a review from stevhliu April 29, 2025 13:35
Copy link
Copy Markdown
Member

@stevhliu stevhliu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Maybe let's also add a quantization example with https://huggingface.co/state-spaces/mamba-2.8b-hf.

import torch
from transformers import AutoModelForCausalLM, AutoTokenizer, TorchAoConfig

quantization_config = TorchAoConfig("int4_weight_only", group_size=128)
tokenizer = AutoTokenizer.from_pretrained("state-spaces/mamba-2.8b-hf")
model = AutoModelForCausalLM.from_pretrained("state-spaces/mamba-2.8b-hf", torch_dtype=torch.bfloat16, quantization_config=quantization_config, device_map="auto",)
input_ids = tokenizer("Plants create energy through a process known as", return_tensors="pt").to("cuda")

output = model.generate(**input_ids)
print(tokenizer.decode(output[0], skip_special_tokens=True))

Comment thread docs/source/en/model_doc/mamba.md Outdated
Comment thread docs/source/en/model_doc/mamba.md Outdated
Comment thread docs/source/en/model_doc/mamba.md Outdated
Comment thread docs/source/en/model_doc/mamba.md Outdated
Comment thread docs/source/en/model_doc/mamba.md
Comment thread docs/source/en/model_doc/mamba.md Outdated
Comment thread docs/source/en/model_doc/mamba.md Outdated
Comment thread docs/source/en/model_doc/mamba.md Outdated
ParagEkbote and others added 2 commits May 1, 2025 12:49
Co-authored-by: Steven Liu <59462357+stevhliu@users.noreply.github.com>
@ParagEkbote
Copy link
Copy Markdown
Contributor Author

Thanks!

Maybe let's also add a quantization example with https://huggingface.co/state-spaces/mamba-2.8b-hf.

import torch
from transformers import AutoModelForCausalLM, AutoTokenizer, TorchAoConfig

quantization_config = TorchAoConfig("int4_weight_only", group_size=128)
tokenizer = AutoTokenizer.from_pretrained("state-spaces/mamba-2.8b-hf")
model = AutoModelForCausalLM.from_pretrained("state-spaces/mamba-2.8b-hf", torch_dtype=torch.bfloat16, quantization_config=quantization_config, device_map="auto",)
input_ids = tokenizer("Plants create energy through a process known as", return_tensors="pt").to("cuda")

output = model.generate(**input_ids)
print(tokenizer.decode(output[0], skip_special_tokens=True))

I've added this example and updated it as per the new AOBaseConfig-based approach since the approach used above is deprecated as mentioned in the docs.

Could you please review the changes?

cc: @stevhliu

@ParagEkbote ParagEkbote requested a review from stevhliu May 2, 2025 18:29
Copy link
Copy Markdown
Member

@stevhliu stevhliu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@HuggingFaceDocBuilderDev
Copy link
Copy Markdown

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@stevhliu stevhliu merged commit 28d3148 into huggingface:main May 21, 2025
10 checks passed
@ParagEkbote ParagEkbote deleted the Improve-Model-Card-For-Mamb branch May 21, 2025 17:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants