BrainCog-X / Brain-Cog

Brain-inspired Cognitive Intelligence Engine (BrainCog) is a brain-inspired spiking neural network based platform for Brain-inspired Artificial Intelligence and simulating brains at multiple scales. The long term goal of BrainCog is to provide a comprehensive theory and system to decode the mechanisms and principles of human intelligence and its evolution, and develop artificial brains for brain-inspired conscious living AI in future Human-AI symbiotic Society.
http://www.brain-cog.network/
Apache License 2.0
457 stars 71 forks source link

Multiscale_Brain_Structure_Simulation Errors under Windows #144

Open lonnietc opened 1 year ago

lonnietc commented 1 year ago

Hello,

I have tried to run the brain models with Python 3.9, 3.10, and 3.11 under "Multiscale_Brain_Structure_Simulation" models like "HumanBrain", "MouseBrain", and "" and am getting errors like this.

---- Human Brain ----

Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

Install the latest PowerShell for new features and improvements! https://aka.ms/PSWindows

PS D:\BrainCog\examples\Multiscale_Brain_Structure_Simulation\HumanBrain> python .\human_brain.py
torch.Size([3442000, 2])
Traceback (most recent call last):
  File "D:\BrainCog\examples\Multiscale_Brain_Structure_Simulation\HumanBrain\human_brain.py", line 185, in <module>
    model = brain(syn, weight, neuron_model, p_neuron, dt, device)
  File "D:\BrainCog\examples\Multiscale_Brain_Structure_Simulation\HumanBrain\human_brain.py", line 46, in __init__
    self.neurons = HHNode(p_neuron, dt, device)
TypeError: __init__() missing 1 required positional argument: 'type_index'

---- Mouse Brain ----

Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

Install the latest PowerShell for new features and improvements! https://aka.ms/PSWindows

PS D:\BrainCog\examples\Multiscale_Brain_Structure_Simulation\MouseBrain> python .\mouse_brain.py
torch.Size([52238965, 2])
Traceback (most recent call last):
  File "D:\BrainCog\examples\Multiscale_Brain_Structure_Simulation\MouseBrain\mouse_brain.py", line 186, in <module>
    model = brain(syn, weight, neuron_model, p_neuron, dt, device)
  File "D:\BrainCog\examples\Multiscale_Brain_Structure_Simulation\MouseBrain\mouse_brain.py", line 47, in __init__
    self.neurons = aEIF(p_neuron, dt, device)
TypeError: __init__() missing 1 required positional argument: 'type_index'

---- MacaqueBrain ----

Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

Install the latest PowerShell for new features and improvements! https://aka.ms/PSWindows

PS D:\BrainCog\examples\Multiscale_Brain_Structure_Simulation\MacaqueBrain> python .\macaque_brain.py
torch.Size([38960200, 2])
Traceback (most recent call last):
  File "D:\BrainCog\examples\Multiscale_Brain_Structure_Simulation\MacaqueBrain\macaque_brain.py", line 185, in <module>
    model = brain(syn, weight, neuron_model, p_neuron, dt, device)
  File "D:\BrainCog\examples\Multiscale_Brain_Structure_Simulation\MacaqueBrain\macaque_brain.py", line 47, in __init__
    self.neurons = aEIF(p_neuron, dt, device)
TypeError: __init__() missing 1 required positional argument: 'type_index'

Any thoughts? Thanks

craree commented 1 year ago

The version you installed by 'pip install braincog' is inconsistent with the online version on GitHub. You can clone braincog from github(see https://www.brain-cog.network/docs/tutorial/1_installation.html): git clone https://github.com/braincog-X/Brain-Cog.git cd Brain-Cog pip install -e . Or you can copy the code of HHNode and aEIF in braincog/base/node/node.py on github

lonnietc commented 1 year ago

Thanks for getting back to me on this.

What version of Python do you typically use?

Also, I actually followed the install tutorial

https://www.youtube.com/watch?v=XkHq-MbKo20&list=PLNXUFsTshMlYTW6oleY5YjVEfnoQSw0N7&index=2

with references to the Brain Cod Github repo information as well.

lonnietc commented 1 year ago

I did a clean re-install of Brain Cog and things seem to run now with just on "UserWarning"


D:\BrainCog\Brain-Cog\examples\Multiscale_Brain_Structure_Simulation\HumanBrain\human_brain.py:201: UserWarning: To copy construct from a tensor, it is recommended to use sourceTensor.clone().detach() or sourceTensor.clone().detach().requires_grad_(True), rather than torch.tensor(sourceTensor).
  Iraster = torch.tensor(Iraster).transpose(0, 1)

Also, is there somewhere I can get the paper since I do not have access to this particular one from where I am at:

    @article{Liu2016,
    author={Liu, Xin and Zeng, Yi and Zhang, Tielin and Xu, Bo},
    title={Parallel Brain Simulator: A Multi-scale and Parallel Brain-Inspired Neural Network Modeling and Simulation Platform},
    journal={Cognitive Computation},
    year={2016},
    month={Oct},
    day={01},
    volume={8},
    number={5},
    pages={967--981},
    issn={1866-9964},
    doi={10.1007/s12559-016-9411-y},
    url={https://doi.org/10.1007/s12559-016-9411-y}
craree commented 1 year ago

I think a python version over 3.7 is sufficient.

The methods in this article are not what our current code uses. I share the paper in the following link: https://drive.google.com/file/d/1p-ewKNzUFaAgf3jKa0FcE-yWPHI7iWoT/view?usp=sharing

lonnietc commented 1 year ago

Thanks for the quick response and for the paper link that I will read with great interest.

I will give the Python 3.7 a try to see how it runs the examples to see how that goes.

Eventually, I would like to see about adding some new models to the Brain Cog Model_Zoo since I think that it could be helpful for the eventual modeling of a virtual full brain simulation towards AGI.

One step forward would be to work out a good spiking RNN approach for a Question & Answering system maybe building on something in the "Knowledge Representation and Reasoning" section.

Thanks again