Text Generation
Transformers
Safetensors
GGUF
Chinese
qwen2
finance
chinese
qlora
private-equity
fund-analysis
distillation
conversational
text-generation-inference
Instructions to use openalchemy/MachFund with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use openalchemy/MachFund with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="openalchemy/MachFund") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("openalchemy/MachFund") model = AutoModelForCausalLM.from_pretrained("openalchemy/MachFund", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use openalchemy/MachFund with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf openalchemy/MachFund:Q4_K_M # Run inference directly in the terminal: llama cli -hf openalchemy/MachFund:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf openalchemy/MachFund:Q4_K_M # Run inference directly in the terminal: llama cli -hf openalchemy/MachFund:Q4_K_M
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf openalchemy/MachFund:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf openalchemy/MachFund:Q4_K_M
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf openalchemy/MachFund:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf openalchemy/MachFund:Q4_K_M
Use Docker
docker model run hf.co/openalchemy/MachFund:Q4_K_M
- Llama new
- LM Studio
- Jan
- vLLM
How to use openalchemy/MachFund with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "openalchemy/MachFund" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "openalchemy/MachFund", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/openalchemy/MachFund:Q4_K_M
- SGLang
How to use openalchemy/MachFund with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "openalchemy/MachFund" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "openalchemy/MachFund", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "openalchemy/MachFund" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "openalchemy/MachFund", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use openalchemy/MachFund with Ollama:
ollama run hf.co/openalchemy/MachFund:Q4_K_M
- Unsloth Desktop
- Pi
How to use openalchemy/MachFund with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf openalchemy/MachFund:Q4_K_M
Configure the model in Pi
# Install Pi: npm install -g @earendil-works/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "openalchemy/MachFund:Q4_K_M" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Docker Model Runner
How to use openalchemy/MachFund with Docker Model Runner:
docker model run hf.co/openalchemy/MachFund:Q4_K_M
- Lemonade
How to use openalchemy/MachFund with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull openalchemy/MachFund:Q4_K_M
Run and chat with the model
lemonade run user.MachFund-Q4_K_M
List all available models
lemonade list
- Hermes Agent
How to use openalchemy/MachFund with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf openalchemy/MachFund:Q4_K_M
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default openalchemy/MachFund:Q4_K_M
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use openalchemy/MachFund with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf openalchemy/MachFund:Q4_K_M
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:8080/v1 \ --custom-model-id "openalchemy/MachFund:Q4_K_M" \ --custom-provider-id llama-cpp \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
|
Download README.md from openalchemy/MachFund: direct link, hf CLI and curl.
- Browser
- Download file 4.12 kB
-
https://huggingface.co/openalchemy/MachFund/resolve/main/README.md
- Command line
-
hf download hf://openalchemy/MachFund/README.md
-
curl -L -o README.md https://huggingface.co/openalchemy/MachFund/resolve/main/README.md
4.12 kB
| 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 | |