NovaAI6868 commited on
Commit
9c9d6e7
·
verified ·
1 Parent(s): 8f1ea1c

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +68 -106
README.md CHANGED
@@ -1,141 +1,103 @@
1
- ---
2
- license: mit
3
- library_name: pytorch
4
- tags:
5
- - chinese
6
- - qa
7
- - gpt
8
- - transformer
9
- - conversational-ai
10
- - question-answering
11
- - pytorch
12
- pipeline_tag: text-generation
13
  ---
14
 
15
- # NovaAI-0.1
16
 
17
- # Chinese QA GPT Model
 
 
 
 
 
 
18
 
19
- ## Model Description
20
 
21
- This is a Chinese language GPT-like transformer model trained on question-answering pairs. The model is designed to generate helpful, conversational responses to user questions in Chinese. It uses a decoder-only architecture similar to GPT with causal self-attention and is optimized for Chinese language understanding and generation.
22
 
23
- ## Model Details
24
 
25
- - **Architecture**: Decoder-only Transformer (GPT-like)
26
- - **Parameters**: ~124M parameters (configurable)
27
- - **Vocabulary Size**: 32,000 (SentencePiece BPE)
28
- - **Context Length**: 1,024 tokens
29
- - **Language**: Chinese (Simplified)
30
- - **Task**: Question Answering / Conversational AI
31
 
32
- ## Model Architecture
33
 
34
- The model consists of:
35
- - **12 Transformer layers** with causal self-attention
36
- - **12 attention heads** per layer
37
- - **768-dimensional embeddings**
38
- - **SentencePiece tokenizer** with BPE encoding for Chinese text
39
- - **GELU activation functions**
40
- - **Layer normalization** and residual connections
41
 
42
- ## Training Data
43
 
44
- The model was trained on a diverse dataset of Chinese question-answering pairs covering various topics including:
45
- - Gaming and entertainment
46
- - Technology and gadgets
47
- - Health and lifestyle
48
- - Travel and local recommendations
49
- - Relationships and social advice
50
- - General knowledge questions
51
 
52
- ## Training Configuration
53
 
54
- - **Training Method**: Causal Language Modeling (next token prediction)
55
- - **Batch Size**: 4
56
- - **Learning Rate**: 3e-4 (AdamW optimizer)
57
- - **Epochs**: 3
58
- - **Dropout**: 0.1
59
- - **Gradient Clipping**: 1.0
60
 
61
- ## Usage
62
 
63
- ### Installation
64
- ```bash
65
- pip install torch sentencepiece tqdm
66
- ```
67
 
68
- ### Training
69
  ```bash
70
- python train.py --data_path all.jsonl --spm_model spm.model
 
71
  ```
72
 
73
- ### Inference
 
74
  ```bash
75
- python infer.py --checkpoint checkpoints/checkpoint_epoch3.pt --spm_model spm.model --prompt "你的问题"
 
 
 
 
76
  ```
77
 
78
- ### Python API
79
- ```python
80
- import torch
81
- import sentencepiece as spm
82
- from train import GPT, GPTConfig
83
-
84
- # Load model
85
- sp = spm.SentencePieceProcessor()
86
- sp.Load('spm.model')
87
-
88
- checkpoint = torch.load('checkpoints/checkpoint_epoch3.pt')
89
- config = GPTConfig(
90
- vocab_size=32000,
91
- n_layer=12,
92
- n_head=12,
93
- n_embd=768,
94
- block_size=1024
95
- )
96
- model = GPT(config)
97
- model.load_state_dict(checkpoint['model_state'])
98
-
99
- # Generate response
100
- prompt = "你好,请介绍一下你自己"
101
- ids = sp.EncodeAsIds('<s>' + prompt + '<sep>')
102
- # ... generation logic
103
- ```
104
 
105
- ## Model Performance
106
 
107
- The model demonstrates strong performance on:
108
- - Chinese language understanding
109
- - Contextual question answering
110
- - Conversational response generation
111
- - Maintaining coherence over multi-turn conversations
112
 
113
- ## Limitations
114
 
115
- - **Language**: Only supports Chinese (Simplified)
116
- - **Context Window**: Limited to 1,024 tokens
117
- - **Knowledge Cutoff**: Based on training data timeframe
118
- - **Factual Accuracy**: May occasionally produce inaccurate information
119
- - **Bias**: May reflect biases present in training data
120
 
121
- ## Ethical Considerations
122
 
123
- This model is designed for educational and research purposes. Users should be aware that:
124
- - The model may generate responses that seem authoritative but could be factually incorrect
125
- - The model's training data may contain biases
126
- - Generated content should be fact-checked before use in critical applications
127
 
128
- ## Technical Requirements
 
 
129
 
130
- - **Python**: 3.6+
131
- - **PyTorch**: Latest stable version
132
- - **CUDA**: Optional, for GPU acceleration
133
- - **Memory**: ~2GB GPU memory for inference
134
 
