Git Product home page Git Product logo

attention's Introduction

OpenCog

CircleCI

This repo is no longer maintained! Please use the following, instead:

Obsolete! As of 2021, the most interesting and actively maintained parts of this git repo have been split off into their own distinct git repos. What is left here is a mish-mash of unmatained stuff that is in the process of bit-rotting. Some unit tests fail. Some unit tests won't run. Some code won't compile. Perhaps there's some good stuff in here. Perhaps it can be brought back to life and used for something or other. However... for the most part, it is obsolete.


This git repository contains the "OpenCog Framework", which has served as a (scientific, technical) laboratory for researching, exploring and learning how to integrate AI algorithms and systems into humanoid robotic systems. Most of the activity within this particular repo has focused on integrating natural language chat, common-sense reasoning, assorted learning algorithms, and motor control of humanoid robots.

A stated goal of the OpenCog project is to develop artificial general intelligence (AGI) systems. This is all and well; however, what can be found here, in this particular repo, is very far from that. The code here really is ... a laboratory for integrating various types of AI systems. As such, it is a compilation of several decades of work by a large and varying collection of students, researchers, professors and software engineers. As a laboratory, it is filled with all sorts of devices in varying states of working order, from well-polished to mostly-broken.

See also:

  • ROCCA - Rational OpenCog Controlled Agent. This is a different assemblage of assorted OpenCog components, so that they operate within Minecraft, in the OpenAI Gym. The focus is on learning with the pattern miner, and reasoning with PLN.

Overview

Most of the basic components used in OpenCog are distributed across various git repos, (mostly) grouped under https://github.com/opencog

This git repository contains a crude natural language processing pipeline, several embodied chatbots, and some control/action-selection mechanisms. These include:

  • Ghost, a Chatscript-compatible chatbot with additional capabilities for accepting visual sensory input, and for controlling robot movements.

  • OpenPsi, a model of psychological states. Its currently a mashup of two unrelated ideas: a generic rule-class action-selection and planning system, and a model of human psychological states. An open to-do item is to untangle these two.

  • An assortment of natural language processing subsystems, including:

    • Natural language generation (for expressing thoughts as sentences).
    • Natural language input (for reading and hearing).
    • Relex2logic, converting natural language to logic expressions.
    • Assorted chatbots, some of which are embodied.
    • A Lojban tool.

Prerequisites

To build and run the system here, the packages listed below are required. Users of Ubuntu may use the dependency installer from the /opencog/octool repository. Docker containers with OpenCog preconfigured can be found in the opencog/docker repo.

cogutil

Common OpenCog C++ utilities. https://github.com/opencog/cogutil It uses exactly the same build procedure as this package. Be sure to sudo make install at the end.

atomspace

OpenCog Atomspace, a sophisticated (hyper-)graph database. https://github.com/opencog/atomspace It uses exactly the same build procedure as this package. Be sure to sudo make install at the end.

cogserver

OpenCog CogServer Network Server. https://github.com/opencog/cogserver It uses exactly the same build procedure as this package. Be sure to sudo make install at the end.

attention

OpenCog Attention Allocation subsystem. https://github.com/opencog/attention It uses exactly the same build procedure as this package. Be sure to sudo make install at the end.

URE

OpenCog Unified Rule Engine. https://github.com/opencog/ure Required for PLN It uses exactly the same build procedure as this package. Be sure to sudo make install at the end.

pln

OpenCog Probabilistic Logic Networks reasoning system. https://github.com/opencog/pln It uses exactly the same build procedure as this package. Be sure to sudo make install at the end.

spacetime

OpenCog Spacetime Server - locations of objects in space and time. https://github.com/opencog/spacetime It uses exactly the same build procedure as this package. Be sure to sudo make install at the end.

ros-behavior-scripting

Visual and auditory senses, robot motor control. https://github.com/opencog/ros-behavior-scripting It uses exactly the same build procedure as this package. Be sure to sudo make install at the end.

lg-atomese

Natural Language Parser for English, Russian, other languages. Required for natural language generation, and the chatbot. https://github.com/opencog/lg-atomese It uses exactly the same build procedure as this package. Be sure to sudo make install at the end.

Building OpenCog

