Instructions to use djelia/gemma-3n-bm-it-2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use djelia/gemma-3n-bm-it-2 with PEFT:
Task type is invalid.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- Unsloth Studio
How to use djelia/gemma-3n-bm-it-2 with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for djelia/gemma-3n-bm-it-2 to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for djelia/gemma-3n-bm-it-2 to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for djelia/gemma-3n-bm-it-2 to start chatting
Load model with FastModel
pip install unsloth from unsloth import FastModel model, tokenizer = FastModel.from_pretrained( model_name="djelia/gemma-3n-bm-it-2", max_seq_length=2048, )
Configuration Parsing Warning:In adapter_config.json: "peft.task_type" must be a string
gemma-3n-bm-it-2
The second instruction-tuning run for Gemma 3n E4B in Bambara, trained with Unsloth and TRL.
Adapter weights only โ they need a base model to load onto. The base for this run was a local
directory on the training machine, so it is not recorded in this repository; point BASE below
at your own Gemma 3n E4B checkpoint.
Config
Rank r |
32 |
lora_alpha |
32 |
use_rslora |
false โ effective scale alpha / r = 1.0 |
lora_dropout |
0 |
Adapted: the decoder's attention and MLP projections, the 12 audio conformer blocks, and both multimodal embedding projectors.
Usage
import torch
from transformers import AutoProcessor, Gemma3nForConditionalGeneration
from peft import PeftModel
BASE = "..." # your Gemma 3n E4B checkpoint
base = Gemma3nForConditionalGeneration.from_pretrained(
BASE, dtype=torch.bfloat16, device_map="auto", attn_implementation="sdpa",
)
model = PeftModel.from_pretrained(base, "djelia/gemma-3n-bm-it-2")
model.eval()
processor = AutoProcessor.from_pretrained("djelia/gemma-3n-bm-it-2", padding_side="left")
messages = [{"role": "user", "content": [{"type": "text", "text": "I ni ce"}]}]
inputs = processor.apply_chat_template(
messages, tokenize=True, return_dict=True,
return_tensors="pt", add_generation_prompt=True,
).to(model.device)
out = model.generate(**inputs, max_new_tokens=256, do_sample=False)
print(processor.decode(out[0][inputs["input_ids"].shape[-1]:], skip_special_tokens=True))
Notes
The chat template requires strictly alternating user/assistant roles. Audio content items
({"type": "audio", "path": ...}) also work โ the adapter tunes the audio path.
For a run from this line whose base is published on the Hub, use
djelia/gemma-3n-bm-it-3.
- Downloads last month
- 3