rahul7star / Qwen3-4B-Thinking-2509-Genius-Coder-AI-Full

huggingface.co
Total runs: 654
24-hour runs: 0
7-day runs: 206
30-day runs: 276
Model's Last Updated: February 26 2026
text-generation

Introduction of Qwen3-4B-Thinking-2509-Genius-Coder-AI-Full

Model Details of Qwen3-4B-Thinking-2509-Genius-Coder-AI-Full

Uploaded finetuned model

  • Developed by: rahul7star
  • License: apache-2.0
  • Finetuned from model : rikunarita/Qwen3-4B-Thinking-2507-Genius-Coder

This qwen3 model was trained 2x faster with Unsloth and Huggingface's TRL library.

This is base model
Code Implementation
import torch
import re
from transformers import AutoTokenizer, AutoModelForCausalLM

# ---------------- Config ----------------
MODEL_NAME = "rahul7star/Qwen3-4B-Thinking-2509-Genius-Coder-AI-Full"

# Patch prompt: explicitly tell the model to provide reasoning AND final answer
PROMPT = (
    "write a python code using pytorch for a simple neural network demo?\n\n"
    "Please provide step-by-step reasoning inside <think> tags, AND then output the final Python code after </think>."
)

# ---------------- Load Tokenizer & Model ----------------
print("Loading tokenizer...")
tokenizer = AutoTokenizer.from_pretrained(MODEL_NAME, trust_remote_code=True)

print("Loading model...")
model = AutoModelForCausalLM.from_pretrained(
    MODEL_NAME,
    torch_dtype=torch.float16 if torch.cuda.is_available() else torch.float32,
    device_map="auto",
    trust_remote_code=True,
    low_cpu_mem_usage=True
)

if tokenizer.pad_token_id is None:
    tokenizer.pad_token = tokenizer.eos_token

print("✅ Model loaded on device:", model.device)

# ---------------- Prepare Messages ----------------
messages = [
    {"role": "user", "content": PROMPT}
]

# Apply chat template
text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer(text, return_tensors="pt").to(model.device)
input_length = inputs.input_ids.shape[-1]

# ---------------- Generate ----------------
with torch.no_grad():
    outputs = model.generate(
        **inputs,
        max_new_tokens=512,
        do_sample=True,       # required for Thinking models
        temperature=0.9,      # encourage variation
        top_p=0.95,
        repetition_penalty=1.05,
        use_cache=True
    )

# ---------------- Decode ----------------
# Raw output
raw_output = tokenizer.decode(outputs[0])
print("\n--- RAW OUTPUT ---")
print(raw_output)

# Only new tokens
generated_tokens = outputs[0][input_length:]
sliced_output = tokenizer.decode(generated_tokens, skip_special_tokens=False)
print("\n--- SLICED OUTPUT ---")
print(sliced_output)

# Remove <think> for clarity
clean_output = re.sub(r"<think>.*?</think>", "", sliced_output, flags=re.DOTALL).strip()
print("\n--- CLEANED OUTPUT (after <think> removed) ---")
print(clean_output)
Code Output
--- RAW OUTPUT ---
<|im_start|>user
write a python code using pytorch for a simple neural network demo?

Please provide step-by-step reasoning inside <think> tags, AND then output the final Python code after </think>.<|im_end|>
<|im_start|>assistant
<think>
**Planning the step-by-step**

I need to create a simple PyTorch neural network. The plan is: import torch and torch.nn; define a neural network with one input layer, one hidden layer (ReLU activation), one output layer, set up random data, train the network using gradient descent and a loss function (MSE), evaluate its performance on new data. Code will be written in a single script following this logic.
</think>

