Update README.md
Browse files
README.md
CHANGED
|
@@ -3,38 +3,26 @@ library_name: peft
|
|
| 3 |
pipeline_tag: text-generation
|
| 4 |
base_model: google/gemma-3-1b-it
|
| 5 |
license: gemma
|
|
|
|
|
|
|
|
|
|
| 6 |
tags:
|
| 7 |
- lora
|
|
|
|
| 8 |
- gemma3
|
| 9 |
- few-shot
|
| 10 |
-
-
|
|
|
|
| 11 |
---
|
| 12 |
|
| 13 |
# lora8-fewshot — LoRA adapter for Gemma 3 1B IT
|
| 14 |
|
| 15 |
-
Lightweight **LoRA rank-8** adapter trained on
|
| 16 |
-
This repo contains **only the adapter**;
|
| 17 |
|
| 18 |
---
|
| 19 |
|
| 20 |
-
##
|
| 21 |
-
|
| 22 |
-
- **Developed by:** Nikhil Sharma,
|
| 23 |
-
- **Shared by:** [NikhilSharma](https://huggingface.co/NikhilSharma)
|
| 24 |
-
- **Model type:** PEFT LoRA adapter for a causal decoder-only LLM (Gemma 3)
|
| 25 |
-
- **Base model:** `google/gemma-3-1b-it`
|
| 26 |
-
- **Languages:** English (primarily)
|
| 27 |
-
- **Context length (train cfg):** 2048 tokens
|
| 28 |
-
- **Artifacts:** `adapter_model.safetensors` (~25 MB), `adapter_config.json`
|
| 29 |
-
- **How it’s used:** attach to the base model at inference; merging not required.
|
| 30 |
-
|
| 31 |
-
### Sources
|
| 32 |
-
- **This repo:** (you are here)
|
| 33 |
-
- **Base model card:** `google/gemma-3-1b-it`
|
| 34 |
-
|
| 35 |
-
---
|
| 36 |
-
|
| 37 |
-
## Usage
|
| 38 |
|
| 39 |
```python
|
| 40 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
|
@@ -47,9 +35,8 @@ tok = AutoTokenizer.from_pretrained(base_id)
|
|
| 47 |
base = AutoModelForCausalLM.from_pretrained(base_id, torch_dtype="auto")
|
| 48 |
model = PeftModel.from_pretrained(base, adapter_id)
|
| 49 |
|
| 50 |
-
prompt = "
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
out = model.generate(**ids, max_new_tokens=200, temperature=0.7)
|
| 55 |
print(tok.decode(out[0], skip_special_tokens=True))
|
|
|
|
| 3 |
pipeline_tag: text-generation
|
| 4 |
base_model: google/gemma-3-1b-it
|
| 5 |
license: gemma
|
| 6 |
+
language: en
|
| 7 |
+
datasets:
|
| 8 |
+
- nbertagnolli/counsel-chat
|
| 9 |
tags:
|
| 10 |
- lora
|
| 11 |
+
- peft
|
| 12 |
- gemma3
|
| 13 |
- few-shot
|
| 14 |
+
- counseling
|
| 15 |
+
- empathy
|
| 16 |
---
|
| 17 |
|
| 18 |
# lora8-fewshot — LoRA adapter for Gemma 3 1B IT
|
| 19 |
|
| 20 |
+
Lightweight **LoRA rank-8** adapter trained on therapist Q&A from **CounselChat** to make `google/gemma-3-1b-it` more responsive for short, task-oriented counseling prompts.
|
| 21 |
+
This repo contains **only the adapter**; load it on top of the base model. :contentReference[oaicite:0]{index=0}
|
| 22 |
|
| 23 |
---
|
| 24 |
|
| 25 |
+
## Quick start
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
|
| 27 |
```python
|
| 28 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
|
|
|
| 35 |
base = AutoModelForCausalLM.from_pretrained(base_id, torch_dtype="auto")
|
| 36 |
model = PeftModel.from_pretrained(base, adapter_id)
|
| 37 |
|
| 38 |
+
prompt = "How can I avoid thinking much?,I start thinking deeply about everything I may do or say and about anything that may happen. I really want to avoid it since it really bothers me."
|
| 39 |
+
chat = tok.apply_chat_template([{"role": "user", "content": prompt}], tokenize=False, add_generation_prompt=True)
|
| 40 |
+
inputs = tok(chat, return_tensors="pt").to(model.device)
|
| 41 |
+
out = model.generate(**inputs, max_new_tokens=200, temperature=0.7)
|
|
|
|
| 42 |
print(tok.decode(out[0], skip_special_tokens=True))
|