File size: 13,537 Bytes
a04924f 0d89331 a04924f bd92ab7 a04924f |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 |
---
license: apache-2.0
datasets:
- nvidia/OpenCodeReasoning
- vicgalle/creative-rubrics-gpt-4.5-o3-R1
base_model:
- ertghiu256/qwen3-4b-code-reasoning
language:
- en
pipeline_tag: text-generation
tags:
- merge
- programming
- code generation
- code
- coding
- coder
- chat
- code
- chat
- brainstorm
- qwen
- qwen3
- qwencoder
- brainstorm20x
- unsloth
- trl
- sft
- code
- coding
- cot
- reasoning
- thinking
- think
library_name: transformers
---
<h2>Qwen3-Code-Reasoning-Instruct-6B-Brainstorm20x</h2>
This repo contains the full precision source code, in "safe tensors" format to generate GGUFs, GPTQ, EXL2, AWQ, HQQ and other formats.
The source code can also be used directly.
This model contains Brainstorm 20x, combined with ertghiu256's 4B General / Coder (instruct model):
https://huggingface.co/ertghiu256/qwen3-4b-code-reasoning
Information on the 4B model below, followed by Brainstorm 20x adapter (by DavidAU) and then a complete help
section for running LLM / AI models.
The Brainstorm adapter improves code generation, and unique code solving abilities.
This model requires:
- Jinja (embedded) or CHATML template
- Max context of 40k.
Settings used for testing (suggested):
- Temp .3 to .7
- Rep pen 1.05 to 1.1
- Topp .8 , minp .05
- Topk 20
- No system prompt.
FOR CODING:
Higher temps: .6 to .9 (even over 1) work better for more complex coding / especially with more restrictions.
This model will respond well to both detailed instructions and step by step refinement and additions to code.
As this is an instruct model, it will also benefit from a detailed system prompt too.
For simpler coding problems, lower quants will work well; but for complex/multi-step problem solving suggest Q6 or Q8.
---
<B>QUANTS:</b>
---
Special Thanks to Team Mradermacher for the quants:
GGUF:
https://huggingface.co/mradermacher/Qwen3-Code-Reasoning-Instruct-6B-Brainstorm20x-GGUF
GGUF-IMATRIX:
https://huggingface.co/mradermacher/Qwen3-Code-Reasoning-Instruct-6B-Brainstorm20x-i1-GGUF
---
# Qwen 3 Code Reasoning

