nexaroa 0.0.111__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. neuroshard/__init__.py +93 -0
  2. neuroshard/__main__.py +4 -0
  3. neuroshard/cli.py +466 -0
  4. neuroshard/core/__init__.py +92 -0
  5. neuroshard/core/consensus/verifier.py +252 -0
  6. neuroshard/core/crypto/__init__.py +20 -0
  7. neuroshard/core/crypto/ecdsa.py +392 -0
  8. neuroshard/core/economics/__init__.py +52 -0
  9. neuroshard/core/economics/constants.py +387 -0
  10. neuroshard/core/economics/ledger.py +2111 -0
  11. neuroshard/core/economics/market.py +975 -0
  12. neuroshard/core/economics/wallet.py +168 -0
  13. neuroshard/core/governance/__init__.py +74 -0
  14. neuroshard/core/governance/proposal.py +561 -0
  15. neuroshard/core/governance/registry.py +545 -0
  16. neuroshard/core/governance/versioning.py +332 -0
  17. neuroshard/core/governance/voting.py +453 -0
  18. neuroshard/core/model/__init__.py +30 -0
  19. neuroshard/core/model/dynamic.py +4186 -0
  20. neuroshard/core/model/llm.py +905 -0
  21. neuroshard/core/model/registry.py +164 -0
  22. neuroshard/core/model/scaler.py +387 -0
  23. neuroshard/core/model/tokenizer.py +568 -0
  24. neuroshard/core/network/__init__.py +56 -0
  25. neuroshard/core/network/connection_pool.py +72 -0
  26. neuroshard/core/network/dht.py +130 -0
  27. neuroshard/core/network/dht_plan.py +55 -0
  28. neuroshard/core/network/dht_proof_store.py +516 -0
  29. neuroshard/core/network/dht_protocol.py +261 -0
  30. neuroshard/core/network/dht_service.py +506 -0
  31. neuroshard/core/network/encrypted_channel.py +141 -0
  32. neuroshard/core/network/nat.py +201 -0
  33. neuroshard/core/network/nat_traversal.py +695 -0
  34. neuroshard/core/network/p2p.py +929 -0
  35. neuroshard/core/network/p2p_data.py +150 -0
  36. neuroshard/core/swarm/__init__.py +106 -0
  37. neuroshard/core/swarm/aggregation.py +729 -0
  38. neuroshard/core/swarm/buffers.py +643 -0
  39. neuroshard/core/swarm/checkpoint.py +709 -0
  40. neuroshard/core/swarm/compute.py +624 -0
  41. neuroshard/core/swarm/diloco.py +844 -0
  42. neuroshard/core/swarm/factory.py +1288 -0
  43. neuroshard/core/swarm/heartbeat.py +669 -0
  44. neuroshard/core/swarm/logger.py +487 -0
  45. neuroshard/core/swarm/router.py +658 -0
  46. neuroshard/core/swarm/service.py +640 -0
  47. neuroshard/core/training/__init__.py +29 -0
  48. neuroshard/core/training/checkpoint.py +600 -0
  49. neuroshard/core/training/distributed.py +1602 -0
  50. neuroshard/core/training/global_tracker.py +617 -0
  51. neuroshard/core/training/production.py +276 -0
  52. neuroshard/governance_cli.py +729 -0
  53. neuroshard/grpc_server.py +895 -0
  54. neuroshard/runner.py +3223 -0
  55. neuroshard/sdk/__init__.py +92 -0
  56. neuroshard/sdk/client.py +990 -0
  57. neuroshard/sdk/errors.py +101 -0
  58. neuroshard/sdk/types.py +282 -0
  59. neuroshard/tracker/__init__.py +0 -0
  60. neuroshard/tracker/server.py +864 -0
  61. neuroshard/ui/__init__.py +0 -0
  62. neuroshard/ui/app.py +102 -0
  63. neuroshard/ui/templates/index.html +1052 -0
  64. neuroshard/utils/__init__.py +0 -0
  65. neuroshard/utils/autostart.py +81 -0
  66. neuroshard/utils/hardware.py +121 -0
  67. neuroshard/utils/serialization.py +90 -0
  68. neuroshard/version.py +1 -0
  69. nexaroa-0.0.111.dist-info/METADATA +283 -0
  70. nexaroa-0.0.111.dist-info/RECORD +78 -0
  71. nexaroa-0.0.111.dist-info/WHEEL +5 -0
  72. nexaroa-0.0.111.dist-info/entry_points.txt +4 -0
  73. nexaroa-0.0.111.dist-info/licenses/LICENSE +190 -0
  74. nexaroa-0.0.111.dist-info/top_level.txt +2 -0
  75. protos/__init__.py +0 -0
  76. protos/neuroshard.proto +651 -0
  77. protos/neuroshard_pb2.py +160 -0
  78. protos/neuroshard_pb2_grpc.py +1298 -0