Perform the following steps at the shell prompt:

    cd to project root dir
    mkdir build
    cd build
    cmake ..
    make

Libraries will be built into subdirectories within build, mirroring the structure of the source directory root.

Unit tests

To build and run the unit tests, from the ./build directory enter (after building opencog as above):

    make test

attention's People

Contributors

amebel avatar cuayacas7 avatar dagiopia avatar dalecassidy avatar eddiemonroe avatar ferrouswheel avatar glicerico avatar inflector avatar kasimebrahim avatar leungmanhin avatar linas avatar manisabri avatar misgeatgit avatar ngeiswei avatar noskill avatar radivarig avatar roman-khimov avatar rtreutlein avatar shujingke avatar stellarspot avatar vsbogd avatar wenwei-dev avatar yantrabuddhi avatar zariuq avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

attention's Issues

opencog::attentionbank(...) should not rely that objects compared by references are equal

opencog::attentionbank(AtomSpace* asp) method in AttentionBank has the following check to compare if two AtomSpaces are equal:

https://github.com/opencog/opencog/blob/802f0ec84e90db55389ee8ace40be6004a1ec9d1/opencog/attentionbank/bank/AttentionBank.cc#L249

This can fail if one AtomSpace is deleted and immediately after that the second one is created.
because the the new AtomSpace can be created with the same memory address as the previous one.

I encountered it in the Python test that can or can't fail depending with each address the new AtomSpace is created:
(note that the opencog/opencog#3549 pull request is required to run the test)

import unittest
from unittest import TestCase

from opencog.type_constructors import *
from opencog.utilities import initialize_opencog, finalize_opencog
from opencog.bank import AttentionBank, af_bindlink


class AttentionBankTest(TestCase):

    def setUp(self):
        self.atomspace = AtomSpace()
        initialize_opencog(self.atomspace)

    def tearDown(self):
        finalize_opencog()
        del self.atomspace

    def test_get_handles_by_av_different_as1(self):
        attention_bank = AttentionBank(self.atomspace)

        node1 = ConceptNode("node1")
        attention_bank.set_sti(node1, 2.0)

        atoms = attention_bank.get_atoms_by_av(1.0, 4.0)
        self.assertEqual(1, len(atoms))

    def test_get_handles_by_av_different_as2(self):
        attention_bank = AttentionBank(self.atomspace)

        node2 = ConceptNode("node2")
        attention_bank.set_sti(node2, 2.0)

        atoms = attention_bank.get_atoms_by_av(1.0, 4.0)
        self.assertEqual(1, len(atoms))


if __name__ == '__main__':
    unittest.main()

Stimulating atoms outside of a mind agent

Currently atoms can only be stimulated with in an Agent class instance. Is there any particular reason for this design choice? What is the disadvantage of making stimulus attribute of an Atom class and stimulation a method defined by the AtomSpace class?

Security: Multiple possible Intiger Overflows in HopfieldOptions.cc

opencog/examples/hopfield/HopfieldOptions.cc , uses and calls for atoi() multiple times (197, 200, 203, 204, 207...)

In the case of atoi, if the input recieved is not checked, the resulting number can exceed the expected range -- causing integer or stack overflows.

If source is untrusted (meaning recieved from user-input), check both minimum and maximum with INT_MAX and INT_MIN for ints, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended).

Using these to map variables while calling for atoi() would be nice

  • strtol() LONG_MIN LONG_MAX
  • strtoll() LLONG_MIN LLONG_MAX
  • strtoimax() INTMAX_MIN INTMAX_MAX
  • strtoq() LLONG_MIN LLONG_MAX

Reformulation of HebbianLink updating

Assuming InverseHebbianLinks are removed, it should be possible to simplify/modify HebbianLink updating as follows.

...

Update of

s_hebbAB

could happen as follows, I think.

When A is chosen for importance updating, then: If A is in the AF,

The following steps are done for each B in the AF...

If no link

HebbianLink A B

exists, then one is created with

s = SimpleTV(1, 1/(1+k))

If a link

L=HebbianLink A B

already exists, then its truth value is merged (revised) with the
value SimpleTV(1, 1/(1+k))