<small>Generated by reveai.org</small>
A small Qwen 3 4 billion parameter model trained on [nvidia/OpenCodeReasoning](https://huggingface.co/datasets/nvidia/OpenCodeReasoning) for coding tasks.
For Coding, it is recommended to be in thinking mode.
## Recommended parameters:
- Context window : > 10000
- Temperature : 0.7
- Top_p : 60
- Top_k : 0.99
- Min_p : 0.05
## Strengths
- Code generation
- Logical question answering
## Drawbacks
- Heavy overthinking
- Context overflow
## Recommended Usage:
- [vllm](https://github.com/vllm-project/vllm)
- [transformers](https://github.com/QwenLM/Qwen3?tab=readme-ov-file#run-qwen3)
### GGUF VERSION
[Quantized GGUF](https://huggingface.co/ertghiu256/qwen3-4b-code-reasoning-gguf)
## Example Usage :
```
> Write me a snake game in python. Ensure all keybinding (WASD) work properly and all mechanics from the original snake game works. /think
<think>
Okay, I need to write a Snake game in Python where all the keybindings (WASD) work properly and all the original mechanics are included. Let me think about how to approach this.
First, I remember that the classic Snake game works by having a snake move in a direction, grow when it eats food, and die if it hits the wall or itself. The keybindings should allow the snake to change direction using W, A, S, D. But I need to make sure that the movement is smooth and that the snake can't reverse direction immediately, which might cause it to collide with itself right away.
So, the plan is to use the pygame library because it's commonly used for game development in Python. I'll need to initialize the game window, set up the display, handle the game loop, manage the snake's movement, check for collisions, and handle the food.
Let me outline the steps:
Import necessary modules: Pygame, sys, random for generating food, time for delay.
Initialize Pygame: Set up the display, clock, fonts, etc.
Define constants: Screen size, grid size (like 20x20), snake speed, colors.
Create the Snake class: Each segment of the snake. The snake moves in a direction, and each segment follows the previous one.
Create the Food class: Randomly placed on the screen, and when eaten, the snake grows.
Game loop:
Handle events (WASD for direction).
Move the snake.
Check for collisions (walls or self).
Check if food is eaten, then increase length.
Update the display.
Control the game speed with a clock.
Handle keybindings: Make sure that the snake can't reverse direction. So, if the current direction is right, the next can't be left, and so on.
Wait, but in the original Snake game, ...(Too long)
</think>
Here's a complete implementation of the **Snake Game** using the `pygame` library. The game allows the player to control the snake using the **WASD keys**, and the snake moves in the direction of the last key pressed. The game ends when the snake collides with the wall or itself, and the snake grows by one segment each time it eats the food.
---
### โ
Features:
- **WASD Controls**:
- `W` โ Up
- `A` โ Left
- `S` โ Down
- `D` โ Right
- **Food Generation**:
- Randomly placed on a 32ร24 grid (640ร480 pixels).
- **Game Over**:
- Ends when the snake hits the wall or itself.
- **Speed Control**:
- Set with `clock.tick(10)` to control the game speed.
---
### ๐ง How It Works:
1. The snake starts with 3 segments.
2. The player uses `W`, `A`, `S`, `D` to change the direction.
3. The snake moves in the current direction, growing if it eats the food.
4. When the snake collides with the wall or itself, the game ends.
---
### ๐ฆ Code Implementation
```python
import pygame
import sys
import random
# Initialize Pygame
pygame.init()
# Game settings
SCREEN_WIDTH = 640
SCREEN_HEIGHT = 480
BLOCK_SIZE = 20
GRID_WIDTH = SCREEN_WIDTH // BLOCK_SIZE
GRID_HEIGHT = SCREEN_HEIGHT // BLOCK_SIZE
# Colors
BLACK = (0, 0, 0)
GREEN = (0, 255, 0)
RED = (255, 0, 0)
# Initialize screen
screen = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT))
pygame.display.set_caption("Snake Game")
# Clock
clock = pygame.time.Clock()
# Snake
snake_segments = [(3, 3), (2, 3), (1, 3)]
direction = (1, 0) # Start moving right
# Food
def generate_food():
while True:
x = random.randint(0, GRID_WIDTH - 1)
y = random.randint(0, GRID_HEIGHT - 1)
if (x, y) not in snake_segments:
return (x, y)
food = generate_food()
# Game loop
running = True
ate_food = False
while running:
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
elif event.type == pygame.KEYDOWN:
if event.key == pygame.K_w:
direction = (0, -1)
elif event.key == pygame.K_a:
direction = (-1, 0)
elif event.key == pygame.K_s:
direction = (0, 1)
elif event.key == pygame.K_d:
direction = (1, 0)
# Move the snake
new_head = (snake_segments[0][0] + direction[0], snake_segments[0][1] + direction[1])
snake_segments.insert(0, new_head)
if not ate_food:
snake_segments.pop()
ate_food = False
# Check for collisions
if (new_head[0] < 0 or new_head[0] >= GRID_WIDTH or
new_head[1] < 0 or new_head[1] >= GRID_HEIGHT):
pygame.quit()
sys.exit()
if new_head in snake_segments[1:]:
pygame.quit()
sys.exit()
# Check if food is eaten
if new_head == food:
food = generate_food()
ate_food = True
# Draw everything
screen.fill(BLACK)
for segment in snake_segments:
pygame.draw.rect(screen, GREEN, (segment[0] * BLOCK_SIZE, segment[1] * BLOCK_SIZE, BLOCK_SIZE, BLOCK_SIZE))
pygame.draw.rect(screen, RED, (food[0] * BLOCK_SIZE, food[1] * BLOCK_SIZE, BLOCK_SIZE, BLOCK_SIZE))
pygame.display.flip()
# Control the game speed
clock.tick(10)
pygame.quit()
sys.exit()
```โ
---
### ๐งช How to Run:
1. Install `pygame` using pip:
`pip install pygame`
2. Save the code in a file, e.g., `snake_game.py`.
3. Run the file using Python:
`python snake_game.py`
---
### ๐ Tips:
- The game is fast-paced. You can slow it down by increasing the value in `clock.tick(10)` (e.g., `clock.tick(15)`).
- The snake starts in the middle of the screen, and the food is placed randomly.
Enjoy playing the **Snake Game**! ๐๐ฎ
```
See more here:
https://huggingface.co/ertghiu256/qwen3-4b-code-reasoning
---
<H2>What is Brainstorm?</H2>
---
<B>Brainstorm 20x</B>
The BRAINSTORM process was developed by David_AU.
Some of the core principals behind this process are discussed in this <a href="https://arxiv.org/pdf/2401.02415">
scientific paper : Progressive LLaMA with Block Expansion </a>.
However I went in a completely different direction from what was outlined in this paper.
What is "Brainstorm" ?
The reasoning center of an LLM is taken apart, reassembled, and expanded.
In this case for this model: 20 times
Then these centers are individually calibrated. These "centers" also interact with each other.
This introduces subtle changes into the reasoning process.
The calibrations further adjust - dial up or down - these "changes" further.
The number of centers (5x,10x etc) allow more "tuning points" to further customize how the model reasons so to speak.
The core aim of this process is to increase the model's detail, concept and connection to the "world",
general concept connections, prose quality and prose length without affecting instruction following.
This will also enhance any creative use case(s) of any kind, including "brainstorming", creative art form(s) and like case uses.
Here are some of the enhancements this process brings to the model's performance:
- Prose generation seems more focused on the moment to moment.
- Sometimes there will be "preamble" and/or foreshadowing present.
- Fewer or no "cliches"
- Better overall prose and/or more complex / nuanced prose.
- A greater sense of nuance on all levels.
- Coherence is stronger.
- Description is more detailed, and connected closer to the content.
- Simile and Metaphors are stronger and better connected to the prose, story, and character.
- Sense of "there" / in the moment is enhanced.
- Details are more vivid, and there are more of them.
- Prose generation length can be long to extreme.
- Emotional engagement is stronger.
- The model will take FEWER liberties vs a normal model: It will follow directives more closely but will "guess" less.
- The MORE instructions and/or details you provide the more strongly the model will respond.
- Depending on the model "voice" may be more "human" vs original model's "voice".
Other "lab" observations:
- This process does not, in my opinion, make the model 5x or 10x "smarter" - if only that was true!
- However, a change in "IQ" was not an issue / a priority, and was not tested or calibrated for so to speak.
- From lab testing it seems to ponder, and consider more carefully roughly speaking.
- You could say this process sharpens the model's focus on it's task(s) at a deeper level.
The process to modify the model occurs at the root level - source files level. The model can quanted as a GGUF, EXL2, AWQ etc etc.
---
For more information / other Qwen/Mistral Coders / additional settings see:
[ https://huggingface.co/DavidAU/Qwen2.5-MOE-2x-4x-6x-8x__7B__Power-CODER__19B-30B-42B-53B-gguf ]
---
<H2>Help, Adjustments, Samplers, Parameters and More</H2>
---
<B>CHANGE THE NUMBER OF ACTIVE EXPERTS:</B>
See this document:
https://huggingface.co/DavidAU/How-To-Set-and-Manage-MOE-Mix-of-Experts-Model-Activation-of-Experts
<B>Settings: CHAT / ROLEPLAY and/or SMOOTHER operation of this model:</B>
In "KoboldCpp" or "oobabooga/text-generation-webui" or "Silly Tavern" ;
Set the "Smoothing_factor" to 1.5
: in KoboldCpp -> Settings->Samplers->Advanced-> "Smooth_F"
: in text-generation-webui -> parameters -> lower right.
: In Silly Tavern this is called: "Smoothing"
NOTE: For "text-generation-webui"
-> if using GGUFs you need to use "llama_HF" (which involves downloading some config files from the SOURCE version of this model)
Source versions (and config files) of my models are here:
https://huggingface.co/collections/DavidAU/d-au-source-files-for-gguf-exl2-awq-gptq-hqq-etc-etc-66b55cb8ba25f914cbf210be
OTHER OPTIONS:
- Increase rep pen to 1.1 to 1.15 (you don't need to do this if you use "smoothing_factor")
- If the interface/program you are using to run AI MODELS supports "Quadratic Sampling" ("smoothing") just make the adjustment as noted.
<B>Highest Quality Settings / Optimal Operation Guide / Parameters and Samplers</B>
This a "Class 1" model:
For all settings used for this model (including specifics for its "class"), including example generation(s) and for advanced settings guide (which many times addresses any model issue(s)), including methods to improve model performance for all use case(s) as well as chat, roleplay and other use case(s) please see:
[ https://huggingface.co/DavidAU/Maximizing-Model-Performance-All-Quants-Types-And-Full-Precision-by-Samplers_Parameters ]
You can see all parameters used for generation, in addition to advanced parameters and samplers to get the most out of this model here:
[ https://huggingface.co/DavidAU/Maximizing-Model-Performance-All-Quants-Types-And-Full-Precision-by-Samplers_Parameters ] |