File without changes
neuroshard/ui/app.py ADDED
@@ -0,0 +1,102 @@
1
+ """
2
+ NeuroShard Web Dashboard
3
+
4
+ Modern web-based dashboard for monitoring and managing a NeuroShard node.
5
+ This replaces the need for a desktop GUI application.
6
+
7
+ Features:
8
+ - Real-time stats monitoring
9
+ - NEURO balance display
10
+ - Training progress tracking
11
+ - Log viewing with filters
12
+ - Resource limit controls
13
+ - Swarm architecture status
14
+ """
15
+
16
+ from fastapi import FastAPI
17
+ from fastapi.templating import Jinja2Templates
18
+ from fastapi.staticfiles import StaticFiles
19
+ from fastapi.requests import Request
20
+ from fastapi.responses import HTMLResponse
21
+ import os
22
+ import sys
23
+
24
+ # Shared state - updated by runner.py
25
+ STATE = {
26
+ "shard_range": "Unknown",
27
+ "peer_count": 0,
28
+ "processed_count": 0,
29
+ "training_updates": 0,
30
+ "token_count": 0,
31
+ "training_batches": 0,
32
+ "assigned_layers": [],
33
+ "has_embedding": False,
34
+ "has_lm_head": False,
35
+ "training_status": "idle",
36
+ "throttle_cpu_ratio": 1.0,
37
+ "throttle_ram_ratio": 1.0,
38
+ "throttle_effective": 1.0,
39
+ }
40
+
41
+ ui_app = FastAPI(title="NeuroShard Dashboard")
42
+
43
+
44
+ def get_template_dir():
45
+ """Get the correct template directory path."""
46
+ # When frozen with PyInstaller, files are in sys._MEIPASS
47
+ if getattr(sys, 'frozen', False):
48
+ base_path = sys._MEIPASS
49
+ template_path = os.path.join(base_path, "neuroshard", "ui", "templates")
50
+ if os.path.exists(template_path):
51
+ return template_path
52
+
53
+ # Development mode - relative to this file
54
+ this_dir = os.path.dirname(os.path.abspath(__file__))
55
+ template_path = os.path.join(this_dir, "templates")
56
+ if os.path.exists(template_path):
57
+ return template_path
58
+
59
+ # Fallback
60
+ return "neuroshard/ui/templates"
61
+
62
+
63
+ def get_static_dir():
64
+ """Get the correct static directory path."""
65
+ if getattr(sys, 'frozen', False):
66
+ base_path = sys._MEIPASS
67
+ static_path = os.path.join(base_path, "neuroshard", "ui", "static")
68
+ if os.path.exists(static_path):
69
+ return static_path
70
+
71
+ this_dir = os.path.dirname(os.path.abspath(__file__))
72
+ static_path = os.path.join(this_dir, "static")
73
+ if os.path.exists(static_path):
74
+ return static_path
75
+
76
+ return None
77
+
78
+
79
+ templates = Jinja2Templates(directory=get_template_dir())
80
+
81
+ # Mount static files if directory exists
82
+ static_dir = get_static_dir()
83
+ if static_dir and os.path.exists(static_dir):
84
+ ui_app.mount("/static", StaticFiles(directory=static_dir), name="static")
85
+
86
+
87
+ @ui_app.get("/", response_class=HTMLResponse)
88
+ async def dashboard(request: Request):
89
+ """Serve the main dashboard page."""
90
+ return templates.TemplateResponse("index.html", {"request": request})
91
+
92
+
93
+ @ui_app.get("/api/stats")
94
+ async def get_dashboard_stats():
95
+ """Get stats for the dashboard (subset of main /api/stats)."""
96
+ return STATE
97
+
98
+
99
+ @ui_app.get("/health")
100
+ async def health_check():
101
+ """Health check endpoint."""
102
+ return {"status": "ok", "dashboard": "running"}