Also, if after revision we have s>s_AF, then the LTI of the link L
should be increased by an amount LTISmallIncrement (which should cause
an equal amount of LTI to get taken from the central bank). This is
because the link is more interesting if it has a higher truth value,
assuming it's higher than the expected value s_AF.... Probably the
STI of the link L should be increased in a comparable way....

The following steps are done for each B that is not in the AF, for
which there exists a link

L = HebbianLink A B

-- The truth value of the link L is revised (merged) with the
SimpleTruthValue (0,1/(1+k)) where k>>1 is a "personality parameter"

-- If s > s_AF, then
------the LTI of the link L is decreased by an amount
LTISmallDecrement (which should cause an equal amount of LTI to get
put into the central bank). This is because the link is less
interesting if it has a lower truth value (given that its strength is
greater than expected... it's now becoming less greater than
expected...)
------ If, after revision, s<s_AF, then the LTI of the link L is
decreased by a ratio LTIBigDecrement. This is because the link is
now really, really uninteresting (it's a HebbianLink between two Atoms
that co-occur in the AF slightly less than would be expected at random
... booorrring...)

-- If s < s_AF ( so s is conceptually "inverse hebbian"), then
------the LTI of the link L is increased by an amount
LTISmallIncrement (which should cause an equal amount of LTI to get
put into the central bank). This is because the tweak in truth value
has made the link MORE surprising, not less...

Doesn't find Doxygen

CMake doesn't find Doxygen at build time. In CMakeLists,txt, a line SUMMARY_ADD("Doxygen" "Code documentation" DOXYGEN_FOUND) exists, but no FIND_PACKAGE(Doxygen).

Build fails on Debian sid (CMake or Boost issue?)

The build of "attention" module fails on the current Debian sid:

(snip)
-- Configuring done
CMake Error at opencog/attention/CMakeLists.txt:8 (ADD_LIBRARY):
  Target "attention" links to target "Boost::system" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?

CMake Error at opencog/attention/CMakeLists.txt:8 (ADD_LIBRARY):
  Target "attention" links to target "Boost::filesystem" but the target was
  not found.  Perhaps a find_package() call is missing for an IMPORTED
  target, or an ALIAS target is missing?
(snip)

Modifying FIND_PACKAGE in CMakeLists.txt to something like FIND_PACKAGE(Boost REQUIRED COMPONENTS system filesystem) fixes this, but I'm not sure this is the way to go. The current version of CMake in sid is 3.16.3, Boost is 1.71.0.3.

OpenCogAtomTypes.cmake not found

I'm trying to build the latest commit (87d4367) of attention with the latest commits of cogutil (b07b41b2eaf01627c78b27f1f28bb09ef7086f8e), atomspace (ed1d316a44ddca5791712ebdc291770905a72f05), and cogserver (c8ad85fef446819e6bd711f0791887a5aa6a41f9). The build almost immediately aborts:

