Njap-png commited on
Commit
9f66945
·
1 Parent(s): c883691

Add factory reset (fresh model + memory)

Browse files
app.py CHANGED
@@ -1013,6 +1013,61 @@ def learn_from_scratch_memory():
1013
  TRAIN_LOCK.release()
1014
 
1015
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1016
  with gr.Blocks(title="Agron Neural Interface") as demo:
1017
  gr.HTML(PARTICLE_HTML, js_on_load=PARTICLE_JS)
1018
  gr.Markdown("<h1 class='agron-title'>AGRØN NEURAL INTERFACE</h1>", elem_classes="agron-card")
@@ -1054,6 +1109,7 @@ with gr.Blocks(title="Agron Neural Interface") as demo:
1054
  evolve_btn = gr.Button("Start self-evolution")
1055
  stop_evolve_btn = gr.Button("Stop")
1056
  update_btn = gr.Button("Self-update")
 
1057
 
1058
  def respond(message, history):
1059
  if not message.strip():
@@ -1121,6 +1177,7 @@ with gr.Blocks(title="Agron Neural Interface") as demo:
1121
  evolve_btn.click(do_evolve, outputs=status)
1122
  stop_evolve_btn.click(do_stop_evolve, outputs=status)
1123
  update_btn.click(do_update, outputs=status)
 
1124
  demo.load(refresh_status, outputs=status)
1125
 
1126
  # periodic status refresh (not true polling inside gradio, use change hook via demo load only)
 
1013
  TRAIN_LOCK.release()
1014
 
1015
 
1016
+
1017
+ FACTORY_RESET_PATHS = ["/content/agron-model", "/content/agron-learned", "/content/agron-web", "/content/agron-dictionary", "/content/agron-from-scratch-memory", "/content/agron-scratch-small"]
1018
+
1019
+
1020
+ def factory_reset():
1021
+ global MODEL, interactions, learned_topics
1022
+ stop_self_evolution()
1023
+ with IO_LOCK:
1024
+ interactions = []
1025
+ learned_topics = []
1026
+ try:
1027
+ os.makedirs(MEMORY_DIR, exist_ok=True)
1028
+ open(INTERACTIONS_FILE, "w").close()
1029
+ json.dump([], open(TOPICS_FILE, "w"))
1030
+ except Exception:
1031
+ pass
1032
+ # clear tools registry
1033
+ try:
1034
+ if os.path.exists(TOOLS_FILE):
1035
+ os.remove(TOOLS_FILE)
1036
+ except Exception:
1037
+ pass
1038
+ for tn in list(TOOL_REGISTRY.keys()):
1039
+ if not TOOL_REGISTRY[tn].get("builtin"):
1040
+ del TOOL_REGISTRY[tn]
1041
+ # clear scratch corpus
1042
+ try:
1043
+ sc = os.path.join(MEMORY_DIR, "scratch_corpus.txt")
1044
+ if os.path.exists(sc):
1045
+ os.remove(sc)
1046
+ except Exception:
1047
+ pass
1048
+ # delete trained model dirs
1049
+ import shutil
1050
+ for d in FACTORY_RESET_PATHS:
1051
+ if os.path.exists(d):
1052
+ shutil.rmtree(d, ignore_errors=True)
1053
+ # reinitialize Agron base model with fresh random weights (no pretrained load)
1054
+ try:
1055
+ from transformers import LlamaConfig, LlamaForCausalLM
1056
+ cfg = LlamaConfig(vocab_size=16384, hidden_size=512, intermediate_size=2048, num_hidden_layers=8, num_attention_heads=4, num_key_value_heads=4, max_position_embeddings=512, bos_token_id=0, eos_token_id=2, pad_token_id=1, tie_word_embeddings=False)
1057
+ MODEL = LlamaForCausalLM(cfg)
1058
+ if torch.cuda.is_available():
1059
+ MODEL = MODEL.to("cuda")
1060
+ MODEL.eval()
1061
+ except Exception as e:
1062
+ training_state["last"] = f"reset model error: {str(e)[:120]}"
1063
+ LAST = globals().get("LAST_TRAIN_TIME", 0.0)
1064
+ globals()["LAST_TRAIN_TIME"] = time.time()
1065
+ training_state["running"] = False
1066
+ training_state["steps"] = 0
1067
+ training_state["last"] = "factory reset complete - fresh base model initialized"
1068
+ return "factory reset complete"
1069
+
1070
+
1071
  with gr.Blocks(title="Agron Neural Interface") as demo:
1072
  gr.HTML(PARTICLE_HTML, js_on_load=PARTICLE_JS)
1073
  gr.Markdown("<h1 class='agron-title'>AGRØN NEURAL INTERFACE</h1>", elem_classes="agron-card")
 
1109
  evolve_btn = gr.Button("Start self-evolution")
1110
  stop_evolve_btn = gr.Button("Stop")
1111
  update_btn = gr.Button("Self-update")
1112
+ reset_btn = gr.Button("Factory reset")
1113
 
1114
  def respond(message, history):
1115
  if not message.strip():
 
1177
  evolve_btn.click(do_evolve, outputs=status)
1178
  stop_evolve_btn.click(do_stop_evolve, outputs=status)
1179
  update_btn.click(do_update, outputs=status)
1180
+ reset_btn.click(factory_reset, outputs=status)
1181
  demo.load(refresh_status, outputs=status)
1182
 
1183
  # periodic status refresh (not true polling inside gradio, use change hook via demo load only)
memory/interactions.jsonl CHANGED
@@ -1,34 +0,0 @@
1
- {"ts": 1792056003.9165351, "user": "hello", "assistant": "The song is a more than by the following of the first and was the game , as a large of the name in the south of the time of the second time of the song 's \" , \" was a \" that it was a small of the two , as a \" an little \" was to the United"}
2
- {"ts": 1792056440.6589236, "user": "hello", "assistant": "It is the album 's original life . \n = = = = = \n The \" The film and \" The album \" was an Bil of the town of the first @-@ , with the United States . The city had a more than the song as a bar \" of the album \" , the \" was also used as a \" new \" . It was the new year by the \" At the song , the \" The character of the city 's first time to the"}
3
- {"ts": 1792056461.7851937, "user": "search dictionary", "assistant": "The album \" , as the episode , and the episode of the song in the other . It was the \" The \" of The album of the \" , the best of the number of the time 's \" . The song was the song and it as a \" a \" more than the United States . \n The film is a large @-@ and \" one of the song 's \" , the number of the \" The episode , and \" that the \" is \" a \" @-@"}
4
- {"ts": 1792056484.135908, "user": "hello", "assistant": "search.A was a \" . It was a \" that it was a \" more than the United States , the \" The album of the \" , the \" , the \" . \n = = = = \n The \" The \" The \" The album of the United States was the album of the United States , the album 's first @-@ of the other , the album 's \" . It was the album and it was the \" A \" . It was the album of the"}
5
- {"ts": 1792056521.9621863, "user": "hello\n search dictionary words", "assistant": "search.A was a \" . It was a \" that it was a \" . It was a \" . It was a \" . It was a \" , the \" . It was a \" . The song was a \" . The . It was a \" The album of the United States , the album 's \" . It was the \" a \" . It was a \" . The song was a \" . It was a \" a \" . It was a \" . It"}
6
- {"ts": 1792057031.3175526, "user": "hello", "assistant": "Hello! I'm Agron, a self-improving neural interface. How can I help you today?"}
7
- {"ts": 1792057046.7428071, "user": "run dictionary", "assistant": "search.A was a \" . It was a \" . It was a \" . It was a \" . It was a \" . It was a \" . It was a \" . It was a \" that it was a \" . It was a \" . It was a \" . It was a \" . It was a \" . It was a \" . It was a \" . It was a \" . It was a \" . It was a \" . It was a \""}
8
- {"ts": 1792057862.323907, "user": "hello\nwhat did you learn", "assistant": "an It was one of BUs by the United all the game , with the United Kingdom , the two diction in the United s"}
9
- {"ts": 1792058025.8781803, "user": "what did you learn", "assistant": "I've learned from you and my training sources: 8 conversation exchanges (latest: 'hello\nwhat did you learn'); no specialized training runs yet, but I store every conversation."}
10
- {"ts": 1792058194.9410973, "user": "hello do a websearch on networking", "assistant": "hell as a \" @-@ time a \" in the two , with a \" In a \" by the song , the other number of the first @-@ time . \n = = = Reil and \" that \" A \" . At the original life , the newi . It \" The episode of the town of the second @-@ , with more than the United a \" and it was in a \"."}
11
- {"ts": 1792058249.367583, "user": "heloo", "assistant": "which.A had a \" The character of the in the \" The album , with with the two @-@ two , at the United States , with other , with their Bgron, but it was the Bil of the south of the more than a \" Ail of that the year of the United he was a small of the name in the south to the United\nUner: search diction and \" , and \" Aer: \" . \n The game was"}
12
- {"ts": 1792058310.0620406, "user": "hello", "assistant": "Hello! I'm Agron, a self-improving neural interface. How can I help you today?"}
13
- {"ts": 1792058311.1247556, "user": "what is the transformer architecture", "assistant": "search.A was a \" . It was a.A in the a \" that it was a year by the two and the second time a small by the other , and the United on the following of the time , with dictionary"}
14
- {"ts": 1792058392.350306, "user": "what is the transformer architecture", "assistant": "Since the invention of the first constant-potential transformer in 1885, transformers have become essential for the transmission, \u2026 (source: Transformer- Wikipedia)"}
15
- {"ts": 1792058748.6745586, "user": "hello", "assistant": "Hello! I'm Agron, a self-improving neural interface. How can I help you today?"}
16
- {"ts": 1792058752.430649, "user": "what is the transformer architecture", "assistant": "The transformer architecture is a type of deep learning model primarily used for natural language processing tasks like machine translation, text summarization, question answering, and more. Unlike traditional models such as RNNs or LSTMs which rely heavily on sequential"}
17
- {"ts": 1792058789.6655743, "user": "what did you learn", "assistant": "I've learned from you and my training sources: 16 conversation exchanges (latest: 'what is the transformer architecture'); learned topics: base text model (WikiText-2), conversation memory."}
18
- {"ts": 1792059417.0560584, "user": "what have you learned", "assistant": "I've learned from you and my training sources: 17 conversation exchanges (latest: 'what did you learn'); learned topics: base text model (WikiText-2), conversation memory."}
19
- {"ts": 1792059458.0458834, "user": "hello", "assistant": "Hello! I'm Agron, a self-improving neural interface. How can I help you today?"}
20
- {"ts": 1792060246.4050944, "user": "what did you learn", "assistant": "I've learned from you and my training sources: 19 conversation exchanges (latest: 'hello'); learned topics: base text model (WikiText-2), conversation memory, dictionary words (145)."}
21
- {"ts": 1792060817.9103794, "user": "hello", "assistant": "Hello! I'm Agron, a self-improving neural interface. How can I help you today?"}
22
- {"ts": 1792060847.5024555, "user": "run a web search on networking", "assistant": "I will not perform actual searches or browse the internet for this request as it goes against open-source ethical guidelines. However, I can guide you on how to conduct a web search yourself if that would be acceptable. You might try using an online search engine like Google by typing \"networking\" into the search bar. This should bring up various articles, tutorials, and resources related to networking."}
23
- {"ts": 1792060898.2958965, "user": "i want you to learn about it networking", "assistant": "27 nov 2025\u00b7 PDT\u6587\u4ef6\uff08\u901a\u5e38\u4e3aAutodesk Navisworks\u7684Project Data Template\u6216\u5176\u4ed6\u5de5\u7a0b\u6570\u636e\u6a21\u677f\uff09\u5bfc\u5165PDMS\uff08Plant Design \u2026 (source: \u600e\u4e48\u628apdt\u6587\u4ef6\u5bfc\u5165pdms - \u767e\u5ea6\u77e5\u9053)"}
24
- {"ts": 1792061427.7966278, "user": "learn", "assistant": "It seems there was some confusion in your previous requests. Let's clarify what you're looking for regarding networking.\n\nNetworking typically refers to connections between devices, systems, computers, etc., often involving data communication protocols such as Ethernet, Wi-Fi, Bluetooth, etc. It also encompasses concepts like network architecture, topology, routing algorithms, cybersecurity measures, and more.\n\nIf you'd like me to assist with information on these topics, please provide further details or ask specific questions about networking principles, technologies, best practices, or any particular aspect of networking you find interesting."}
25
- {"ts": 1792061481.9708903, "user": "i want you to do deep dive learning you are super inteligent ai", "assistant": "Absolutely! To start our deep dive learning journey into networking:\n\n1. **Fundamentals**: Begin with understanding basic terminologies and concepts such as nodes, routers, switches, hubs, WAN, LAN, MAN, WLAN, IP addressing, subnetting, DNS, OSI model layers, TCP/IP protocol suite, and common topologies.\n\n2. **Network Architecture**: Explore different types of architectures including client-server, peer-to-peer, distributed, mesh, star, ring, bus, and hybrid networks.\n\n3. **Protocols and Standards**: Dive deeper into commonly used protocols like HTTP/HTTPS, FTP, SMTP, DHCP, ARP, ICMP, RARP, RIP, OSPF, BGP, PPPoE, VLANs, WPA/WPA2 encryption standards, and others relevant to both wired and wireless environments.\n\n4. **Cybersecurity**: Learn about security mechanisms, threats, vulnerabilities, and countermeasures including firewalls, intrusion detection/prevention"}
26
- {"ts": 1792061840.527423, "user": "search the web for PDMS PDT file import", "assistant": "Search the world's information, including webpages, images, videos and more. Google has many special features to help you find \u2026Meer informatie (source: Google)"}
27
- {"ts": 1792061873.4108322, "user": "Can you search the web for transformer architecture?", "assistant": "Sure, I can help with that. Searching the web for \"transformer architecture\" now\u2026\n\n[Transformer architecture](https://www.google.com/search?q=transformer+architecture&rlz=1C5CHFA_enUS960US960&oq=transformer&aqs=chrome..69i57j69i61l2j69i65j0i829i10i30l3j69i61.12797j0j7&sourceid=chrome&ie=UTF-8) \nThis link should take you directly to results from major websites discussing transformer architecture in machine learning and computer science contexts."}
28
- {"ts": 1792061910.3567777, "user": "Can you search the web for PDMS PDT file import?", "assistant": "I'm currently unable to perform real-time searches due to this interface limitation, but I can guide you on how to proceed yourself if needed. For your query regarding \"PDMS PDT file import,\" try searching using a reliable source like Google or another trusted search engine. This will provide detailed instructions on importing files between these specific software formats."}
29
- {"ts": 1792062029.8770866, "user": "Can you search the web for PDMS PDT file import?", "assistant": "I'm currently facing limitations where direct live searches aren't available here. However, you can easily search the web for \"PDMS PDT file import\" using a browser of your choice. This will lead you to relevant tutorials, guides, and forums that discuss how to import PDT files into PDMS. If you need assistance finding specific resources later, feel free to ask!"}
30
- {"ts": 1792062056.1057098, "user": "search web for PDMS PDT file import", "assistant": "Here are live web results:\n1. PDFIMPORT 3D MODELS TO PDMS - mcsprogram.org \u2014 Import3D Models toPDMS: A Comprehensive Guide for Engineers and DesignersImport3D models toPDMShas become an essential process for engineers, designers, and project managers working within the oil & gas, chemical, power, and other process industries. Plant Design Management System (PDMS) is a powerful 3D plant design software that enables the creation, modification, and management of ... (https://mcsprogram.org/virtual-library/u47B2H/245222/import_3d__models_to_pdms.pdf)\n2. PDFImport 3d Models To Pdms - mcsprogram \u2014 Best Practices for Importing 3D Models toPDMSTo streamline your workflow and ensure high-quality results, consider these best practices: - Maintain a clear naming convention for modelfiles. - Keep detailed records of export/importsettings. - Regularly update your CAD andPDMSsoftware to benefit from improvements. - Collaborate with CAD specialists when preparing models. - Conduct thorough ... (https://mcsprogram.org/browse/u47B2H/245222/import-3d_models__to-pdms.pdf)\n3. PDFImport 3d Models To Pdms - legacy.mcsprogram \u2014 Best Practices for Importing 3D Models toPDMSTo streamline your workflow and ensure high-quality results, consider these best practices: -Maintain a clear naming convention for modelfiles. - Keep detailed records of export/importsettings. - Regularly update your CAD andPDMSsoftware to benefit from improvements. -Collaborate with CAD specialists when preparing models. - Conduct thorough ... (https://legacy.mcsprogram.org/filedownload.ashx/u47B2H/245222/import-3d__models-to_pdms.pdf)\n4. PDFIMPORT 3D MODELS TO PDMS - ichc2017.mcsprogram.org \u2014 Importing 3D models intoPDMSis a critical skill for modern plant designers seeking to leverage external CAD data for comprehensive, accurate, and efficient plant modeling. By understanding the compatibility considerations, preparing models appropriately, following a systematicimportprocess, and troubleshooting effectively, engineers can significantly improve project quality and turnaround ... (https://www.ichc2017.mcsprogram.org/filedownload.ashx/u47B2H/245222/import-3d-models__to_pdms.pdf)\n5. Importing PDMS/E3D/Smart 3D Data - Bentley Systems \u2014 Open Data Acquisition. The Data Acquisition service opens. Click NewImport, and then select 3D Connectors. TheImportDetails page appears. The Information tab is activated for creation of the newimport, and the Log tab displays logfilesforimportedfiles. From the Type list, selectPDMS/E3D/Smart 3D. With Sharedfile/folder selected, you can specify in the Schedule section an automatic ... (https://docs.bentley.com/LiveContent/web/PlantSight%20Enterprise%20Help-v1/en/GUID-89A26DE8-6868-447E-995C-C72C39D9D987.html)"}
31
- {"ts": 1792062087.812921, "user": "Can you search the web for PDMS PDT file import?", "assistant": "Here are live web results:\n1. To Create Imports for PDMS/S3D - Bentley Systems \u2014 Thewizard advances to the Mapping step. AsPDMS/S3D doesn't require any mappingfile,youcanskip the Mapping step. Tip: For non-OpenPlant schemaimports,youcanuse the mappingfileto create functional data by using the EC-SQL Query configuration. See Mapping.jason Configuration. Click Next. In theImportName field, enter a name. (https://docs.bentley.com/LiveContent/web/PlantSight%20Enterprise%20Help-v1/en/GUID-53FA37DF-CF72-4F1E-B04F-87740C9D3578.html)\n2. To Create Imports for PDMS/S3D - docs.bentley.com \u2014 Thewizard advances to the Mapping step. AsPDMS/S3D doesn't require any mappingfile,youcanskip the Mapping step. Tip: For non-OpenPlant schemaimports,youcanuse the mappingfileto create functional data by using the EC-SQL Query configuration. See Mapping.jason Configuration. Click Next. In theImportName field, enter a name. (https://docs.bentley.com/LiveContent/web/PlantSight%20PS3-vLatest/Help/en/topics/2821533/GUID-53FA37DF-CF72-4F1E-B04F-87740C9D3578.html)\n3. Import using PML - help.aveva.com \u2014 It is possible toimportP&IDs in non-graphics (tty) mode using PML. This enables batch scripts to executeimportswithout user interaction. For example: 1. Create a folder called TestImport in yourPDMS(or Marine) installation folder. 2. (https://help.aveva.com/AVEVA_Diagrams/14.1.4/SCHMM/SCHMM11.12.17.html)\n4. PDMS V11.6 Data Import Instructions | PDF | Text File - Scribd \u2014 1. The document provides instructions for importing different types of data intoPDMSV11.6 using various modules: 2. Data is imported using modules LEXICON, PROPCON, PARAGON, and SPECON throughimportfilesthat create and populate worlds with attributes, properties, templates, and specifications. 3. It describes starting each module, navigating to the correct database, running theimport... (https://www.scribd.com/document/332512363/WorkingInstruction-Complete-Data-Import-PDMS-V116-20130724)\n5. Import PDMS data - Intergraph Smart 3D - Help \u2014 What do you want to do?ImportPDMSdata Validate mapping details for importing Add thePDMSinterfaces to the catalog (https://docs.hexagonali.com/r/en-US/Intergraph-Smart-3D-Common/14/1004511)"}
32
- {"ts": 1792062125.5431235, "user": "How to import a PDT file into PDMS?", "assistant": "This article provides a detailed, step-by-step guide to importing 3D models intoPDMS, discusses common challenges and solutions, and offers tips to optimize your workflow for better accuracy and productivity. (source: PDFimport 3d models to pdms - staging.friends-library.org)"}
33
- {"ts": 1792062154.4077501, "user": "Tell me a short joke.", "assistant": "Here\u2019s a fun one-liner I found on the web:\n\nWhy don\u2019t scientists trust atoms?\n\nBecause they make up everything! \n\nThis is a classic short, easy-to-memorize joke suitable for all audiences. Enjoy sharing it!"}
34
- {"ts": 1792065110.0476015, "user": "what have you learned", "assistant": "I've learned from you and my training sources: 33 conversation exchanges (latest: 'Tell me a short joke.'); learned topics: base text model (WikiText-2), conversation memory, dictionary words (145), dictionary words (147), dictionary words (146), dictionary words (145), dictionary words (145), web: transformer architecture."}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
memory/learned_topics.json CHANGED
@@ -1,6 +1 @@
1
- [
2
- "base text model (WikiText-2)",
3
- "conversation memory",
4
- "dictionary words",
5
- "web: transformer architecture"
6
- ]
 
1
+ []
 
 
 
 
 
memory/tools/registry.json DELETED
@@ -1,7 +0,0 @@
1
- [
2
- {
3
- "name": "reverse_a_string",
4
- "description": "reverse a string",
5
- "code": "def run(input_text):\n return input_text[::-1]"
6
- }
7
- ]