Views
No views yet

Input: "I love hiking at dawn, painting watercolors, and deep conversations about philosophy. I'm a vegetarian and passionate about climate change."
Output: nature-lover, artist, intellectual, vegetarian, environmentalist1from transformers import AutoModelForCausalLM, AutoTokenizer
2
3model = AutoModelForCausalLM.from_pretrained(
4 "SpiceeChat/Bio2Tags-Qwen3.5-4B-SFT",
5 torch_dtype="auto",
6 device_map="auto",
7 trust_remote_code=True,
8)
9tokenizer = AutoTokenizer.from_pretrained("SpiceeChat/Bio2Tags-Qwen3.5-4B-SFT", trust_remote_code=True)
10
11def get_tags(bio):
12 messages = [
13 {"role": "system", "content": "Extract tags from the following biography. Return only the tags, separated by commas, with no other text."},
14 {"role": "user", "content": bio},
15 ]
16 prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
17 inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
18 outputs = model.generate(**inputs, max_new_tokens=40, temperature=0.7, do_sample=True)
19 return tokenizer.decode(outputs[0][inputs.input_ids.shape[1]:], skip_special_tokens=True).strip()
20
21print(get_tags("I enjoy cooking Italian food and playing jazz piano."))
22# → cooking, musician, italian-cuisine, jazz, creativepip install transformers torch accelerateHardware: Requires ~6 GB VRAM (FP16). Usedevice_map="auto"for multi‑GPU or CPU offloading.
| Detail | Value |
|---|---|
| Base Model | Qwen2.5‑3B‑Instruct |
| Fine‑tuning Method | QLoRA (4‑bit), rank‑16 |
| Training Data | 1,387 (bio, tags) pairs — lovingly crafted by a caffeinated Gemini |
| Epochs | 3 (because nobody likes an overtrained model, or an undercooked steak) |
| Output Format | Comma‑separated tags |
BUY US SOME COFFEE!