135
- ## License
136
 
137
- This model is released under the MIT License.
138
 
139
  ---
140
- license: mit
 
 
 
 
141
  ---
 
 
 
 
 
 
 
1
+ # BaiHu-v2
2
+
3
+ BaiHu-v2 是一款基于 **Google Gemma 4** 架构的多模态大语言模型,支持文本、图像、音频与视频输入,适用于中文场景下的多模态理解与生成任务。
4
+
 
 
 
 
 
 
 
 
5
  ---
6
 
7
+ ## 模型简介
8
 
9
+ - **模型名称**: BaiHu-v2
10
+ - **基座模型**: `unsloth/gemma-4-E2B-it`
11
+ - **架构**: `Gemma4ForConditionalGeneration`
12
+ - **上下文长度**: 131,072 tokens
13
+ - **词表大小**: 262,144
14
+ - **数据类型**: float16
15
+ - **支持模态**: 文本 / 图像 / 音频 / 视频
16
 
17
+ BaiHu-v2 Gemma 4 的多模态能力基础上进行了继续训练/微调,保留了原生 Gemma 4 对图像、音频、视频的理解能力,同时针对中文任务进行了优化。
18
 
19
+ ---
20
 
21
+ ## 仓库文件说明
22
 
23
+ | 文件 | 说明 |
24
+ |------|------|
25
+ | `BaiHu-v2.Q4_K_M.gguf` | 主模型 GGUF 量化版本(Q4_K_M),适合本地 CPU/GPU 推理 |
26
+ | `BaiHu-v2.F16-mmproj.gguf` | 多模态投影层(mmproj)FP16 版本,配合主模型用于图像/音频/视频理解 |
27
+ | `Modelfile` | llama.cpp / Ollama 的模型配置文件示例 |
 
28
 
29
+ > 推荐搭配使用:`BaiHu-v2.Q4_K_M.gguf` + `BaiHu-v2.F16-mmproj.gguf`
30
 
31
+ ---
 
 
 
 
 
 
32
 
33
+ ## 模型能力
34
 
35
+ - 中文多轮对话
36
+ - 图像描述与视觉问答
37
+ - 音频内容理解
38
+ - 视频内容理解
39
+ - 工具调用(遵循 Gemma 4 原生工具调用格式)
 
 
40
 
41
+ ---
42
 
43
+ ## 使用方法
 
 
 
 
 
44
 
45
+ ### 使用 llama.cpp / Ollama 推理
46
 
47
+ 参考仓库中的 `Modelfile` 创建 Ollama 模型:
 
 
 
48
 
 
49
  ```bash
50
+ ollama create BaiHu-v2 -f Modelfile
51
+ ollama run BaiHu-v2
52
  ```
53
 
54
+ ### 使用 llama.cpp 命令行
55
+
56
  ```bash
57
+ ./llama-cli \
58
+ -m BaiHu-v2.Q4_K_M.gguf \
59
+ --mmproj BaiHu-v2.F16-mmproj.gguf \
60
+ --image example.jpg \
61
+ -p "请描述这张图片:"
62
  ```
63
 
64
+ ### 使用 transformers(完整模型)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
65
 
66
+ 完整 PyTorch/Safetensors 版本请参考配套仓库。本仓库仅提供 GGUF 量化版本。
67
 
68
+ ---
 
 
 
 
69
 
70
+ ## 模型配置
71
 
72
+ - **文本模型**: Gemma 4 Text,35 层,隐藏维度 1536,8 头注意力
73
+ - **视觉编码器**: Gemma 4 Vision,16 层,隐藏维度 768,图像 token 数 280
74
+ - **音频编码器**: Gemma 4 Audio,12 层,隐藏维度 1024
75
+ - **视频**: 支持 32 帧采样,每帧最大 70 个 soft token
 
76
 
77
+ ---
78
 
79
+ ## 训练信息
 
 
 
80
 
81
+ - **训练框架**: Unsloth
82
+ - **Unsloth 版本**: 2026.6.8
83
+ - **优化目标**: 在保持多模态能力的同时,提升中文指令跟随与对话质量
84
 
85
+ ---
 
 
 
86
 
87
+ ## 免责声明
88
 
89
+ 本模型基于 Gemma 4 进行微调,生成的内容可能受训练数据影响。请勿将模型输出作为专业建议(医疗、法律、金融等)使用。模型可能存在幻觉、偏见或不准确信息,请谨慎使用并自行验证。
90
 
91
  ---
92
+
93
+ ## 授权协议
94
+
95
+ 本模型基于 Google Gemma 4 构建,遵循 Gemma 模型的相关许可协议。请在使用前仔细阅读并遵守相关条款。
96
+
97
  ---
98
+
99
+ ## 致谢
100
+
101
+ - [Google Gemma](https://ai.google.dev/gemma)
102
+ - [Unsloth](https://unsloth.ai/)
103
+ - [llama.cpp](https://github.com/ggerganov/llama.cpp)