Instructions to use ertghiu256/qwen3-4b-code-reasoning-gguf with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- llama-cpp-python
How to use ertghiu256/qwen3-4b-code-reasoning-gguf with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="ertghiu256/qwen3-4b-code-reasoning-gguf", filename="unsloth.F16.gguf", )
llm.create_chat_completion( messages = [ { "role": "user", "content": "What is the capital of France?" } ] ) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- llama.cpp
How to use ertghiu256/qwen3-4b-code-reasoning-gguf with llama.cpp:
Install from brew
brew install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf ertghiu256/qwen3-4b-code-reasoning-gguf:Q4_K_M # Run inference directly in the terminal: llama-cli -hf ertghiu256/qwen3-4b-code-reasoning-gguf:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf ertghiu256/qwen3-4b-code-reasoning-gguf:Q4_K_M # Run inference directly in the terminal: llama-cli -hf ertghiu256/qwen3-4b-code-reasoning-gguf: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 ertghiu256/qwen3-4b-code-reasoning-gguf:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf ertghiu256/qwen3-4b-code-reasoning-gguf: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 ertghiu256/qwen3-4b-code-reasoning-gguf:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf ertghiu256/qwen3-4b-code-reasoning-gguf:Q4_K_M
Use Docker
docker model run hf.co/ertghiu256/qwen3-4b-code-reasoning-gguf:Q4_K_M
- LM Studio
- Jan
- vLLM
How to use ertghiu256/qwen3-4b-code-reasoning-gguf with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ertghiu256/qwen3-4b-code-reasoning-gguf" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ertghiu256/qwen3-4b-code-reasoning-gguf", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/ertghiu256/qwen3-4b-code-reasoning-gguf:Q4_K_M
- Ollama
How to use ertghiu256/qwen3-4b-code-reasoning-gguf with Ollama:
ollama run hf.co/ertghiu256/qwen3-4b-code-reasoning-gguf:Q4_K_M
- Unsloth Studio new
How to use ertghiu256/qwen3-4b-code-reasoning-gguf with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for ertghiu256/qwen3-4b-code-reasoning-gguf to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for ertghiu256/qwen3-4b-code-reasoning-gguf to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for ertghiu256/qwen3-4b-code-reasoning-gguf to start chatting
- Pi new
How to use ertghiu256/qwen3-4b-code-reasoning-gguf with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama-server -hf ertghiu256/qwen3-4b-code-reasoning-gguf:Q4_K_M
Configure the model in Pi
# Install Pi: npm install -g @mariozechner/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "ertghiu256/qwen3-4b-code-reasoning-gguf:Q4_K_M" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent new
How to use ertghiu256/qwen3-4b-code-reasoning-gguf with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama-server -hf ertghiu256/qwen3-4b-code-reasoning-gguf: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 ertghiu256/qwen3-4b-code-reasoning-gguf:Q4_K_M
Run Hermes
hermes
- Docker Model Runner
How to use ertghiu256/qwen3-4b-code-reasoning-gguf with Docker Model Runner:
docker model run hf.co/ertghiu256/qwen3-4b-code-reasoning-gguf:Q4_K_M
- Lemonade
How to use ertghiu256/qwen3-4b-code-reasoning-gguf with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull ertghiu256/qwen3-4b-code-reasoning-gguf:Q4_K_M
Run and chat with the model
lemonade run user.qwen3-4b-code-reasoning-gguf-Q4_K_M
List all available models
lemonade list
Qwen 3 Code Reasoning
A small Qwen 3 4 billion parameter model trained on 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
- Overthinking
- Context Overflow
Recommended Usage:
SAFETENSOR VERSION
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**! 🐍🎮
- Downloads last month
- 111
4-bit
8-bit
16-bit
