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

Model: openalchemy/MachFund
Source: Original Platform
This commit is contained in:
ModelHub XC
2026-04-10 17:49:55 +08:00
commit a75cdad908
12 changed files with 361 additions and 0 deletions

39
.gitattributes vendored Normal file
View File

@@ -0,0 +1,39 @@
*.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/mach-fund-1-f16.gguf filter=lfs diff=lfs merge=lfs -text
gguf/mach-fund-1-Q4_K_M.gguf filter=lfs diff=lfs merge=lfs -text
gguf/mach-fund-1-Q8_0.gguf filter=lfs diff=lfs merge=lfs -text

121
README.md Normal file
View File

@@ -0,0 +1,121 @@
---
license: mit
language:
- zh
base_model:
- Qwen/Qwen2.5-3B-Instruct
pipeline_tag: text-generation
library_name: transformers
tags:
- finance
- chinese
- qlora
- private-equity
- fund-analysis
- distillation
metrics:
- loss
---
# MachFund-1
A specialized Chinese private equity fund analysis model, fine-tuned from [Qwen2.5-3B-Instruct](https://huggingface.co/Qwen/Qwen2.5-3B-Instruct) using QLoRA knowledge distillation.
## Overview
MachFund-1 is trained to analyze Chinese private equity funds across multiple dimensions: performance analysis, risk assessment, strategy evaluation, manager background, fund comparisons, and investment advice. The model demonstrates a **68.75% improvement** over the base model on domain-specific tasks.
## Training Details
| Parameter | Value |
|---|---|
| Base Model | Qwen2.5-3B-Instruct |
| Method | QLoRA (4-bit NF4 quantization) |
| LoRA Rank / Alpha | 32 / 64 |
| Training Samples | 6,976 (eval: 769) |
| Effective Batch Size | 16 (2 x 8 grad accumulation) |
| Learning Rate | 2e-4 (cosine schedule) |
| Epochs | 2 |
| Max Sequence Length | 6,144 tokens |
| Final Training Loss | 0.9269 |
| Training Time | 141 min on NVIDIA A100 80GB |
| Total Steps | 872 |
### Knowledge Distillation Pipeline
1. **Teacher Model**: Gemini 2.5 Pro generates ~50 Q&A pairs per fund across 8 categories for 178 Chinese private equity funds
2. **Quality Scoring**: Gemini 2.5 Flash scores each pair on 5 dimensions (accuracy, completeness, professionalism, data usage, coherence) with a threshold of 15/25
3. **Student Training**: QLoRA fine-tuning on 6,976 high-quality filtered samples
### Question Categories
- Fund overview and basic information
- Performance analysis and benchmarking
- Risk assessment and drawdown analysis
- Strategy analysis and market positioning
- Manager background and track record
- Fund comparisons (peer and category)
- Investment advice and suitability
- Structured data extraction
## Evaluation
| Gate | Metric | Result |
|---|---|---|
| Training Lift | Base vs Fine-tuned Score | **PASS** (4.8 to 8.1, +68.75%, threshold: 30%) |
| Speed (FP16) | Tokens/sec on RTX 5080 | 30.1 tok/s (threshold: 50) |
## Available Formats
| Format | File | Size | Use Case |
|---|---|---|---|
| SafeTensors (FP16) | `model.safetensors` | 6.17 GB | Full precision inference |
| GGUF Q8_0 | `gguf/mach-fund-1-Q8_0.gguf` | 3.29 GB | High-quality quantized inference |
| GGUF Q4_K_M | `gguf/mach-fund-1-Q4_K_M.gguf` | 1.93 GB | Efficient inference, recommended |
| GGUF F16 | `gguf/mach-fund-1-f16.gguf` | 6.18 GB | Full precision GGUF |
## Usage
### Transformers
```python
from transformers import AutoModelForCausalLM, AutoTokenizer
model = AutoModelForCausalLM.from_pretrained("openalchemy/MachFund", torch_dtype="auto", device_map="auto")
tokenizer = AutoTokenizer.from_pretrained("openalchemy/MachFund")
messages = [
{"role": "system", "content": "You are a professional private equity fund analyst."},
{"role": "user", "content": "Analyze the performance of this fund"}
]
text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer(text, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=1024)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
```
### llama.cpp (GGUF)
```bash
./llama-cli -m mach-fund-1-Q4_K_M.gguf -p "Analyze the risk profile of this fund" -n 512
```
### Ollama
```bash
echo 'FROM ./mach-fund-1-Q4_K_M.gguf' > Modelfile
ollama create machfund -f Modelfile
ollama run machfund "What is the Sharpe ratio of this fund?"
```
## Limitations
- Trained specifically on Chinese private equity fund data; may not generalize to other financial domains
- Training data reflects fund information available up to early 2026
- Should not be used as the sole basis for investment decisions
- Speed on consumer GPUs (RTX 5080) is below the 50 tok/s target at FP16; use GGUF Q4_K_M for faster inference
## License
MIT

54
chat_template.jinja Normal file
View File

@@ -0,0 +1,54 @@
{%- if tools %}
{{- '<|im_start|>system\n' }}
{%- if messages[0]['role'] == 'system' %}
{{- messages[0]['content'] }}
{%- else %}
{{- 'You are Qwen, created by Alibaba Cloud. You are a helpful assistant.' }}
{%- endif %}
{{- "\n\n# Tools\n\nYou may call one or more functions to assist with the user query.\n\nYou are provided with function signatures within <tools></tools> XML tags:\n<tools>" }}
{%- for tool in tools %}
{{- "\n" }}
{{- tool | tojson }}
{%- endfor %}
{{- "\n</tools>\n\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\n<tool_call>\n{\"name\": <function-name>, \"arguments\": <args-json-object>}\n</tool_call><|im_end|>\n" }}
{%- else %}
{%- if messages[0]['role'] == 'system' %}
{{- '<|im_start|>system\n' + messages[0]['content'] + '<|im_end|>\n' }}
{%- else %}
{{- '<|im_start|>system\nYou are Qwen, created by Alibaba Cloud. You are a helpful assistant.<|im_end|>\n' }}
{%- endif %}
{%- endif %}
{%- for message in messages %}
{%- if (message.role == "user") or (message.role == "system" and not loop.first) or (message.role == "assistant" and not message.tool_calls) %}
{{- '<|im_start|>' + message.role + '\n' + message.content + '<|im_end|>' + '\n' }}
{%- elif message.role == "assistant" %}
{{- '<|im_start|>' + message.role }}
{%- if message.content %}
{{- '\n' + message.content }}
{%- endif %}
{%- for tool_call in message.tool_calls %}
{%- if tool_call.function is defined %}
{%- set tool_call = tool_call.function %}
{%- endif %}
{{- '\n<tool_call>\n{"name": "' }}
{{- tool_call.name }}
{{- '", "arguments": ' }}
{{- tool_call.arguments | tojson }}
{{- '}\n</tool_call>' }}
{%- endfor %}
{{- '<|im_end|>\n' }}
{%- elif message.role == "tool" %}
{%- if (loop.index0 == 0) or (messages[loop.index0 - 1].role != "tool") %}
{{- '<|im_start|>user' }}
{%- endif %}
{{- '\n<tool_response>\n' }}
{{- message.content }}
{{- '\n</tool_response>' }}
{%- if loop.last or (messages[loop.index0 + 1].role != "tool") %}
{{- '<|im_end|>\n' }}
{%- endif %}
{%- endif %}
{%- endfor %}
{%- if add_generation_prompt %}
{{- '<|im_start|>assistant\n' }}
{%- endif %}

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.3.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.3.0"
}

