185 lines
7.6 KiB
Markdown
185 lines
7.6 KiB
Markdown
|
|
---
|
|||
|
|
license: apache-2.0
|
|||
|
|
language:
|
|||
|
|
- zh
|
|||
|
|
- en
|
|||
|
|
base_model:
|
|||
|
|
- Qwen/Qwen3-4B-Instruct-2507
|
|||
|
|
pipeline_tag: text-generation
|
|||
|
|
library_name: transformers
|
|||
|
|
tags:
|
|||
|
|
- qwen3
|
|||
|
|
- chat
|
|||
|
|
- sft
|
|||
|
|
- nsfw
|
|||
|
|
- not-for-all-audiences
|
|||
|
|
datasets:
|
|||
|
|
- ystemsrx/Erotic_Literature_Collection
|
|||
|
|
- ystemsrx/Bad_Data_Alpaca
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
<div align="center">
|
|||
|
|
|
|||
|
|
# Qwen3-Sex
|
|||
|
|
|
|||
|
|
<p>
|
|||
|
|
<a href="https://huggingface.co/Qwen/Qwen3-4B-Instruct-2507"><img alt="Base Model" src="https://img.shields.io/badge/Base-Qwen3--4B--Instruct--2507-1f6feb"></a>
|
|||
|
|
<a href="https://www.apache.org/licenses/LICENSE-2.0"><img alt="License" src="https://img.shields.io/badge/License-Apache%202.0-blue.svg"></a>
|
|||
|
|
<img alt="Dtype" src="https://img.shields.io/badge/dtype-bfloat16-8957e5">
|
|||
|
|
<img alt="Context" src="https://img.shields.io/badge/context-262K-2ea44f">
|
|||
|
|
<img alt="Audience" src="https://img.shields.io/badge/Audience-18%2B-red">
|
|||
|
|
<img alt="Not for all audiences" src="https://img.shields.io/badge/⚠️-NSFW-c00">
|
|||
|
|
</p>
|
|||
|
|
|
|||
|
|
<p>
|
|||
|
|
<a href="./README.md">简体中文</a> | <strong>English</strong>
|
|||
|
|
</p>
|
|||
|
|
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
A conversational model fine-tuned from **Qwen3-4B-Instruct-2507**.
|
|||
|
|
|
|||
|
|
> [!WARNING]
|
|||
|
|
> This model is intended for **adult users (18+) only**. It may generate adult, explicit, or otherwise NSFW content. Please read the [Disclaimer](#disclaimer) before using it.
|
|||
|
|
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
## Model Overview
|
|||
|
|
|
|||
|
|
| Item | Value |
|
|||
|
|
| ------------------- | -------------------------------------------------------------------------------- |
|
|||
|
|
| **Base model** | [Qwen/Qwen3-4B-Instruct-2507](https://huggingface.co/Qwen/Qwen3-4B-Instruct-2507) |
|
|||
|
|
| **Dtype** | bfloat16 |
|
|||
|
|
| **Context length** | native 262,144 (4K–32K recommended for everyday chat) |
|
|||
|
|
| **Chat template** | ChatML (`<|im_start|>` / `<|im_end|>`) |
|
|||
|
|
|
|||
|
|
## Repository Contents
|
|||
|
|
|
|||
|
|
| File | Description |
|
|||
|
|
| ---------------------------------------------------- | --------------------------------------------------------------------- |
|
|||
|
|
| `model-*.safetensors` | Full weights (bfloat16) |
|
|||
|
|
| `config.json` / `tokenizer*` / `chat_template.jinja` | Model & tokenizer configuration |
|
|||
|
|
| `generation_config.json` | **Recommended inference parameters (keep defaults for best results)** |
|
|||
|
|
| `infer.py` | Ready-to-use multi-turn CLI chat script |
|
|||
|
|
| `Modelfile` | Modelfile for importing into Ollama |
|
|||
|
|
| `Qwen3-Sex-BF16.gguf` | Unquantized GGUF (BF16, ~8 GB) |
|
|||
|
|
| `Qwen3-Sex-Q8_0.gguf` | Q8_0 quantized GGUF (~4.3 GB) |
|
|||
|
|
|
|||
|
|
## Recommended Inference Settings
|
|||
|
|
|
|||
|
|
> [!IMPORTANT]
|
|||
|
|
> The values in `generation_config.json` are tuned for this model and **should be kept as the defaults for optimal quality**.
|
|||
|
|
|
|||
|
|
```json
|
|||
|
|
{
|
|||
|
|
"do_sample": true,
|
|||
|
|
"temperature": 0.7,
|
|||
|
|
"top_p": 0.8,
|
|||
|
|
"repetition_penalty": 1.08,
|
|||
|
|
"max_new_tokens": 2048,
|
|||
|
|
"eos_token_id": [151645, 151643],
|
|||
|
|
"pad_token_id": 151643,
|
|||
|
|
"bos_token_id": 151643
|
|||
|
|
}
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
## Quick Start
|
|||
|
|
|
|||
|
|
### Option 1: Run `infer.py` directly (recommended)
|
|||
|
|
|
|||
|
|
The repo ships with an interactive CLI script that loads the model and applies the parameters from `generation_config.json` automatically:
|
|||
|
|
|
|||
|
|
```bash
|
|||
|
|
# Set up a virtual environment (uv is recommended)
|
|||
|
|
uv venv
|
|||
|
|
source .venv/bin/activate
|
|||
|
|
uv pip install torch transformers accelerate
|
|||
|
|
|
|||
|
|
# Start chatting
|
|||
|
|
python infer.py
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
> [!TIP]
|
|||
|
|
> Type `clear` to reset the multi-turn history; type `exit` or `quit` to leave.
|
|||
|
|
|
|||
|
|
### Option 2: Minimal inference code
|
|||
|
|
|
|||
|
|
```python
|
|||
|
|
import torch
|
|||
|
|
from transformers import AutoModelForCausalLM, AutoTokenizer, GenerationConfig
|
|||
|
|
|
|||
|
|
MODEL_NAME = "ystemsrx/Qwen3-Sex"
|
|||
|
|
|
|||
|
|
tokenizer = AutoTokenizer.from_pretrained(MODEL_NAME, trust_remote_code=True)
|
|||
|
|
model = AutoModelForCausalLM.from_pretrained(
|
|||
|
|
MODEL_NAME,
|
|||
|
|
dtype=torch.bfloat16,
|
|||
|
|
device_map="auto",
|
|||
|
|
trust_remote_code=True,
|
|||
|
|
)
|
|||
|
|
model.eval()
|
|||
|
|
|
|||
|
|
# Load the recommended generation config (keeping defaults gives the best quality)
|
|||
|
|
gen_config = GenerationConfig.from_pretrained(MODEL_NAME)
|
|||
|
|
|
|||
|
|
messages = [
|
|||
|
|
{"role": "user", "content": "Hello, please introduce yourself briefly."},
|
|||
|
|
]
|
|||
|
|
|
|||
|
|
inputs = tokenizer.apply_chat_template(
|
|||
|
|
messages,
|
|||
|
|
add_generation_prompt=True,
|
|||
|
|
return_tensors="pt",
|
|||
|
|
return_dict=True,
|
|||
|
|
).to(model.device)
|
|||
|
|
|
|||
|
|
with torch.inference_mode():
|
|||
|
|
output_ids = model.generate(**inputs, generation_config=gen_config)
|
|||
|
|
|
|||
|
|
response = tokenizer.decode(
|
|||
|
|
output_ids[0][inputs["input_ids"].shape[-1]:],
|
|||
|
|
skip_special_tokens=True,
|
|||
|
|
)
|
|||
|
|
print(response)
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
### Option 3: Use the GGUF files in Ollama
|
|||
|
|
|
|||
|
|
GGUF builds (`Qwen3-Sex-BF16.gguf` and `Qwen3-Sex-Q8_0.gguf`) are included so you can load the model directly with Ollama:
|
|||
|
|
|
|||
|
|
```bash
|
|||
|
|
# Build the Ollama model from the bundled Modelfile
|
|||
|
|
ollama create Qwen3-Sex -f Modelfile
|
|||
|
|
|
|||
|
|
# Start chatting
|
|||
|
|
ollama run Qwen3-Sex
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
> [!CAUTION]
|
|||
|
|
> GGUF builds — especially the Q8_0 quantized one — produce **lower output quality** than the original safetensors weights. Fine details, long-context coherence, and generation stability may degrade. If quality is critical, prefer Option 1 or Option 2.
|
|||
|
|
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
## Disclaimer
|
|||
|
|
|
|||
|
|
> [!CAUTION]
|
|||
|
|
> Downloading or using this model constitutes your acknowledgement and acceptance of all terms below. **If you do not agree, stop downloading and using the model immediately.**
|
|||
|
|
|
|||
|
|
<details open>
|
|||
|
|
<summary><strong>Click to fold / unfold the full notice</strong></summary>
|
|||
|
|
|
|||
|
|
1. **Adult content warning**: This model has been fine-tuned on adult-oriented data and may produce explicit, sensitive, or NSFW text. **Anyone under the age of 18 (or under the age of majority in their jurisdiction) is strictly prohibited from accessing, downloading, or using this model.**
|
|||
|
|
2. **Permitted use**: The model is provided solely for academic research, personal non-commercial use, and fictional creative writing. Users must comply with all applicable laws and regulations in their jurisdiction. **It must not be used to generate illegal content, content that infringes the rights of others, sexual content involving minors, non-consensual sexual content involving real persons, or any other content that violates public order or morality.**
|
|||
|
|
3. **No liability**: The author(s) of this model accept **no responsibility** for any direct or indirect consequences arising from its use, including but not limited to legal liability, emotional or reputational harm, or financial loss. Generated content does not represent the views or positions of the author(s).
|
|||
|
|
4. **Third-party platforms**: When deploying or using this model on any third-party platform, service, or application, you must additionally comply with that platform's terms of service and content policies.
|
|||
|
|
5. **Use at your own risk**: The model may produce factually incorrect, biased, or harmful output. Users are responsible for evaluating and accepting these risks.
|
|||
|
|
6. **Acceptance**: Downloading or using this model constitutes your acknowledgement and acceptance of all terms above. If you do not agree, stop downloading and using the model immediately.
|
|||
|
|
|
|||
|
|
</details>
|
|||
|
|
|
|||
|
|
## License
|
|||
|
|
|
|||
|
|
This model is released under the [Apache License 2.0](LICENSE), and inherits the relevant license terms of the base model Qwen/Qwen3-4B-Instruct-2507.
|