Text Generation
Transformers
Safetensors
PEFT
English
qwen2
lora
chatbot
portfolio
conversational
text-generation-inference
Instructions to use BatboldSamdan/babybata2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use BatboldSamdan/babybata2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="BatboldSamdan/babybata2") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("BatboldSamdan/babybata2") model = AutoModelForCausalLM.from_pretrained("BatboldSamdan/babybata2", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - PEFT
How to use BatboldSamdan/babybata2 with PEFT:
Task type is invalid.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use BatboldSamdan/babybata2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "BatboldSamdan/babybata2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "BatboldSamdan/babybata2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/BatboldSamdan/babybata2
- SGLang
How to use BatboldSamdan/babybata2 with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "BatboldSamdan/babybata2" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "BatboldSamdan/babybata2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "BatboldSamdan/babybata2" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "BatboldSamdan/babybata2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use BatboldSamdan/babybata2 with Docker Model Runner:
docker model run hf.co/BatboldSamdan/babybata2
Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
language:
|
| 4 |
+
- en
|
| 5 |
+
base_model: Qwen/Qwen2.5-0.5B-Instruct
|
| 6 |
+
library_name: transformers
|
| 7 |
+
pipeline_tag: text-generation
|
| 8 |
+
tags:
|
| 9 |
+
- lora
|
| 10 |
+
- peft
|
| 11 |
+
- chatbot
|
| 12 |
+
- portfolio
|
| 13 |
+
---
|
| 14 |
+
|
| 15 |
+
# BabyBata 2.0 🍼
|
| 16 |
+
|
| 17 |
+
A small assistant that answers questions about [Batbold Samdan](https://github.com/batbold9182)'s portfolio: his projects, skills, education and contact info. An AI/ML **learning project**.
|
| 18 |
+
|
| 19 |
+
- **Base model:** [Qwen2.5-0.5B-Instruct](https://huggingface.co/Qwen/Qwen2.5-0.5B-Instruct)
|
| 20 |
+
- **Method:** LoRA fine-tuning (r=16, all attention + MLP projections, 1.7% of weights trained), merged into the base model, saved in float16
|
| 21 |
+
- **Data:** ~630 generated conversations: topic Q&A, "does he know X?", "I don't know" cases, off-topic refusals, multi-turn follow-ups
|
| 22 |
+
- **Training:** 3 epochs on a free Colab T4 (~10 min), loss on assistant replies only
|
| 23 |
+
- **Code:** [github.com/batbold9182/babybata](https://github.com/batbold9182/babybata)
|
| 24 |
+
|
| 25 |
+
## Important: it needs the profile
|
| 26 |
+
BabyBata is trained to answer **from a fact sheet in the system prompt** (grounding), not from memory. Use it with the same system prompt it was trained with: the rules + `profile.txt` from the repo (`bot.py` builds it).
|
| 27 |
+
|
| 28 |
+
```python
|
| 29 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 30 |
+
|
| 31 |
+
repo = "BatboldSamdan/babybata2"
|
| 32 |
+
tokenizer = AutoTokenizer.from_pretrained(repo)
|
| 33 |
+
model = AutoModelForCausalLM.from_pretrained(repo)
|
| 34 |
+
|
| 35 |
+
system = open("babybata2/profile.txt").read() # in practice: bot.system_prompt() from the repo
|
| 36 |
+
messages = [{"role": "system", "content": system},
|
| 37 |
+
{"role": "user", "content": "what projects has he built?"}]
|
| 38 |
+
inputs = tokenizer.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt", return_dict=True)
|
| 39 |
+
out = model.generate(**inputs, max_new_tokens=100)
|
| 40 |
+
print(tokenizer.decode(out[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))
|
| 41 |
+
```
|
| 42 |
+
|
| 43 |
+
## Evaluation
|
| 44 |
+
Custom fact check on questions not in the training data (incl. honesty checks like "does he know Rust?" → must say it doesn't know):
|
| 45 |
+
|
| 46 |
+
| Model | Score |
|
| 47 |
+
|---|---|
|
| 48 |
+
| Qwen2.5-0.5B-Instruct + profile, no fine-tuning | 18/27 |
|
| 49 |
+
| BabyBata 2.0 v1 | 26/27 (4 test questions had leaked into training dialogues, so slightly optimistic) |
|
| 50 |
+
|
| 51 |
+
## Limitations
|
| 52 |
+
- Only knows what's in the profile; it's a small model and can still be wrong. Verify important details on the portfolio site.
|
| 53 |
+
- Known v1 issues: sometimes loses track in follow-up questions; once claimed a project had a live demo when it doesn't.
|
| 54 |
+
- All training data is public information from the portfolio site.
|