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.
--- license: apache-2.0 ---
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.pip install torch transformers streamlit pynvmlayjays132/NeuroReasoner‑1‑NR‑1) is accessible or update the GUI script.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])
streamlit run chain_of_thought_gui.pyOpen the local URL and tweak model, device, chain count, sampling params, then enter your prompt.
▶ 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. …