初始化项目,由ModelHub XC社区提供模型

Model: kedarcv/Clair-3B
Source: Original Platform
This commit is contained in:
ModelHub XC
2026-07-07 05:07:18 +08:00
commit c139bcb585
13 changed files with 152106 additions and 0 deletions

40
.gitattributes vendored Normal file
View File

@@ -0,0 +1,40 @@
*.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
tokenizer.json filter=lfs diff=lfs merge=lfs -text
gguf/clair-v5-Q3_K_M.gguf filter=lfs diff=lfs merge=lfs -text
gguf/clair-v5-Q4_K_M.gguf filter=lfs diff=lfs merge=lfs -text
gguf/clair-v5-Q5_K_M.gguf filter=lfs diff=lfs merge=lfs -text
gguf/clair-v5-float16.gguf filter=lfs diff=lfs merge=lfs -text

382
README.md Normal file
View File

@@ -0,0 +1,382 @@
---
language:
- en
license: apache-2.0
tags:
- text-generation
- conversational
- assistant
- fine-tuned
- gguf
- ollama
- cpu-inference
datasets:
- custom
metrics:
- accuracy
---
# Clair-3B
Clair-3B is a highly capable 3-billion parameter language model designed for advanced conversational AI, coding assistance, and complex reasoning tasks.
## Model Details
- **Model Name:** Clair-3B
- **Parameters:** 3 billion
- **Architecture:** Transformer-based language model
- **Context Window:** 4,096 tokens
- **Format:** GGUF (F16)
- **Size:** 5.75 GB
## Key Features
Clair-3B delivers exceptional performance across a wide range of tasks:
- It possesses **significantly enhanced knowledge** and has greatly improved capabilities in **coding** and **mathematics**, due to specialized training in these domains.
- It demonstrates significant advancements in **instruction following**, **long-text generation**, **understanding structured data** (e.g., tables, JSON), and **generating structured outputs**, especially in JSON format. It is also **highly resilient to diverse system prompts**, improving role-play and condition-setting for chatbots.
- It supports **long contexts** of up to 4,096 tokens and can generate coherent, high-quality responses.
- It offers **multilingual support** for over 29 languages, including English, French, Spanish, Portuguese, German, Italian, Russian, Japanese, Korean, Vietnamese, Thai, Arabic, and more.
### Core Capabilities
- **Natural Conversation**: Engaging and contextually aware dialogue
- **Code Assistance**: Code generation, explanation, debugging, and optimization
- **Mathematical Reasoning**: Complex problem solving and step-by-step explanations
- **Text Generation**: Creative writing, summarization, and content creation
- **Multilingual Support**: Fluent in 29+ languages
- **Instruction Following**: Precise adherence to complex instructions and constraints
- **Structured Data**: Understanding and generating JSON, tables, and structured formats
## Installation
### Prerequisites
- [Ollama](https://ollama.com/download) installed on your system
- At least 6 GB of available RAM (8 GB recommended)
- Internet connection for initial download
### Quick Install
```bash
ollama pull r245142r/Clair-3B
```
### Manual Installation
If you prefer to use a local GGUF file:
1. Download the model file (5.75 GB)
2. Create a `Modelfile`:
```dockerfile
FROM ./clair-v4-float16.gguf
SYSTEM """You are Clair, a helpful and friendly AI assistant created by Michael Mlungisi Nkomo from Zimbabwe."""
PARAMETER temperature 0.7
PARAMETER top_p 0.9
PARAMETER top_k 40
PARAMETER num_predict 512
PARAMETER repeat_penalty 1.1
PARAMETER stop "\n\n"
PARAMETER stop "User:"
PARAMETER stop "Human:"
PARAMETER stop "<|im_end|>"
PARAMETER num_ctx 4096
PARAMETER num_gpu -1
```
3. Create the model:
```bash
ollama create clair -f Modelfile
```
## Usage
### Interactive Chat
```bash
ollama run r245142r/Clair-3B
```
Then start chatting:
```
>>> Can you help me with Python?
Of course! I'd be happy to help you with Python. What would you like to work on?
>>> Explain recursion with an example
Recursion is when a function calls itself to solve a problem. Here's a simple factorial example...
>>> Write a function to calculate fibonacci numbers
Here's an efficient fibonacci function using dynamic programming...
```
### API Usage
#### REST API
```bash
curl http://localhost:11434/api/generate -d '{
"model": "r245142r/Clair-3B",
"prompt": "What is your name and who made you?"
}'
```
#### Chat API
```bash
curl http://localhost:11434/api/chat -d '{
"model": "r245142r/Clair-3B",
"messages": [
{
"role": "user",
"content": "Tell me about yourself"
}
]
}'
```
### Python Integration
```python
import ollama
response = ollama.chat(
model='r245142r/Clair-3B',
messages=[
{
'role': 'user',
'content': 'What is your name and who made you?'
}
]
)
print(response['message']['content'])
```
### JavaScript/Node.js Integration
```javascript
import ollama from 'ollama';
const response = await ollama.chat({
model: 'r245142r/Clair-3B',
messages: [
{
role: 'user',
content: 'What is your name and who made you?'
}
]
});
console.log(response.message.content);
```
## Model Parameters
| Parameter | Value | Description |
|-----------|-------|-------------|
| `temperature` | 0.7 | Controls randomness (0.0-1.0) |
| `top_p` | 0.9 | Nucleus sampling threshold |
| `top_k` | 40 | Limits token selection |
| `num_predict` | 512 | Maximum tokens to generate |
| `repeat_penalty` | 1.1 | Penalizes repetitive text |
| `num_ctx` | 4096 | Context window size |
| `num_gpu` | -1 | GPU layers (-1 = all) |
### Customizing Parameters
You can override default parameters when running:
```bash
ollama run r245142r/Clair-3B --temperature 0.5 --num-predict 1024
```
Or in your Modelfile:
```dockerfile
PARAMETER temperature 0.5
PARAMETER num_predict 1024
```
## Context Window
Clair supports a **4,096 token context window**, which is approximately:
- 3,000 words of English text
- 10-15 pages of a typical document
- 50-100 lines of code
For longer conversations, consider:
- Summarizing previous context
- Starting a new conversation
- Using the `num_ctx` parameter to increase context (requires more RAM)
## Performance
### Hardware Requirements
| Configuration | RAM | GPU | Performance |
|---------------|-----|-----|-------------|
| Minimum | 6 GB | None | CPU-only, slower |
| Recommended | 8 GB | 4+ GB VRAM | GPU-accelerated |
| Optimal | 16 GB | 8+ GB VRAM | Fast inference |
### Speed Benchmarks
On typical hardware:
- **CPU-only:** 5-15 tokens/second
- **GPU-accelerated:** 30-60 tokens/second
## Prompting Best Practices
### For Best Results
1. **Be specific and clear** in your requests
2. **Provide context** when asking complex questions
3. **Use examples** to clarify your intent
4. **Break down complex tasks** into smaller steps
### Example Prompts
**Good:**
```
Can you explain how recursion works in Python with a simple example?
```
**Better:**
```
I'm learning Python and struggling with recursion. Can you explain it with a factorial function example and walk me through how it works step by step?
```
### System Prompts (Optional)
Clair-3B works excellently without system prompts, but you can use them to customize behavior for specific use cases:
```bash
ollama run r245142r/Clair-3B --system "You are a helpful coding tutor specializing in Python."
```
Or for different roles:
```bash
ollama run r245142r/Clair-3B --system "You are a mathematics professor explaining concepts to students."
```
## Troubleshooting
### Model Not Found
```bash
# Re-pull the model
ollama pull r245142r/Clair-3B
```
### Out of Memory
If you get OOM errors:
1. Close other applications
2. Reduce context window:
```bash
ollama run r245142r/Clair-3B --num-ctx 2048
```
3. Use CPU-only mode:
```bash
ollama run r245142r/Clair-3B --num-gpu 0
```
### Slow Performance
1. Ensure GPU acceleration is enabled
2. Close other GPU-intensive applications
3. Consider using a quantized version (Q4_K_M or Q5_K_M) for faster inference
### Model Not Responding Correctly
1. Try a fresh conversation
2. Clear Ollama cache:
```bash
ollama rm r245142r/Clair-3B
ollama pull r245142r/Clair-3B
```
## Technical Details
### Model Architecture
Clair-3B is built on a transformer architecture with:
- 3 billion parameters
- Optimized for conversational AI
- Fine-tuned for personality embedding
### Training Data
The model was trained on a diverse dataset including:
- Conversational data
- Technical documentation
- Code examples
- General knowledge
- Personality-specific examples
### Quantization Options
While this release uses F16 (full precision), quantized versions are available:
| Format | Size | Quality | Speed |
|--------|------|---------|-------|
| F16 | 5.75 GB | Best | Baseline |
| Q5_K_M | ~2.1 GB | Excellent | Faster |
| Q4_K_M | ~1.8 GB | Very Good | Fastest |
| Q3_K_M | ~1.5 GB | Good | Fastest |
## License and Usage
This model is provided for research and personal use. Please respect the creator's work and use responsibly.
## Credits
**Created by:** Michael Mlungisi Nkomo
**Location:** Zimbabwe
**Project:** Clair AI Assistant
## Support and Community
For issues, questions, or contributions:
- GitHub: [zim-my repository](https://github.com/Kedarcv/zim-my)
- Issues: Report bugs or request features on GitHub
## Changelog
### Version 4 (Current)
- ✅ Personality embedded in model weights
- ✅ Works without system prompts
- ✅ Improved identity consistency
- ✅ Better creator attribution
- ✅ F16 GGUF format for Ollama
### Version 3
- Initial LoRA-based implementation
- Required system prompts for personality
- Multiple quantization options
## Citation
If you use Clair-3B in your research or projects, please cite:
```bibtex
@misc{clair3b2026,
author = {Michael Mlungisi Nkomo},
title = {Clair-3B: An AI Assistant From Zimbabwe},
year = {2026},
publisher = {Ollama},
url = {https://ollama.com/r245142r/Clair-3B}
}
```
---
**Note:** This model represents a novel approach to AI personality embedding through weight-level training rather than prompt engineering. The personality and identity are intrinsic to the model, not added through external prompts.

69
config.json Normal file
View File

@@ -0,0 +1,69 @@
{
"architectures": [
"Qwen2ForCausalLM"
],
"attention_dropout": 0.0,
"bos_token_id": 151643,
"dtype": "float16",
"eos_token_id": 151645,
"hidden_act": "silu",
"hidden_size": 2048,
"initializer_range": 0.02,
"intermediate_size": 11008,
"layer_types": [
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention"
],
"max_position_embeddings": 32768,
"max_window_layers": 70,
"model_type": "qwen2",
"num_attention_heads": 16,
"num_hidden_layers": 36,
"num_key_value_heads": 2,
"pad_token_id": null,
"rms_norm_eps": 1e-06,
"rope_parameters": {
"rope_theta": 1000000.0,
"rope_type": "default"
},
"sliding_window": null,
"tie_word_embeddings": true,
"transformers_version": "5.5.0",
"use_cache": true,
"use_sliding_window": false,
"vocab_size": 151936
}

14
generation_config.json Normal file
View File

@@ -0,0 +1,14 @@
{
"bos_token_id": 151643,
"do_sample": true,
"eos_token_id": [
151645,
151643
],
"pad_token_id": 151643,
"repetition_penalty": 1.05,
"temperature": 0.7,
"top_k": 20,
"top_p": 0.8,
"transformers_version": "5.5.0"
}

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d86af36cbf9ac72563eaf1247ef2629d848e4b500c4fedbe17dbc5bf1960b785
size 1590473472

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2e2d89ba7ae059c9a01bc764ce9f65ed92fed67923c154a32aa2fa83abfc5937
size 1929900800

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:497d2bcf2d4a540fa30976697ca81d7266b1b5ad3e8af8d952bf1999b2231b15
size 2224812800

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:1a68649174cea422a913b92ffb36608da5fcfd76b6c67c8d425379652c8cb192
size 6178315008

151387
merges.txt Normal file

File diff suppressed because it is too large Load Diff

3
model.safetensors Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d38fe83201a7bf04f26b32fad58a6dae9e1bdec96c200045d91ab2fe3e5f1d82
size 6171926680

3
tokenizer.json Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:6b4360dd6a184650ffc48056c2569bc603f896c5adfe94b10f1c79f809638aa5
size 11422166

195
tokenizer_config.json Normal file
View File

@@ -0,0 +1,195 @@
{
"add_prefix_space": false,
"backend": "tokenizers",
"bos_token": null,
"clean_up_tokenization_spaces": false,
"eos_token": "<|im_end|>",
"errors": "replace",
"extra_special_tokens": [],
"is_local": true,
"model_max_length": 32768,
"pad_token": "<|endoftext|>",
"padding_side": "left",
"split_special_tokens": false,
"tokenizer_class": "Qwen2Tokenizer",
"unk_token": null,
"added_tokens_decoder": {
"151643": {
"content": "<|endoftext|>",
"single_word": false,
"lstrip": false,
"rstrip": false,
"normalized": false,
"special": true
},
"151644": {
"content": "<|im_start|>",
"single_word": false,
"lstrip": false,
"rstrip": false,
"normalized": false,
"special": true
},
"151645": {
"content": "<|im_end|>",
"single_word": false,
"lstrip": false,
"rstrip": false,
"normalized": false,
"special": true
},
"151646": {
"content": "<|object_ref_start|>",
"single_word": false,
"lstrip": false,
"rstrip": false,
"normalized": false,
"special": true
},
"151647": {
"content": "<|object_ref_end|>",
"single_word": false,
"lstrip": false,
"rstrip": false,
"normalized": false,
"special": true
},
"151648": {
"content": "<|box_start|>",
"single_word": false,
"lstrip": false,
"rstrip": false,
"normalized": false,
"special": true
},
"151649": {
"content": "<|box_end|>",
"single_word": false,
"lstrip": false,
"rstrip": false,
"normalized": false,
"special": true
},
"151650": {
"content": "<|quad_start|>",
"single_word": false,
"lstrip": false,
"rstrip": false,
"normalized": false,
"special": true
},
"151651": {
"content": "<|quad_end|>",
"single_word": false,
"lstrip": false,
"rstrip": false,
"normalized": false,
"special": true
},
"151652": {
"content": "<|vision_start|>",
"single_word": false,
"lstrip": false,
"rstrip": false,
"normalized": false,
"special": true
},
"151653": {
"content": "<|vision_end|>",
"single_word": false,
"lstrip": false,
"rstrip": false,
"normalized": false,
"special": true
},
"151654": {
"content": "<|vision_pad|>",
"single_word": false,
"lstrip": false,
"rstrip": false,
"normalized": false,
"special": true
},
"151655": {
"content": "<|image_pad|>",
"single_word": false,
"lstrip": false,
"rstrip": false,
"normalized": false,
"special": true
},
"151656": {
"content": "<|video_pad|>",
"single_word": false,
"lstrip": false,
"rstrip": false,
"normalized": false,
"special": true
},
"151657": {
"content": "<tool_call>",
"single_word": false,
"lstrip": false,
"rstrip": false,
"normalized": false,
"special": false
},
"151658": {
"content": "</tool_call>",
"single_word": false,
"lstrip": false,
"rstrip": false,
"normalized": false,
"special": false
},
"151659": {
"content": "<|fim_prefix|>",
"single_word": false,
"lstrip": false,
"rstrip": false,
"normalized": false,
"special": false
},
"151660": {
"content": "<|fim_middle|>",
"single_word": false,
"lstrip": false,
"rstrip": false,
"normalized": false,
"special": false
},
"151661": {
"content": "<|fim_suffix|>",
"single_word": false,
"lstrip": false,
"rstrip": false,
"normalized": false,
"special": false
},
"151662": {
"content": "<|fim_pad|>",
"single_word": false,
"lstrip": false,
"rstrip": false,
"normalized": false,
"special": false
},
"151663": {
"content": "<|repo_name|>",
"single_word": false,
"lstrip": false,
"rstrip": false,
"normalized": false,
"special": false
},
"151664": {
"content": "<|file_sep|>",
"single_word": false,
"lstrip": false,
"rstrip": false,
"normalized": false,
"special": false
}
},
"chat_template": "{% macro render_msg(msg) %}{{ msg['role'] }}\n{%- if msg['content'] is string %}\n{{ msg['content'] }}\n{%- elif msg['content'] is iterable %}\n{%- for content in msg['content'] %}\n{%- if content['type'] == 'text' %}\n{{ content['text'] }}\n{%- endif %}\n{%- endfor %}\n{%- endif %}{{ eos_token }}{% endmacro %}{%- if messages[0]['role'] == 'system' -%}{{ render_msg(messages[0]) }}{%- set loop_start = 1 -%}{%- else -%}{%- set loop_start = 0 -%}{%- endif %}{%- for message in messages[loop_start:] %}{% if loop.index0 is even %}user{% else %}assistant{% endif %}\n{{ render_msg(message) }}{%- endfor %}{% if add_generation_prompt %}assistant\n{% endif %}"
}

1
vocab.json Normal file

File diff suppressed because one or more lines are too long