/gnu/store/iz9500ssxcqlyr74hg1jq10ycrh42yq1-cmake-minimal-3.15.1/bin/cmake -S/tmp/guix-build-attention-0-1.87d4367.drv-0/source -B/tmp/guix-build-attention-0-1.87d4367.drv-0/build --check-build-system CMakeFiles/Makefile.cmake 0
/gnu/store/iz9500ssxcqlyr74hg1jq10ycrh42yq1-cmake-minimal-3.15.1/bin/cmake -E cmake_progress_start /tmp/guix-build-attention-0-1.87d4367.drv-0/build/CMakeFiles /tmp/guix-build-attention-0-1.87d4367.drv-0/build/CMakeFiles/progress.marks
make -f CMakeFiles/Makefile2 all
make[1]: Entering directory '/tmp/guix-build-attention-0-1.87d4367.drv-0/build'
make -f opencog/CMakeFiles/SCM_CONFIG.dir/build.make opencog/CMakeFiles/SCM_CONFIG.dir/depend
make[2]: Entering directory '/tmp/guix-build-attention-0-1.87d4367.drv-0/build'
cd /tmp/guix-build-attention-0-1.87d4367.drv-0/build && /gnu/store/iz9500ssxcqlyr74hg1jq10ycrh42yq1-cmake-minimal-3.15.1/bin/cmake -E cmake_depends "Unix Makefiles" /tmp/guix-build-attention-0-1.87d4367.drv-0/source /tmp/guix-build-attention-0-1.87d4367.drv-0/source/opencog /tmp/guix-build-attention-0-1.87d4367.drv-0/build /tmp/guix-build-attention-0-1.87d4367.drv-0/build/opencog /tmp/guix-build-attention-0-1.87d4367.drv-0/build/opencog/CMakeFiles/SCM_CONFIG.dir/DependInfo.cmake --color=
Scanning dependencies of target SCM_CONFIG
make[2]: Leaving directory '/tmp/guix-build-attention-0-1.87d4367.drv-0/build'
make -f opencog/CMakeFiles/SCM_CONFIG.dir/build.make opencog/CMakeFiles/SCM_CONFIG.dir/build
make[2]: Entering directory '/tmp/guix-build-attention-0-1.87d4367.drv-0/build'
make[2]: Nothing to be done for 'opencog/CMakeFiles/SCM_CONFIG.dir/build'.
make[2]: Leaving directory '/tmp/guix-build-attention-0-1.87d4367.drv-0/build'
[  0%] Built target SCM_CONFIG
make -f opencog/attentionbank/CMakeFiles/COPY_TO_LOAD_PATH_IN_BUILD_DIR_FROM__tmp_guix-build-attention-0-1.87d4367.drv-0_source_opencog_attentionbank.dir/build.make opencog/attentionbank/CMakeFiles/COPY_TO_LOAD_PATH_IN_BUILD_DIR_FROM__tmp_guix-build-attention-0-1.87d4367.drv-0_source_opencog_attentionbank.dir/depend
make[2]: Entering directory '/tmp/guix-build-attention-0-1.87d4367.drv-0/build'
cd /tmp/guix-build-attention-0-1.87d4367.drv-0/build && /gnu/store/iz9500ssxcqlyr74hg1jq10ycrh42yq1-cmake-minimal-3.15.1/bin/cmake -E cmake_depends "Unix Makefiles" /tmp/guix-build-attention-0-1.87d4367.drv-0/source /tmp/guix-build-attention-0-1.87d4367.drv-0/source/opencog/attentionbank /tmp/guix-build-attention-0-1.87d4367.drv-0/build /tmp/guix-build-attention-0-1.87d4367.drv-0/build/opencog/attentionbank /tmp/guix-build-attention-0-1.87d4367.drv-0/build/opencog/attentionbank/CMakeFiles/COPY_TO_LOAD_PATH_IN_BUILD_DIR_FROM__tmp_guix-build-attention-0-1.87d4367.drv-0_source_opencog_attentionbank.dir/DependInfo.cmake --color=
Scanning dependencies of target COPY_TO_LOAD_PATH_IN_BUILD_DIR_FROM__tmp_guix-build-attention-0-1.87d4367.drv-0_source_opencog_attentionbank
make[2]: Leaving directory '/tmp/guix-build-attention-0-1.87d4367.drv-0/build'
make -f opencog/attentionbank/CMakeFiles/COPY_TO_LOAD_PATH_IN_BUILD_DIR_FROM__tmp_guix-build-attention-0-1.87d4367.drv-0_source_opencog_attentionbank.dir/build.make opencog/attentionbank/CMakeFiles/COPY_TO_LOAD_PATH_IN_BUILD_DIR_FROM__tmp_guix-build-attention-0-1.87d4367.drv-0_source_opencog_attentionbank.dir/build
make[2]: Entering directory '/tmp/guix-build-attention-0-1.87d4367.drv-0/build'
cd /tmp/guix-build-attention-0-1.87d4367.drv-0/build/opencog/attentionbank && /gnu/store/iz9500ssxcqlyr74hg1jq10ycrh42yq1-cmake-minimal-3.15.1/bin/cmake -E copy /tmp/guix-build-attention-0-1.87d4367.drv-0/source/opencog/attentionbank/scm//attention-bank.scm /tmp/guix-build-attention-0-1.87d4367.drv-0/build/opencog/scm//opencog/attention-bank.scm
make[2]: Leaving directory '/tmp/guix-build-attention-0-1.87d4367.drv-0/build'
[  0%] Built target COPY_TO_LOAD_PATH_IN_BUILD_DIR_FROM__tmp_guix-build-attention-0-1.87d4367.drv-0_source_opencog_attentionbank
make -f opencog/attentionbank/types/CMakeFiles/attention_atom_types.dir/build.make opencog/attentionbank/types/CMakeFiles/attention_atom_types.dir/depend
make[2]: Entering directory '/tmp/guix-build-attention-0-1.87d4367.drv-0/build'
cd /tmp/guix-build-attention-0-1.87d4367.drv-0/build && /gnu/store/iz9500ssxcqlyr74hg1jq10ycrh42yq1-cmake-minimal-3.15.1/bin/cmake -E cmake_depends "Unix Makefiles" /tmp/guix-build-attention-0-1.87d4367.drv-0/source /tmp/guix-build-attention-0-1.87d4367.drv-0/source/opencog/attentionbank/types /tmp/guix-build-attention-0-1.87d4367.drv-0/build /tmp/guix-build-attention-0-1.87d4367.drv-0/build/opencog/attentionbank/types /tmp/guix-build-attention-0-1.87d4367.drv-0/build/opencog/attentionbank/types/CMakeFiles/attention_atom_types.dir/DependInfo.cmake --color=
Scanning dependencies of target attention_atom_types
make[2]: Leaving directory '/tmp/guix-build-attention-0-1.87d4367.drv-0/build'
make -f opencog/attentionbank/types/CMakeFiles/attention_atom_types.dir/build.make opencog/attentionbank/types/CMakeFiles/attention_atom_types.dir/build
make[2]: Entering directory '/tmp/guix-build-attention-0-1.87d4367.drv-0/build'
make[2]: *** No rule to make target '/gnu/store/a21dzdwc2xvyz8wmlkq16jw0x34wpwrm-attention-0-1.87d4367/share/opencog/cmake/OpenCogAtomTypes.cmake', needed by 'opencog/attentionbank/types/atom_types.h'.  Stop.
make[2]: Leaving directory '/tmp/guix-build-attention-0-1.87d4367.drv-0/build'
make[1]: *** [CMakeFiles/Makefile2:439: opencog/attentionbank/types/CMakeFiles/attention_atom_types.dir/all] Error 2
make[1]: Leaving directory '/tmp/guix-build-attention-0-1.87d4367.drv-0/build'
make: *** [Makefile:155: all] Error 2
command "make" failed with status 2