View File

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

View File

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

View File

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

3
model.safetensors Normal file
View File

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

20
model_card.json Normal file
View File

@@ -0,0 +1,20 @@
{
"model_name": "mach-fund-1",
"base_model": "Qwen/Qwen2.5-3B-Instruct",
"training": {
"train_samples": 6976,
"eval_samples": 769,
"epochs": 2,
"lora_rank": 32,
"batch_size": 2,
"grad_accum": 8,
"max_seq_len": 6144,
"total_steps": 872,
"train_loss": 0.9269,
"train_time_min": 141.0,
"gpu": "NVIDIA A100 80GB PCIe",
"completed_at": "2026-03-21 06:58:25"
},
"merged_at": "2026-03-21 16:13:47",
"description": "Private equity fund analysis model, distilled from Gemini 2.5 Pro"
}

3
tokenizer.json Normal file
View File

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

29
tokenizer_config.json Normal file
View File

@@ -0,0 +1,29 @@
{
"add_prefix_space": false,
"backend": "tokenizers",
"bos_token": null,
"clean_up_tokenization_spaces": false,
"eos_token": "<|im_end|>",
"errors": "replace",
"extra_special_tokens": [
"<|im_start|>",
"<|im_end|>",
"<|object_ref_start|>",
"<|object_ref_end|>",
"<|box_start|>",
"<|box_end|>",
"<|quad_start|>",
"<|quad_end|>",
"<|vision_start|>",
"<|vision_end|>",
"<|vision_pad|>",
"<|image_pad|>",
"<|video_pad|>"
],
"is_local": true,
"model_max_length": 131072,
"pad_token": "<|endoftext|>",
"split_special_tokens": false,
"tokenizer_class": "Qwen2Tokenizer",
"unk_token": null
}