-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature] Load and save experience and memory #19
Comments
I used PyNARS to wrap a "PyNARS-Interface", which includes ① some simplified input syntax, ② an easy-to-use "command system", and ③ a small tool for converting standardized data structures (currently only JSON) into Narsese The Chinese version: 我先前在交互式学习NARS的时候,自己用PyNARS封装了一个「NARS接口」,其中包含①一些简化的输入语法②一个较为易用的「指令系统」③一个把标准化数据结构(目前只有JSON)转化为Narsese的小工具。 |
@ARCJ137442 Sounds good. Feel free to raise pull-requests. |
(I have provided the Chinese version in the later section, which may help you understand my idea faster) This is more of a historical question, but it also involves my personal views on the "representation of NARS data structures implemented across computers". In one sentence: I would like to have a memory storage format that is common across multiple "computer implementations of NARS" (I'll call it "CIN" for convenience) (As a simple Narsese task stream, the storage format of NARS's experience just required the compatibility of Narsese syntax) Here is some expanded information: In order to make the study more convenient and comparative, we often use different CIN. Examples of CIN include OpenNARS(Java), ONA(C), and NARS-Python(Python), as well as other implementations such as PyNARS(Python) and NARS-Swift(Swift). Previously, Christian H's "NARS-Pong" and BoYang XU's "NARS-FighterPlane" used the way of "opening program in command line + string IO" to make interaction in multiple CIN. However, this kind of cross-CIN Demo has a major disadvantage, as stated in this issue: the running results of NARS learning (as memory and experience) cannot be saved as a file likes breakpoint, or "save its memory and experience, and continue to work on this basis in subsequent experiments (such as debugging the kernel, checking reasoning)"; moreover, because there is no "universial memory storage format" across CIN, it is difficult for such demos to do some more advanced "comparative tests between CINs" (for example, given the same memory and experience, observe the different reasoning methods, processes, and results of each CIN). So when I was researching "Load and save memory in PyNARS" last year, I came up with the idea of using a "Universal markup language" like JSON to save its memory area (the code is represented by In summary,
The Chinese Version这更多是一个历史问题,但其中也涉及到我对「跨计算机实现的NARS数据结构表示」的个人观点。 用一句话表示:我希望能有一个可以在多种「NARS的计算机实现」(为了方便称呼,我把它叫做「CIN」)中通用的记忆存储格式。 下面是一些扩充信息: 为了使研究变得更为方便和有对比性,我们经常用到不同的CIN。这些CIN的例子主要有OpenNARS(Java)、ONA(C)、NARS-Python(Python),当然也包括PyNARS(Python)、NARS-Swift(Swift)等其它实现。 但这类跨CIN的Demo有个很大的缺点,也正如这个issue所说:NARS学习的成果(作为记忆与经验)无法以文件形式断点保存,或者说「保存其记忆与经验,并在后续实验中以此为基础继续开展工作(例如调试内核、检查推理)」;并且,因为没有跨CIN的「通用记忆格式」,这类Demo很难做到一些更高级的「对比性测试」(例如,给定相同的记忆与经验,观察各CIN推理方式、过程、结果的不同)。 总的来说,
|
If only one project wins in the future, then pickle is the best choice, both in terms of performance, learning cost, and ease of use |
… to save and load whole NARS reasoner but now `pickle` doesn't work because of Error "Can't pickle local object 'Bag.__init__.<locals>.map_priority'"
Now I have performed an experiment based on pull request #27 (uses ExConsole with cmd The following is the result of test (only critical outputs):
|
… to save and load whole NARS reasoner but now `pickle` doesn't work because of Error "Can't pickle local object 'Bag.__init__.<locals>.map_priority'"
Yeah.. this is because there is a local (lambda) function in |
Is your feature request related to a problem? Please describe.
In OpenNARS 3.0.4, there are some routines for loading and saving experience and memory,
These functions are useful for users to analyzing system's exceptions and bugs.
Describe the solution you'd like
To save and load system's memory,
pickle
might be enough.To save experience, using some log tools of python. To load experience, input them to the system line by line.
The text was updated successfully, but these errors were encountered: