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.
🚀 NeuroReasoner Chain‑of‑Thought Toolkit
📂 Included Scripts
⚙️ Installation
- Clone or unzip this folder.
- Install dependencies:
pip install torch transformers streamlit pynvml
- 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 torchtokenizer = 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.pyOpen 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!
Inference Providers
NEW
This model isn't deployed by any Inference Provider.
🙋
Ask for provider support
HF Inference deployability: The model has no library tag.