--- license: apache-2.0 ---

🚀 NeuroReasoner Chain‑of‑Thought Toolkit

đź“‚ Included Scripts

  • 📦chain_of_thought_wrapper.py – Core Python wrapper module for step‑by‑step reasoning.
  • 🖥️chain_of_thought_gui.py – Futuristic Streamlit GUI for interactive use.

⚙️ Installation

  1. Clone or unzip this folder.
  2. Install dependencies: pip install torch transformers streamlit pynvml
  3. Ensure your model checkpoint (e.g. ayjays132/NeuroReasoner‑1‑NR‑1) is accessible or update the GUI script.

👩‍💻 Importing & Using the Wrapper

📚
from chain_of_thought_wrapper import ChainOfThoughtWrapper
from transformers import AutoTokenizer, AutoModelForCausalLM
import torch

tokenizer = AutoTokenizer.from_pretrained("ayjays132/NeuroReasoner-1-NR-1")
model     = AutoModelForCausalLM.from_pretrained("ayjays132/NeuroReasoner-1-NR-1")
device    = "cuda" if torch.cuda.is_available() else "cpu"
model.to(device)

cot = ChainOfThoughtWrapper(model=model, tokenizer=tokenizer, device=device)

inputs = tokenizer("Why is the sky blue?", return_tensors="pt").to(device)
result = cot.generate(input_ids=inputs.input_ids, attention_mask=inputs.attention_mask)

for i, step in enumerate(result["reasoning_steps"][0], 1):
    print(f"Step {i}:", step)
print("Final Answer:", result["final_answers"][0])

🖥️ Launching the GUI

🚀
streamlit run chain_of_thought_gui.py
Open the local URL and tweak model, device, chain count, sampling params, then enter your prompt.

đź”§ GUI Configuration Options

  • 🤖Model: HF repo or local path.
  • đź’»Device: cuda or cpu.
  • 🔢# Chains: Number of reasoning samples.
  • 🔄Self‑Consistency: Toggle majority‑vote across chains.
  • ⏳Max New Tokens: Length of generated reasoning.
  • 🎛️Temperature, Top‑k, Top‑p & No‑repeat n‑gram: Sampling controls.

⏳ Example GUI Session

🔍
â–¶ Prompt: What causes rainbows?
▶ Chains: 3, Self‑Consistency: on
▶ Sampling: temp 0.7, top‑k 50, top‑p 0.9
…generating…
â–Ľ Chain 1 â–Ľ
1. Sunlight is composed of multiple colors.
2. Water droplets refract and disperse each color.
3. Observer sees spectrum as arc.
Final Answer: Rainbows form when sunlight refracts and disperses through droplets, separating into colors.
…

📜 License

📄Released under the MIT License. Free to use, modify, and share—empower everyone with transparent, step‑by‑step AI reasoning!