SixpertAI commited on
Commit
d5711b0
·
verified ·
1 Parent(s): 7c2a116

Upload docs/usage_guide.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. docs/usage_guide.md +166 -0
docs/usage_guide.md ADDED
@@ -0,0 +1,166 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Sixpert K1 - Complete Usage Guide
2
+
3
+ ## Quick Start
4
+
5
+ ### Option 1: Ollama (Easiest)
6
+
7
+ ```bash
8
+ # Install Ollama
9
+ curl -fsSL https://ollama.com/install.sh | sh
10
+
11
+ # Download and import the model
12
+ ollama create sixpert-k1 -f OllamaModelfile
13
+
14
+ # Or if GGUF is in Ollama library:
15
+ # ollama run sixpert-k1
16
+
17
+ # Chat
18
+ ollama run sixpert-k1
19
+ ```
20
+
21
+ ### Option 2: llama-cpp-python (Python)
22
+
23
+ ```bash
24
+ pip install llama-cpp-python
25
+ python examples/generate.py --prompt "Hello, who are you?"
26
+ ```
27
+
28
+ ### Option 3: API Server
29
+
30
+ ```bash
31
+ pip install llama-cpp-python
32
+ python examples/api_server.py --model SixpertK1.gguf
33
+ ```
34
+
35
+ ### Option 4: LM Studio
36
+
37
+ 1. Download LM Studio from https://lmstudio.ai
38
+ 2. Import `SixpertK1.gguf`
39
+ 3. Start chatting with the Sixpert K1 preset
40
+
41
+ ## Chat Format
42
+
43
+ Sixpert K1 uses the following chat template:
44
+
45
+ ```
46
+ <|im_start|>system
47
+ You are a helpful assistant.<|im_end|>
48
+ <|im_start|>user
49
+ What is quantum computing?<|im_end|>
50
+ <|im_start|>assistant
51
+ Quantum computing uses quantum mechanical phenomena...<|im_end|>
52
+ ```
53
+
54
+ ## Recommended Settings
55
+
56
+ | Parameter | Value | Notes |
57
+ |---|---|---|
58
+ | temperature | 0.7 | Good balance of creativity and accuracy |
59
+ | top_p | 0.8 | Nucleus sampling |
60
+ | top_k | 40 | Limit token selection |
61
+ | repeat_penalty | 1.05 | Prevent repetition |
62
+ | max_tokens | 8192 | Max output length |
63
+ | context_size | 131072 | Full context window |
64
+
65
+ ## Function Calling
66
+
67
+ Sixpert K1 supports native function calling. See `examples/function_calling.py` for a complete implementation.
68
+
69
+ ### Tool Format
70
+
71
+ ```json
72
+ {
73
+ "type": "function",
74
+ "function": {
75
+ "name": "search",
76
+ "description": "Search for information",
77
+ "parameters": {
78
+ "type": "object",
79
+ "properties": {
80
+ "query": {"type": "string"}
81
+ },
82
+ "required": ["query"]
83
+ }
84
+ }
85
+ }
86
+ ```
87
+
88
+ ## Vision / Multimodal
89
+
90
+ Sixpert K1 can understand images. See `examples/vision_example.py` for implementation details.
91
+
92
+ ```python
93
+ response = llm.create_chat_completion(
94
+ messages=[{
95
+ "role": "user",
96
+ "content": [
97
+ {"type": "text", "text": "Describe this image"},
98
+ {"type": "image_url", "image_url": {"url": "data:image/png;base64,..."}},
99
+ ]
100
+ }]
101
+ )
102
+ ```
103
+
104
+ ## Integration Examples
105
+
106
+ ### OpenAI-Compatible Client
107
+
108
+ ```python
109
+ from openai import OpenAI
110
+
111
+ client = OpenAI(base_url="http://localhost:8000/v1", api_key="not-needed")
112
+
113
+ response = client.chat.completions.create(
114
+ model="sixpert-k1",
115
+ messages=[{"role": "user", "content": "Explain recursion"}],
116
+ temperature=0.7,
117
+ )
118
+ print(response.choices[0].message.content)
119
+ ```
120
+
121
+ ### LangChain Integration
122
+
123
+ ```python
124
+ from langchain.llms import LlamaCpp
125
+
126
+ llm = LlamaCpp(
127
+ model_path="SixpertK1.gguf",
128
+ temperature=0.7,
129
+ n_ctx=131072,
130
+ n_gpu_layers=-1,
131
+ )
132
+
133
+ result = llm.invoke("What is machine learning?")
134
+ print(result)
135
+ ```
136
+
137
+ ### CrewAI Agent
138
+
139
+ ```python
140
+ from crewai import Agent, Task, Crew
141
+
142
+ agent = Agent(
143
+ role="Research Analyst",
144
+ backstory="You are Sixpert K1, a precision logic engine",
145
+ goal="Provide accurate, detailed analysis",
146
+ llm=LlamaCpp(model_path="SixpertK1.gguf", temperature=0.7),
147
+ allow_delegation=False,
148
+ )
149
+ ```
150
+
151
+ ## Performance Tips
152
+
153
+ 1. **GPU Offloading**: Set `n_gpu_layers=-1` to offload all layers to GPU
154
+ 2. **Context Pruning**: Use smaller context windows (8192-32768) for faster inference
155
+ 3. **Batch Processing**: Use the API server for batch inference
156
+ 4. **Quantization**: Q4_K_M is the sweet spot; upgrade to Q6_K if quality matters more
157
+
158
+ ## Troubleshooting
159
+
160
+ | Issue | Solution |
161
+ |---|---|
162
+ | Out of memory | Reduce context size or use CPU-only inference |
163
+ | Slow generation | Enable GPU offloading (`n_gpu_layers=-1`) |
164
+ | Repetitive output | Increase `repeat_penalty` to 1.1-1.2 |
165
+ | Hallucinations | Lower temperature to 0.3-0.5 |
166
+ | Context overflow | Use 4096 context for testing, 131072 for production |