Soloman2002 commited on
Commit
3613942
·
verified ·
1 Parent(s): 8f1249d

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +173 -25
README.md CHANGED
@@ -2,56 +2,204 @@
2
  language: en
3
  license: apache-2.0
4
  tags:
5
- - code
6
- - coding-agent
7
- - instruction-tuned
8
- - hermit-code
9
  pipeline_tag: text-generation
10
- base_model:
11
- - Qwen/Qwen2.5-Coder-7B-Instruct
12
  ---
13
 
14
- # Hermit Code 7B
 
 
 
 
 
 
15
 
16
- **Hermit Code** is the official coding model for the [Hermit AI Agent](https://github.com/Soloman2002/hermit-agent).
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
 
18
  ## Model Details
19
 
20
  | Property | Value |
21
  |---|---|
22
  | **Base Model** | [Qwen/Qwen2.5-Coder-7B-Instruct](https://huggingface.co/Qwen/Qwen2.5-Coder-7B-Instruct) |
23
- | **Architecture** | Qwen2.5 (Dense Transformer) |
24
- | **Parameters** | 7.6B |
25
- | **Context Length** | 128K tokens |
 
 
26
  | **License** | Apache 2.0 |
27
- | **Format** | Safetensors |
28
 
29
- ## Capabilities
30
 
31
- - Python, JavaScript, TypeScript, Go, Rust, C++, Java code generation
32
- - Code explanation and documentation
33
- - Bug fixing and debugging
34
- - Refactoring and optimization
35
- - Multi-file project understanding
36
 
37
- ## Usage
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38
 
39
- ### Via Hugging Face Inference API
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
 
41
  ```python
42
  from huggingface_hub import InferenceClient
43
 
44
  client = InferenceClient(token="hf_YOUR_TOKEN")
45
-
46
  response = client.text_generation(
47
  model="Soloman2002/hermit-code-7b",
48
- prompt="<|im_start|>user\nWrite a Python function to sort a list<|im_end>\n<|im_start>assistant\n",
49
  max_new_tokens=512,
50
  temperature=0.2
51
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
52
 
53
  ## Acknowledgments
54
 
55
- Original model: [Qwen team](https://huggingface.co/Qwen)
56
- Hermit AI Agent: Built by the Hermit team
57
- ```
 
 
 
 
 
 
2
  language: en
3
  license: apache-2.0
4
  tags:
5
+ - code
6
+ - coding-agent
7
+ - instruction-tuned
8
+ - hermit-code
9
  pipeline_tag: text-generation
 
 
10
  ---
11
 
12
+ <p align="center">
13
+ <img src="https://img.shields.io/badge/Parameters-7.6B-blue?style=flat-square" alt="Parameters"/>
14
+ <img src="https://img.shields.io/badge/Context-128K-green?style=flat-square" alt="Context"/>
15
+ <img src="https://img.shields.io/badge/License-Apache%202.0-yellow?style=flat-square" alt="License"/>
16
+ <img src="https://img.shields.io/badge/Format-Safetensors-orange?style=flat-square" alt="Format"/>
17
+ <img src="https://img.shields.io/badge/Python-3.10%2B-blue?style=flat-square" alt="Python"/>
18
+ </p>
19
 
20
+ <h1 align="center">Hermit Code 7B</h1>
21
+ <p align="center"><em>The official coding model for the Hermit AI Agent</em></p>
22
+
23
+ <p align="center">
24
+ <a href="#-quick-start">Quick Start</a> •
25
+ <a href="#-capabilities">Capabilities</a> •
26
+ <a href="#-model-details">Model Details</a> •
27
+ <a href="#-usage">Usage</a> •
28
+ <a href="#-examples">Examples</a> •
29
+ <a href="#-acknowledgments">Acknowledgments</a>
30
+ </p>
31
+
32
+ ---
33
+
34
+ ## Quick Start
35
+
36
+ ```python
37
+ from transformers import pipeline
38
+
39
+ pipe = pipeline("text-generation", model="Soloman2002/hermit-code-7b")
40
+ chat = [
41
+ {"role": "user", "content": "Write a Python function to reverse a linked list"}
42
+ ]
43
+ pipe(chat, max_new_tokens=512)
44
+ ```
45
+
46
+ ## Capabilities
47
+
48
+ | Category | Languages / Skills |
49
+ |---|---|
50
+ | **Languages** | Python, JavaScript/TypeScript, Go, Rust, C++, Java |
51
+ | **Code Gen** | Functions, classes, scripts, full projects |
52
+ | **Explain** | Code breakdowns, documentation generation |
53
+ | **Debug** | Bug finding, fixing, optimization |
54
+ | **Refactor** | Performance tuning, code cleanup |
55
+ | **Context** | Multi-file project understanding (128K tokens) |
56
 
57
  ## Model Details
58
 
59
  | Property | Value |
60
  |---|---|
61
  | **Base Model** | [Qwen/Qwen2.5-Coder-7B-Instruct](https://huggingface.co/Qwen/Qwen2.5-Coder-7B-Instruct) |
62
+ | **Architecture** | Qwen2.5 Dense Transformer |
63
+ | **Parameters** | 7.61B (6.53B non-embedding) |
64
+ | **Layers** | 28 |
65
+ | **Attention** | GQA (28 Q heads, 4 KV heads) |
66
+ | **Context Length** | 131,072 tokens |
67
  | **License** | Apache 2.0 |
68
+ | **Format** | Safetensors (BF16) |
69
 
70
+ ## Usage
71
 
72
+ ### Transformers
 
 
 
 
73
 
74
+ ```python
75
+ from transformers import AutoModelForCausalLM, AutoTokenizer
76
+
77
+ model = AutoModelForCausalLM.from_pretrained(
78
+ "Soloman2002/hermit-code-7b",
79
+ torch_dtype="auto",
80
+ device_map="auto"
81
+ )
82
+ tokenizer = AutoTokenizer.from_pretrained("Soloman2002/hermit-code-7b")
83
+
84
+ messages = [
85
+ {"role": "system", "content": "You are Hermit Code, a coding assistant."},
86
+ {"role": "user", "content": "Write a Rust function that checks if a string is a palindrome."}
87
+ ]
88
+ text = tokenizer.apply_chat_template(
89
+ messages, tokenize=False, add_generation_prompt=True
90
+ )
91
+ inputs = tokenizer([text], return_tensors="pt").to(model.device)
92
+ outputs = model.generate(**inputs, max_new_tokens=512)
93
+ response = tokenizer.decode(outputs[0][inputs.input_ids.shape[1]:], skip_special_tokens=True)
94
+ print(response)
95
+ ```
96
 
97
+ ### vLLM (Recommended for Production)
98
+
99
+ ```bash
100
+ pip install vllm
101
+ vllm serve "Soloman2002/hermit-code-7b"
102
+ ```
103
+
104
+ ```bash
105
+ curl -X POST "http://localhost:8000/v1/chat/completions" \
106
+ -H "Content-Type: application/json" \
107
+ -d '{
108
+ "model": "Soloman2002/hermit-code-7b",
109
+ "messages": [
110
+ {"role": "user", "content": "Explain closures in JavaScript"}
111
+ ]
112
+ }'
113
+ ```
114
+
115
+ ### Inference API
116
 
117
  ```python
118
  from huggingface_hub import InferenceClient
119
 
120
  client = InferenceClient(token="hf_YOUR_TOKEN")
 
121
  response = client.text_generation(
122
  model="Soloman2002/hermit-code-7b",
123
+ prompt="<|im_start|>user\nWrite a Go function to merge two sorted arrays<|im_end|>\n<|im_start|>assistant\n",
124
  max_new_tokens=512,
125
  temperature=0.2
126
  )
127
+ ```
128
+
129
+ ## Examples
130
+
131
+ <details>
132
+ <summary><b>Python</b> — Quick Sort</summary>
133
+
134
+ ```python
135
+ def quick_sort(arr):
136
+ if len(arr) <= 1:
137
+ return arr
138
+ pivot = arr[len(arr) // 2]
139
+ left = [x for x in arr if x < pivot]
140
+ middle = [x for x in arr if x == pivot]
141
+ right = [x for x in arr if x > pivot]
142
+ return quick_sort(left) + middle + quick_sort(right)
143
+ ```
144
+ </details>
145
+
146
+ <details>
147
+ <summary><b>Rust</b> — Palindrome Check</summary>
148
+
149
+ ```rust
150
+ fn is_palindrome(s: &str) -> bool {
151
+ let chars: Vec<char> = s.chars().filter(|c| c.is_alphanumeric()).collect();
152
+ let len = chars.len();
153
+ for i in 0..len / 2 {
154
+ if chars[i].to_ascii_lowercase() != chars[len - 1 - i].to_ascii_lowercase() {
155
+ return false;
156
+ }
157
+ }
158
+ true
159
+ }
160
+ ```
161
+ </details>
162
+
163
+ <details>
164
+ <summary><b>Go</b> — Merge Sorted Arrays</summary>
165
+
166
+ ```go
167
+ func mergeSorted(a, b []int) []int {
168
+ result := make([]int, 0, len(a)+len(b))
169
+ i, j := 0, 0
170
+ for i < len(a) && j < len(b) {
171
+ if a[i] < b[j] {
172
+ result = append(result, a[i])
173
+ i++
174
+ } else {
175
+ result = append(result, b[j])
176
+ j++
177
+ }
178
+ }
179
+ result = append(result, a[i:]...)
180
+ result = append(result, b[j:]...)
181
+ return result
182
+ }
183
+ ```
184
+ </details>
185
+
186
+ ## Benchmarks
187
+
188
+ | Benchmark | Score |
189
+ |---|---|
190
+ | HumanEval (Python) | TBD |
191
+ | HumanEval (Multi-Lang) | TBD |
192
+ | MBPP | TBD |
193
+
194
+ *Coming soon — based on Qwen2.5-Coder-7B-Instruct baseline.*
195
 
196
  ## Acknowledgments
197
 
198
+ - **Base Model** — [Qwen Team](https://huggingface.co/Qwen) for [Qwen2.5-Coder-7B-Instruct](https://huggingface.co/Qwen/Qwen2.5-Coder-7B-Instruct)
199
+ - **Hermit AI Agent** Built by the [Hermit Team](https://github.com/Soloman2002)
200
+
201
+ ---
202
+
203
+ <p align="center">
204
+ <sub>Built with ❤️ for the coding community</sub>
205
+ </p>