This line here:

make[2]: *** No rule to make target '/gnu/store/a21dzdwc2xvyz8wmlkq16jw0x34wpwrm-attention-0-1.87d4367/share/opencog/cmake/OpenCogAtomTypes.cmake', needed by 'opencog/attentionbank/types/atom_types.h'. Stop.

shows that OpenCogAtomTypes.cmake, which is provided by atomspace is somehow expected to be found in the current project's target directory.

(Guix installs every package to its own prefix directory under /gnu/store/...-name-version/.)

Segfault in ecan when using ghost

Steps to take to reproduce segfault

  1. Build and install opencog, and atomspace after running the following
cmake -DCMAKE_DISABLE_FIND_PACKAGE_Python3Interp=TRUE -DCMAKE_BUILD_TYPE=DEBUG ..
  1. Start relex by running opencog-server.sh
  2. Start cogserver using the following configuration file, load-opencog.txt (.txt extenstion is used for loading to github)
gdb -ex r --args guile -l load-opencog.txt
  1. Load ghost rules
cd /loving-ai-ghost/bin 
bash run.sh
  1. From the terminal where the cogserver is started, interact with the bot until it segfaults
scheme@(guile-user)> (ghost "hi")
[2018-12-28 10:23:55:845] [INFO] [say] (|happy,3| Hi ! My name is Sophia. What's yours ?)
...
...
scheme@(guile-user)> (ghost "amen")
 [2018-12-28 10:24:11:434] [INFO] [say] (|happy,.7,5| Good to meet you , amen ! Thanks so much for taking the time to come and talk with me today.)
...

screenshot from 2018-12-28 18-25-54

Repo states

loving-ai-ghost = a3e6f43
opencog sha = d68351c
atomspace sha = c121f0f
cogutil sha = f85718c
relex sha = 6fb3873

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.