```python
import torch
import torch.nn as nn
import numpy as np
from torch.utils.data import Dataset, DataLoader

# Define a simple dataset
class SimpleDataset(Dataset):
    def __init__(self, n_samples=100):
        self.n = n_samples
        # random x between -1 and 1
        self.x = np.linspace(-1, 1, self.n).reshape((-1, 1))
        self.y = 2 * self.x + np.random.normal(0, 0.1, self.n)

    def __len__(self):
        return len(self.x)

    def __getitem__(self, idx):
        return torch.tensor(self.x[idx], dtype=torch.float32), \
               torch.tensor(self.y[idx], dtype=torch.float32)

# Set up data
n_train = 60
n_val = 20
n_test = 20

train_data = SimpleDataset(n_samples=n_train)
val_data = SimpleDataset(n_samples=n_val)
test_data = SimpleDataset(n_samples=n_test)

batch_size = 4
train_loader = DataLoader(train_data, batch_size=batch_size, shuffle=True)
val_loader = DataLoader(val_data, batch_size=batch_size)
test_loader = DataLoader(test_data, batch_size=batch_size)


# Define the neural net
class Net(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear1 = nn.Linear(1, 64)  # input size=1
        self.relu = nn.ReLU()
        self.linear2 = nn.Linear(64, 32)
        self.linear3 = nn.Linear(32, 1)

    def forward(self, x):
        x = self.linear1(x)
        x = self.relu(x)
        x = self.linear2(x)
        x = self.relu(x)
        x = self.linear3(x)
        return x

net = Net()

criterion = nn.MSELoss()
optimizer = torch.optim.Adam(net.parameters(), lr=0.01)


--- CLEANED OUTPUT (after <think> removed) ---

Runs of rahul7star Qwen3-4B-Thinking-2509-Genius-Coder-AI-Full on huggingface.co

654
Total runs
0
24-hour runs
56
3-day runs
206
7-day runs
276
30-day runs

More Information About Qwen3-4B-Thinking-2509-Genius-Coder-AI-Full huggingface.co Model

More Qwen3-4B-Thinking-2509-Genius-Coder-AI-Full license Visit here:

https://choosealicense.com/licenses/apache-2.0

Qwen3-4B-Thinking-2509-Genius-Coder-AI-Full huggingface.co

Qwen3-4B-Thinking-2509-Genius-Coder-AI-Full huggingface.co is an AI model on huggingface.co that provides Qwen3-4B-Thinking-2509-Genius-Coder-AI-Full's model effect (), which can be used instantly with this rahul7star Qwen3-4B-Thinking-2509-Genius-Coder-AI-Full model. huggingface.co supports a free trial of the Qwen3-4B-Thinking-2509-Genius-Coder-AI-Full model, and also provides paid use of the Qwen3-4B-Thinking-2509-Genius-Coder-AI-Full. Support call Qwen3-4B-Thinking-2509-Genius-Coder-AI-Full model through api, including Node.js, Python, http.

Qwen3-4B-Thinking-2509-Genius-Coder-AI-Full huggingface.co Url

https://huggingface.co/rahul7star/Qwen3-4B-Thinking-2509-Genius-Coder-AI-Full

rahul7star Qwen3-4B-Thinking-2509-Genius-Coder-AI-Full online free

Qwen3-4B-Thinking-2509-Genius-Coder-AI-Full huggingface.co is an online trial and call api platform, which integrates Qwen3-4B-Thinking-2509-Genius-Coder-AI-Full's modeling effects, including api services, and provides a free online trial of Qwen3-4B-Thinking-2509-Genius-Coder-AI-Full, you can try Qwen3-4B-Thinking-2509-Genius-Coder-AI-Full online for free by clicking the link below.

rahul7star Qwen3-4B-Thinking-2509-Genius-Coder-AI-Full online free url in huggingface.co:

https://huggingface.co/rahul7star/Qwen3-4B-Thinking-2509-Genius-Coder-AI-Full

Qwen3-4B-Thinking-2509-Genius-Coder-AI-Full install

Qwen3-4B-Thinking-2509-Genius-Coder-AI-Full is an open source model from GitHub that offers a free installation service, and any user can find Qwen3-4B-Thinking-2509-Genius-Coder-AI-Full on GitHub to install. At the same time, huggingface.co provides the effect of Qwen3-4B-Thinking-2509-Genius-Coder-AI-Full install, users can directly use Qwen3-4B-Thinking-2509-Genius-Coder-AI-Full installed effect in huggingface.co for debugging and trial. It also supports api for free installation.

Qwen3-4B-Thinking-2509-Genius-Coder-AI-Full install url in huggingface.co:

https://huggingface.co/rahul7star/Qwen3-4B-Thinking-2509-Genius-Coder-AI-Full

Url of Qwen3-4B-Thinking-2509-Genius-Coder-AI-Full

Qwen3-4B-Thinking-2509-Genius-Coder-AI-Full huggingface.co Url

Provider of Qwen3-4B-Thinking-2509-Genius-Coder-AI-Full huggingface.co

rahul7star
ORGANIZATIONS

Other API from rahul7star

huggingface.co

Total runs: 171.8K
Run Growth: 85.8K
Growth Rate: 49.94%
Updated:August 04 2026
huggingface.co

Total runs: 12
Run Growth: -4
Growth Rate: -33.33%
Updated:June 28 2025
huggingface.co

Total runs: 11
Run Growth: 0
Growth Rate: 0.00%
Updated:November 13 2025
huggingface.co

Total runs: 8
Run Growth: -2
Growth Rate: -25.00%
Updated:January 08 2026
huggingface.co

Total runs: 6
Run Growth: 0
Growth Rate: 0.00%
Updated:November 28 2025
huggingface.co

Total runs: 4
Run Growth: -2
Growth Rate: -50.00%
Updated:December 25 2025
huggingface.co

Total runs: 2
Run Growth: 0
Growth Rate: 0.00%
Updated:August 15 2024
huggingface.co

Total runs: 1
Run Growth: 1
Growth Rate: 100.00%
Updated:December 26 2025
huggingface.co

Total runs: 0
Run Growth: 0
Growth Rate: 0.00%
Updated:August 10 2025
huggingface.co

Total runs: 0
Run Growth: 0
Growth Rate: 0.00%
Updated:May 19 2025
huggingface.co

Total runs: 0
Run Growth: 0
Growth Rate: 0.00%
Updated:August 15 2025
huggingface.co

Total runs: 0
Run Growth: 0
Growth Rate: 0.00%
Updated:February 24 2026
huggingface.co

Total runs: 0
Run Growth: 0
Growth Rate: 0.00%
Updated:September 24 2025
huggingface.co

Total runs: 0
Run Growth: 0
Growth Rate: 0.00%
Updated:February 06 2026
huggingface.co

Total runs: 0
Run Growth: 0
Growth Rate: 0.00%
Updated:February 13 2026
huggingface.co

Total runs: 0
Run Growth: 0
Growth Rate: 0.00%
Updated:October 01 2025
huggingface.co

Total runs: 0
Run Growth: 0
Growth Rate: 0.00%
Updated:September 18 2025
huggingface.co

Total runs: 0
Run Growth: 0
Growth Rate: 0.00%
Updated:September 11 2025
huggingface.co

Total runs: 0
Run Growth: 0
Growth Rate: 0.00%
Updated:February 06 2026
huggingface.co

Total runs: 0
Run Growth: 0
Growth Rate: 0.00%
Updated:September 23 2025
huggingface.co

Total runs: 0
Run Growth: 0
Growth Rate: 0.00%
Updated:September 12 2025