初始化项目,由ModelHub XC社区提供模型
Model: SpiceeChat/Bio2Tags-Lite Source: Original Platform
This commit is contained in:
35
.gitattributes
vendored
Normal file
35
.gitattributes
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
*.7z filter=lfs diff=lfs merge=lfs -text
|
||||
*.arrow filter=lfs diff=lfs merge=lfs -text
|
||||
*.bin filter=lfs diff=lfs merge=lfs -text
|
||||
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
||||
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
||||
*.ftz filter=lfs diff=lfs merge=lfs -text
|
||||
*.gz filter=lfs diff=lfs merge=lfs -text
|
||||
*.h5 filter=lfs diff=lfs merge=lfs -text
|
||||
*.joblib filter=lfs diff=lfs merge=lfs -text
|
||||
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
||||
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
||||
*.model filter=lfs diff=lfs merge=lfs -text
|
||||
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
||||
*.npy filter=lfs diff=lfs merge=lfs -text
|
||||
*.npz filter=lfs diff=lfs merge=lfs -text
|
||||
*.onnx filter=lfs diff=lfs merge=lfs -text
|
||||
*.ot filter=lfs diff=lfs merge=lfs -text
|
||||
*.parquet filter=lfs diff=lfs merge=lfs -text
|
||||
*.pb filter=lfs diff=lfs merge=lfs -text
|
||||
*.pickle filter=lfs diff=lfs merge=lfs -text
|
||||
*.pkl filter=lfs diff=lfs merge=lfs -text
|
||||
*.pt filter=lfs diff=lfs merge=lfs -text
|
||||
*.pth filter=lfs diff=lfs merge=lfs -text
|
||||
*.rar filter=lfs diff=lfs merge=lfs -text
|
||||
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
||||
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
||||
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
||||
*.tar filter=lfs diff=lfs merge=lfs -text
|
||||
*.tflite filter=lfs diff=lfs merge=lfs -text
|
||||
*.tgz filter=lfs diff=lfs merge=lfs -text
|
||||
*.wasm filter=lfs diff=lfs merge=lfs -text
|
||||
*.xz filter=lfs diff=lfs merge=lfs -text
|
||||
*.zip filter=lfs diff=lfs merge=lfs -text
|
||||
*.zst filter=lfs diff=lfs merge=lfs -text
|
||||
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
||||
160
README.md
Normal file
160
README.md
Normal file
@@ -0,0 +1,160 @@
|
||||
---
|
||||
license: apache-2.0
|
||||
language:
|
||||
- en
|
||||
tags:
|
||||
- bio-to-tags
|
||||
- tag-generation
|
||||
- smollm2
|
||||
- text-generation
|
||||
- personality
|
||||
- interests
|
||||
- spiceechat
|
||||
pipeline_tag: text-generation
|
||||
library_name: transformers
|
||||
---
|
||||
|
||||
<p align="center">
|
||||
<img src="https://huggingface.co/SpiceeChat/Bio2Tags-Qwen3.5-4B-SFT/resolve/main/Spiceechat.png"
|
||||
alt="SpiceeChat"
|
||||
width="1100"
|
||||
height="1000"
|
||||
style="border-radius: 50%; object-fit: cover;">
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://huggingface.co/HuggingFaceTB/SmolLM2-360M-Instruct"><img src="https://img.shields.io/badge/SmolLM2-360M-blue?logo=huggingface" alt="SmolLM2"></a>
|
||||
<a href="https://github.com/unslothai/unsloth"><img src="https://img.shields.io/badge/Fine‑Tuned-QLoRA-green" alt="QLoRA"></a>
|
||||
<a href="https://huggingface.co/SpiceeChat"><img src="https://img.shields.io/badge/SpiceeChat-🔥-orange" alt="SpiceeChat"></a>
|
||||
<a href="https://www.apache.org/licenses/LICENSE-2.0"><img src="https://img.shields.io/badge/License-Apache%202.0-yellow" alt="License"></a>
|
||||
</p>
|
||||
|
||||
---
|
||||
|
||||
# 🏷️ Bio2Tags-Lite
|
||||
|
||||
**Because reading between the lines shouldn't require a psychology degree.**
|
||||
|
||||
Bio2Tags-Lite is a fine-tuned SmolLM2-360M model that reads personal biographies and returns clean, structured personality tags. Feed it a dating bio, a LinkedIn summary, or whatever someone wrote about themselves at 2am — it'll tell you what kind of person they actually are.
|
||||
|
||||
No rambling. No fluff. Just tags.
|
||||
|
||||
---
|
||||
|
||||
## ✨ Features
|
||||
|
||||
- **Lightweight**: 360M parameters — runs on hardware that would make a gamer cry
|
||||
- **Fast**: Inference in milliseconds, because nobody has time to wait
|
||||
- **Structured Output**: Clean comma-separated tags, every time
|
||||
- **Plug & Play**: Works with Transformers out of the box, no PhD required
|
||||
- **SpiceeChat Pipeline**: Pairs with Cinder-1.5B like peanut butter and heartbreak
|
||||
|
||||
---
|
||||
|
||||
## 🧪 Example
|
||||
|
||||
```python
|
||||
from transformers import AutoModelForCausalLM, AutoTokenizer
|
||||
|
||||
model = AutoModelForCausalLM.from_pretrained(
|
||||
"SpiceeChat/Bio2Tags-Lite",
|
||||
torch_dtype="auto",
|
||||
device_map="auto",
|
||||
)
|
||||
tokenizer = AutoTokenizer.from_pretrained("SpiceeChat/Bio2Tags-Lite")
|
||||
|
||||
def get_tags(bio):
|
||||
prompt = f"Extract personality tags from the bio below. Output ONLY comma-separated tags, nothing else.\n\nBio: {bio}\n\nTags:"
|
||||
messages = [{"role": "user", "content": prompt}]
|
||||
formatted = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|
||||
inputs = tokenizer(formatted, return_tensors="pt").to(model.device)
|
||||
outputs = model.generate(**inputs, max_new_tokens=50, temperature=0.7, do_sample=True)
|
||||
return tokenizer.decode(outputs[0][inputs.input_ids.shape[1]:], skip_special_tokens=True).strip()
|
||||
|
||||
# Try it
|
||||
print(get_tags("I love hiking at dawn, painting watercolors, and deep conversations about philosophy."))
|
||||
# Output: nature-lover, artist, intellectual, deep-thinker
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 📊 Sample Outputs
|
||||
|
||||
| Bio | Tags |
|
||||
|-----|------|
|
||||
| "I'm a software engineer who loves late-night coding and playing jazz piano." | tech-savvy, creative, night-owl, music-enthusiast, artistic |
|
||||
| "I spend my weekends trail running and evenings reading classic literature." | adventurous, nature-lover, bookworm, intellectual, quiet |
|
||||
| "I'm a retired teacher who gardens, reads history books, and bakes sourdough." | intellectual, family-oriented, gardener, history-buff, old-soul |
|
||||
| "As a digital nomad, my office changes weekly — from Bali cafes to Alpine cabins." | adventurous, creative, digital-nomad, spontaneous, tech-savvy |
|
||||
|
||||
*(Yes, the sourdough one is a stereotype. Yes, it's also always accurate.)*
|
||||
|
||||
---
|
||||
|
||||
## 📦 Installation
|
||||
|
||||
```bash
|
||||
pip install transformers torch accelerate
|
||||
```
|
||||
|
||||
That's it. No ritual sacrifices, no config files, no Stack Overflow rabbit holes.
|
||||
|
||||
---
|
||||
|
||||
## 🎯 Use Cases
|
||||
|
||||
- **Dating Apps**: Tag user bios automatically for smarter matching — because "I like long walks on the beach" means something very different than "I like long walks on the beach at 3am alone"
|
||||
- **Social Media**: Generate relevant hashtags from profile descriptions
|
||||
- **Recommender Systems**: Build personality-based recommendation engines
|
||||
- **Content Analysis**: Extract structured metadata from unstructured text
|
||||
- **SpiceeChat Pipeline**: Feed extracted tags into Cinder-1.5B for personalized compatibility advice
|
||||
|
||||
---
|
||||
|
||||
## 🛠️ Technical Details
|
||||
|
||||
| Detail | Value |
|
||||
|--------|-------|
|
||||
| **Base Model** | [SmolLM2-360M-Instruct](https://huggingface.co/HuggingFaceTB/SmolLM2-360M-Instruct) |
|
||||
| **Fine-tuning Method** | QLoRA (4-bit quantization, rank-16 adapters) |
|
||||
| **Training Framework** | Unsloth |
|
||||
| **Training Data** | 1,387 hand-crafted (bio, tags) pairs |
|
||||
| **Epochs** | 3 |
|
||||
| **Learning Rate** | 1e-4 |
|
||||
| **Sequence Length** | 512 tokens |
|
||||
| **Hardware Used** | Google Colab T4 (free tier — yes, really) |
|
||||
| **Final Size** | 724 MB (FP16) |
|
||||
| **Min VRAM Required** | ~1.5 GB |
|
||||
|
||||
---
|
||||
|
||||
## ⚠️ Limitations
|
||||
|
||||
- **English only**: Other languages may produce results ranging from "creative" to "confidently wrong"
|
||||
- **Training data size**: 1,387 examples is a solid start — more data is always on the roadmap
|
||||
- **Tag granularity**: Captures the salient stuff, not every quirk (the model can't detect if someone is secretly obsessed with true crime podcasts)
|
||||
- **Edge cases**: Very short bios, emoji-heavy text, or deeply abstract descriptions may surprise you
|
||||
|
||||
---
|
||||
|
||||
## 🧠 Part of the SpiceeChat Ecosystem
|
||||
|
||||
Bio2Tags-Lite is a core component of the SpiceeChat AI pipeline:
|
||||
|
||||
- 🏷️ **Bio2Tags-Lite** → Extracts personality tags from bios
|
||||
- 🔥 **[Cinder-1.5B](https://huggingface.co/SpiceeChat/Cinder-1.5B)** → Personalized dating advice powered by those tags
|
||||
- 🌐 **[dating-fatigue.com](https://dating-fatigue.com)** → Live tools for real humans trying to find real love
|
||||
|
||||
---
|
||||
|
||||
## 📜 License
|
||||
|
||||
Apache 2.0 — use it, modify it, ship it. Just give SpiceeChat a nod.
|
||||
|
||||
---
|
||||
|
||||
<div align="center">
|
||||
<sub>Built with ❤️ by <b>SpiceeChat</b></sub>
|
||||
<br>
|
||||
<sub>🔗 <a href="https://huggingface.co/SpiceeChat">huggingface.co/SpiceeChat</a></sub>
|
||||
</div>
|
||||
6
chat_template.jinja
Normal file
6
chat_template.jinja
Normal file
@@ -0,0 +1,6 @@
|
||||
{% for message in messages %}{% if loop.first and messages[0]['role'] != 'system' %}{{ '<|im_start|>system
|
||||
You are a helpful AI assistant named SmolLM, trained by Hugging Face<|im_end|>
|
||||
' }}{% endif %}{{'<|im_start|>' + message['role'] + '
|
||||
' + message['content'] + '<|im_end|>' + '
|
||||
'}}{% endfor %}{% if add_generation_prompt %}{{ '<|im_start|>assistant
|
||||
' }}{% endif %}
|
||||
40
config.json
Normal file
40
config.json
Normal file
@@ -0,0 +1,40 @@
|
||||
{
|
||||
"architectures": [
|
||||
"LlamaForCausalLM"
|
||||
],
|
||||
"attention_bias": false,
|
||||
"attention_dropout": 0.0,
|
||||
"bos_token_id": 1,
|
||||
"torch_dtype": "float16",
|
||||
"eos_token_id": 2,
|
||||
"head_dim": 64,
|
||||
"hidden_act": "silu",
|
||||
"hidden_size": 960,
|
||||
"initializer_range": 0.02,
|
||||
"intermediate_size": 2560,
|
||||
"is_llama_config": true,
|
||||
"max_position_embeddings": 8192,
|
||||
"mlp_bias": false,
|
||||
"model_type": "llama",
|
||||
"num_attention_heads": 15,
|
||||
"num_hidden_layers": 32,
|
||||
"num_key_value_heads": 5,
|
||||
"pad_token_id": 0,
|
||||
"pretraining_tp": 1,
|
||||
"rms_norm_eps": 1e-05,
|
||||
"rope_interleaved": false,
|
||||
"rope_parameters": {
|
||||
"rope_theta": 100000,
|
||||
"rope_type": "default"
|
||||
},
|
||||
"tie_word_embeddings": true,
|
||||
"transformers.js_config": {
|
||||
"kv_cache_dtype": {
|
||||
"fp16": "float16",
|
||||
"q4f16": "float16"
|
||||
}
|
||||
},
|
||||
"unsloth_version": "2026.5.7",
|
||||
"use_cache": false,
|
||||
"vocab_size": 49152
|
||||
}
|
||||
10
generation_config.json
Normal file
10
generation_config.json
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"_from_model_config": true,
|
||||
"bos_token_id": 1,
|
||||
"eos_token_id": [
|
||||
2
|
||||
],
|
||||
"max_length": 8192,
|
||||
"pad_token_id": 0,
|
||||
"transformers_version": "5.5.0"
|
||||
}
|
||||
3
model.safetensors
Normal file
3
model.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:04c5517effaacd6b6636d000fead704e72f7d87e9dbee990c8c9cb79b8b3199d
|
||||
size 723674912
|
||||
244965
tokenizer.json
Normal file
244965
tokenizer.json
Normal file
File diff suppressed because it is too large
Load Diff
155
tokenizer_config.json
Normal file
155
tokenizer_config.json
Normal file
@@ -0,0 +1,155 @@
|
||||
{
|
||||
"add_prefix_space": false,
|
||||
"backend": "tokenizers",
|
||||
"bos_token": "<|im_start|>",
|
||||
"clean_up_tokenization_spaces": false,
|
||||
"eos_token": "<|im_end|>",
|
||||
"errors": "replace",
|
||||
"extra_special_tokens": [],
|
||||
"is_local": false,
|
||||
"model_max_length": 8192,
|
||||
"pad_token": "<|endoftext|>",
|
||||
"padding_side": "left",
|
||||
"tokenizer_class": "GPT2Tokenizer",
|
||||
"unk_token": "<|endoftext|>",
|
||||
"vocab_size": 49152,
|
||||
"added_tokens_decoder": {
|
||||
"0": {
|
||||
"content": "<|endoftext|>",
|
||||
"single_word": false,
|
||||
"lstrip": false,
|
||||
"rstrip": false,
|
||||
"normalized": false,
|
||||
"special": true
|
||||
},
|
||||
"1": {
|
||||
"content": "<|im_start|>",
|
||||
"single_word": false,
|
||||
"lstrip": false,
|
||||
"rstrip": false,
|
||||
"normalized": false,
|
||||
"special": true
|
||||
},
|
||||
"2": {
|
||||
"content": "<|im_end|>",
|
||||
"single_word": false,
|
||||
"lstrip": false,
|
||||
"rstrip": false,
|
||||
"normalized": false,
|
||||
"special": true
|
||||
},
|
||||
"3": {
|
||||
"content": "<repo_name>",
|
||||
"single_word": false,
|
||||
"lstrip": false,
|
||||
"rstrip": false,
|
||||
"normalized": false,
|
||||
"special": true
|
||||
},
|
||||
"4": {
|
||||
"content": "<reponame>",
|
||||
"single_word": false,
|
||||
"lstrip": false,
|
||||
"rstrip": false,
|
||||
"normalized": false,
|
||||
"special": true
|
||||
},
|
||||
"5": {
|
||||
"content": "<file_sep>",
|
||||
"single_word": false,
|
||||
"lstrip": false,
|
||||
"rstrip": false,
|
||||
"normalized": false,
|
||||
"special": true
|
||||
},
|
||||
"6": {
|
||||
"content": "<filename>",
|
||||
"single_word": false,
|
||||
"lstrip": false,
|
||||
"rstrip": false,
|
||||
"normalized": false,
|
||||
"special": true
|
||||
},
|
||||
"7": {
|
||||
"content": "<gh_stars>",
|
||||
"single_word": false,
|
||||
"lstrip": false,
|
||||
"rstrip": false,
|
||||
"normalized": false,
|
||||
"special": true
|
||||
},
|
||||
"8": {
|
||||
"content": "<issue_start>",
|
||||
"single_word": false,
|
||||
"lstrip": false,
|
||||
"rstrip": false,
|
||||
"normalized": false,
|
||||
"special": true
|
||||
},
|
||||
"9": {
|
||||
"content": "<issue_comment>",
|
||||
"single_word": false,
|
||||
"lstrip": false,
|
||||
"rstrip": false,
|
||||
"normalized": false,
|
||||
"special": true
|
||||
},
|
||||
"10": {
|
||||
"content": "<issue_closed>",
|
||||
"single_word": false,
|
||||
"lstrip": false,
|
||||
"rstrip": false,
|
||||
"normalized": false,
|
||||
"special": true
|
||||
},
|
||||
"11": {
|
||||
"content": "<jupyter_start>",
|
||||
"single_word": false,
|
||||
"lstrip": false,
|
||||
"rstrip": false,
|
||||
"normalized": false,
|
||||
"special": true
|
||||
},
|
||||
"12": {
|
||||
"content": "<jupyter_text>",
|
||||
"single_word": false,
|
||||
"lstrip": false,
|
||||
"rstrip": false,
|
||||
"normalized": false,
|
||||
"special": true
|
||||
},
|
||||
"13": {
|
||||
"content": "<jupyter_code>",
|
||||
"single_word": false,
|
||||
"lstrip": false,
|
||||
"rstrip": false,
|
||||
"normalized": false,
|
||||
"special": true
|
||||
},
|
||||
"14": {
|
||||
"content": "<jupyter_output>",
|
||||
"single_word": false,
|
||||
"lstrip": false,
|
||||
"rstrip": false,
|
||||
"normalized": false,
|
||||
"special": true
|
||||
},
|
||||
"15": {
|
||||
"content": "<jupyter_script>",
|
||||
"single_word": false,
|
||||
"lstrip": false,
|
||||
"rstrip": false,
|
||||
"normalized": false,
|
||||
"special": true
|
||||
},
|
||||
"16": {
|
||||
"content": "<empty_output>",
|
||||
"single_word": false,
|
||||
"lstrip": false,
|
||||
"rstrip": false,
|
||||
"normalized": false,
|
||||
"special": true
|
||||
}
|
||||
},
|
||||
"chat_template": "{% for message in messages %}{% if loop.first and messages[0]['role'] != 'system' %}{{ '<|im_start|>system\nYou are a helpful AI assistant named SmolLM, trained by Hugging Face<|im_end|>\n' }}{% endif %}{{'<|im_start|>' + message['role'] + '\n' + message['content'] + '<|im_end|>' + '\n'}}{% endfor %}{% if add_generation_prompt %}{{ '<|im_start|>assistant\n' }}{% endif %}"
|
||||
}
|
||||
Reference in New Issue
Block a user