Instructions to use djelia/gemma-3n-bm-base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use djelia/gemma-3n-bm-base with PEFT:
Task type is invalid.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- Unsloth Studio
How to use djelia/gemma-3n-bm-base 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-base 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-base 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-base 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-base", max_seq_length=2048, )
Configuration Parsing Warning:In adapter_config.json: "peft.task_type" must be a string
gemma-3n-bm-base
A LoRA adapter for Gemma 3n E4B โ the pretrained, non-instruction-tuned variant โ trained for Bambara with Unsloth and TRL.
Adapter weights only. Load onto unsloth/gemma-3n-E4B-unsloth-bnb-4bit; that checkpoint is
4-bit NF4, and the adapter should be loaded onto the same quantised base it was trained against.
Config
Rank r |
128 |
lora_alpha |
32 |
use_rslora |
true โ effective scale is alpha / sqrt(r) โ 2.83, not alpha / r |
lora_dropout |
0 |
Adapted: the attention and MLP projections of the 35 decoder layers, the audio tower's attention
projections, and โ unusually for a LoRA โ embed_tokens and lm_head, which is what makes this
the vocabulary-adaptation stage.
Usage
import torch
from transformers import AutoProcessor, Gemma3nForConditionalGeneration
from peft import PeftModel
base = Gemma3nForConditionalGeneration.from_pretrained(
"unsloth/gemma-3n-E4B-unsloth-bnb-4bit",
dtype=torch.bfloat16,
device_map="auto",
attn_implementation="sdpa",
)
model = PeftModel.from_pretrained(base, "djelia/gemma-3n-bm-base")
model.eval()
processor = AutoProcessor.from_pretrained("djelia/gemma-3n-bm-base", padding_side="left")
inputs = processor(text="Bamako ye ", return_tensors="pt").to(model.device)
out = model.generate(**inputs, max_new_tokens=64, do_sample=False)
print(processor.decode(out[0], skip_special_tokens=True))
Notes
This adapter sits on the pretrained base, so use plain text continuation rather than chat formatting.
bitsandbytes and accelerate are required for the 4-bit base. On transformers releases
older than the dtype= rename, pass torch_dtype=torch.bfloat16.
- Downloads last month
- 3
Model tree for djelia/gemma-3n-bm-base
Base model
google/gemma-3n-E4B