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
@@ -0,0 +1,81 @@
1
+
2
+ import sys
3
+ import os
4
+ import platform
5
+ import shutil
6
+
7
+ def enable_autostart():
8
+ app_name = "NeuroShardNode"
9
+
10
+ if sys.platform == "win32":
11
+ import winreg
12
+ key_path = r"Software\Microsoft\Windows\CurrentVersion\Run"
13
+ try:
14
+ key = winreg.OpenKey(winreg.HKEY_CURRENT_USER, key_path, 0, winreg.KEY_SET_VALUE)
15
+ winreg.SetValueEx(key, app_name, 0, winreg.REG_SZ, sys.executable)
16
+ winreg.CloseKey(key)
17
+ return True
18
+ except Exception as e:
19
+ print(f"Autostart failed: {e}")
20
+ return False
21
+
22
+ elif sys.platform == "linux":
23
+ # Create ~/.config/autostart/neuroshard.desktop
24
+ desktop_file = f"""[Desktop Entry]
25
+ Type=Application
26
+ Name={app_name}
27
+ Exec={sys.executable}
28
+ Hidden=false
29
+ NoDisplay=false
30
+ X-GNOME-Autostart-enabled=true
31
+ """
32
+ path = os.path.expanduser(f"~/.config/autostart/{app_name.lower()}.desktop")
33
+ os.makedirs(os.path.dirname(path), exist_ok=True)
34
+ with open(path, "w") as f:
35
+ f.write(desktop_file)
36
+ return True
37
+
38
+ elif sys.platform == "darwin": # macOS
39
+ # Use LaunchAgent
40
+ plist = f"""<?xml version="1.0" encoding="UTF-8"?>
41
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
42
+ <plist version="1.0">
43
+ <dict>
44
+ <key>Label</key>
45
+ <string>com.neuroshard.node</string>
46
+ <key>ProgramArguments</key>
47
+ <array>
48
+ <string>{sys.executable}</string>
49
+ </array>
50
+ <key>RunAtLoad</key>
51
+ <true/>
52
+ </dict>
53
+ </plist>
54
+ """
55
+ path = os.path.expanduser("~/Library/LaunchAgents/com.neuroshard.node.plist")
56
+ with open(path, "w") as f:
57
+ f.write(plist)
58
+ return True
59
+
60
+ def disable_autostart():
61
+ app_name = "NeuroShardNode"
62
+
63
+ if sys.platform == "win32":
64
+ import winreg
65
+ key_path = r"Software\Microsoft\Windows\CurrentVersion\Run"
66
+ try:
67
+ key = winreg.OpenKey(winreg.HKEY_CURRENT_USER, key_path, 0, winreg.KEY_SET_VALUE)
68
+ winreg.DeleteValue(key, app_name)
69
+ winreg.CloseKey(key)
70
+ except: pass
71
+
72
+ elif sys.platform == "linux":
73
+ path = os.path.expanduser(f"~/.config/autostart/{app_name.lower()}.desktop")
74
+ if os.path.exists(path):
75
+ os.remove(path)
76
+
77
+ elif sys.platform == "darwin":
78
+ path = os.path.expanduser("~/Library/LaunchAgents/com.neuroshard.node.plist")
79
+ if os.path.exists(path):
80
+ os.remove(path)
81
+
@@ -0,0 +1,121 @@
1
+
2
+ import torch
3
+ import psutil
4
+ import platform
5
+ import hashlib
6
+ import uuid
7
+ import os
8
+ import socket
9
+
10
+
11
+ def get_machine_id() -> str:
12
+ """
13
+ Get a unique identifier for this machine.
14
+
15
+ Uses multiple sources to create a stable, unique ID:
16
+ 1. Machine UUID (from DMI/SMBIOS on Linux, IOKit on macOS)
17
+ 2. Hostname (fallback)
18
+ 3. MAC address (fallback)
19
+
20
+ This ID is stable across reboots but unique per machine.
21
+ """
22
+ machine_id_sources = []
23
+
24
+ # Try to get machine-id (Linux)
25
+ for path in ['/etc/machine-id', '/var/lib/dbus/machine-id']:
26
+ try:
27
+ if os.path.exists(path):
28
+ with open(path, 'r') as f:
29
+ machine_id_sources.append(f.read().strip())
30
+ break
31
+ except Exception:
32
+ pass
33
+
34
+ # Try hostname
35
+ try:
36
+ machine_id_sources.append(socket.gethostname())
37
+ except Exception:
38
+ pass
39
+
40
+ # Try MAC address (via uuid.getnode)
41
+ try:
42
+ mac = uuid.getnode()
43
+ if mac != uuid.getnode(): # Check it's not a random fallback
44
+ machine_id_sources.append(str(mac))
45
+ except Exception:
46
+ pass
47
+
48
+ # Combine all sources
49
+ if machine_id_sources:
50
+ combined = ":".join(machine_id_sources)
51
+ return hashlib.sha256(combined.encode()).hexdigest()[:16]
52
+
53
+ # Ultimate fallback: generate and cache a random ID
54
+ cache_dir = os.path.join(os.path.expanduser("~"), ".neuroshard")
55
+ os.makedirs(cache_dir, exist_ok=True)
56
+ machine_id_file = os.path.join(cache_dir, ".machine_id")
57
+
58
+ if os.path.exists(machine_id_file):
59
+ with open(machine_id_file, 'r') as f:
60
+ return f.read().strip()
61
+
62
+ random_id = uuid.uuid4().hex[:16]
63
+ with open(machine_id_file, 'w') as f:
64
+ f.write(random_id)
65
+ return random_id
66
+
67
+
68
+ def get_instance_id(port: int) -> str:
69
+ """
70
+ Generate a unique instance ID for this node.
71
+
72
+ Combines machine_id + port to create a stable, unique identifier.
73
+ This allows multiple nodes on the same machine (different ports)
74
+ or the same port on different machines to have unique identities.
75
+
76
+ Args:
77
+ port: The port this node is running on
78
+
79
+ Returns:
80
+ 16-character hex string unique to this machine+port combination
81
+ """
82
+ machine_id = get_machine_id()
83
+ instance_string = f"{machine_id}:{port}"
84
+ return hashlib.sha256(instance_string.encode()).hexdigest()[:16]
85
+
86
+
87
+ def get_hardware_info():
88
+ info = {
89
+ "system": platform.system(),
90
+ "cpu_cores": psutil.cpu_count(logical=False),
91
+ "ram_gb": round(psutil.virtual_memory().total / (1024**3), 2),
92
+ "gpu_available": torch.cuda.is_available(),
93
+ "gpu_name": "None",
94
+ "vram_gb": 0.0,
95
+ "device": "cpu"
96
+ }
97
+
98
+ if info["gpu_available"]:
99
+ info["gpu_name"] = torch.cuda.get_device_name(0)
100
+ info["vram_gb"] = round(torch.cuda.get_device_properties(0).total_memory / (1024**3), 2)
101
+ info["device"] = "cuda"
102
+
103
+ return info
104
+
105
+ def suggest_config(info):
106
+ """Recommend layers based on hardware."""
107
+ # Heuristic: 124M params needs ~500MB RAM.
108
+ # We can fit full model on almost any modern PC.
109
+ # But let's split it to demonstrate sharding.
110
+
111
+ layers_per_node = 4 # Default shard size
112
+
113
+ if info["vram_gb"] > 4 or (info["ram_gb"] > 8 and not info["gpu_available"]):
114
+ # Powerful node, can host more
115
+ layers_per_node = 6
116
+
117
+ return {
118
+ "suggested_layers": f"0-{layers_per_node}",
119
+ "device": info["device"]
120
+ }
121
+
@@ -0,0 +1,90 @@
1
+
2
+ import io
3
+ import base64
4
+ import torch
5
+ import zlib
6
+ from safetensors.torch import save, load
7
+
8
+ def serialize_tensor(tensor_or_dict, use_quantization: bool = True) -> str:
9
+ """
10
+ Serialize a PyTorch tensor (or dict of tensors) to a compressed, base64 encoded string
11
+ using SAFETENSORS for security (no pickle/RCE).
12
+ """
13
+ # If input is a single tensor, wrap it in a dict
14
+ if isinstance(tensor_or_dict, torch.Tensor):
15
+ data_dict = {"data": tensor_or_dict}
16
+ elif isinstance(tensor_or_dict, dict):
17
+ data_dict = tensor_or_dict
18
+ else:
19
+ raise ValueError("Input must be a Tensor or a Dict of Tensors")
20
+
21
+ # Ensure all values are tensors (safetensors requirement)
22
+ # If we are doing quantization logic, we need to handle it before saving
23
+
24
+ final_dict = {}
25
+
26
+ # Quantization Logic
27
+ if isinstance(tensor_or_dict, torch.Tensor) and use_quantization and tensor_or_dict.dtype in [torch.float32, torch.float16]:
28
+ # Symmetric Quantization to INT8
29
+ max_val = tensor_or_dict.abs().max()
30
+ scale = max_val / 127.0 if max_val > 0 else torch.tensor(1.0, device=tensor_or_dict.device)
31
+ quantized = (tensor_or_dict / scale).round().to(torch.int8)
32
+
33
+ # Safetensors only stores tensors, so we store scale as a 0-d tensor
34
+ final_dict["t"] = quantized
35
+ final_dict["s"] = scale.view(1) # 0-d to 1-d for safety sometimes
36
+ final_dict["q"] = torch.tensor([1], dtype=torch.int8) # Flag
37
+ elif isinstance(tensor_or_dict, torch.Tensor):
38
+ final_dict["data"] = tensor_or_dict
39
+ else:
40
+ # It's already a dict (e.g. state_dict)
41
+ final_dict = data_dict
42
+
43
+ # Serialize with Safetensors
44
+ # Safetensors returns bytes directly
45
+ try:
46
+ safetensors_bytes = save(final_dict)
47
+ except Exception as e:
48
+ print(f"Safetensors save error: {e}")
49
+ # Fallback or re-raise. Safetensors might fail on some dtypes or non-contiguous.
50
+ # Ensure contiguous
51
+ final_dict = {k: v.contiguous() for k, v in final_dict.items()}
52
+ safetensors_bytes = save(final_dict)
53
+
54
+ # Compress
55
+ compressed_data = zlib.compress(safetensors_bytes)
56
+
57
+ return base64.b64encode(compressed_data).decode('utf-8')
58
+
59
+ def deserialize_tensor(data: str) -> torch.Tensor:
60
+ """
61
+ Deserialize a base64 encoded string back to a PyTorch tensor using SAFETENSORS.
62
+ Secure against RCE.
63
+ """
64
+ try:
65
+ decoded_data = base64.b64decode(data)
66
+ try:
67
+ decompressed_data = zlib.decompress(decoded_data)
68
+ except zlib.error:
69
+ decompressed_data = decoded_data
70
+
71
+ # Load from bytes
72
+ loaded_dict = load(decompressed_data)
73
+
74
+ # Check if it was our quantized format
75
+ if "q" in loaded_dict and "t" in loaded_dict:
76
+ quantized = loaded_dict["t"]
77
+ scale = loaded_dict["s"]
78
+ # Dequantize
79
+ return quantized.to(torch.float32) * scale.item()
80
+
81
+ # Check if it was a single tensor wrapper
82
+ if "data" in loaded_dict and len(loaded_dict) == 1:
83
+ return loaded_dict["data"]
84
+
85
+ # Otherwise return the full dict (e.g. for weights)
86
+ return loaded_dict
87
+
88
+ except Exception as e:
89
+ print(f"Error deserializing tensor (Security or Format): {e}")
90
+ raise e
neuroshard/version.py ADDED
@@ -0,0 +1 @@
1
+ __version__ = "0.0.111"
@@ -0,0 +1,283 @@
1
+ Metadata-Version: 2.4
2
+ Name: nexaroa
3
+ Version: 0.0.111
4
+ Summary: Decentralized AI Network
5
+ Author-email: NeuroShard Team <team@neuroshard.com>
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://neuroshard.com
8
+ Project-URL: Documentation, https://docs.neuroshard.com
9
+ Project-URL: Repository, https://github.com/Nexaroa/neuroshard
10
+ Project-URL: Issues, https://github.com/Nexaroa/neuroshard/issues
11
+ Keywords: ai,machine-learning,distributed-computing,blockchain,llm,neural-network,decentralized,training
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Intended Audience :: Science/Research
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.9
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
22
+ Classifier: Topic :: System :: Distributed Computing
23
+ Requires-Python: >=3.9
24
+ Description-Content-Type: text/markdown
25
+ License-File: LICENSE
26
+ Requires-Dist: transformers>=4.30.0
27
+ Requires-Dist: fastapi>=0.100.0
28
+ Requires-Dist: uvicorn>=0.23.0
29
+ Requires-Dist: requests>=2.28.0
30
+ Requires-Dist: pydantic>=2.0.0
31
+ Requires-Dist: psutil>=5.9.0
32
+ Requires-Dist: grpcio>=1.50.0
33
+ Requires-Dist: protobuf>=4.21.0
34
+ Requires-Dist: safetensors>=0.3.0
35
+ Requires-Dist: cryptography>=41.0.0
36
+ Requires-Dist: mnemonic>=0.20
37
+ Requires-Dist: jinja2>=3.1.0
38
+ Provides-Extra: gpu
39
+ Requires-Dist: torch>=2.0.0; extra == "gpu"
40
+ Provides-Extra: gui
41
+ Requires-Dist: customtkinter>=5.2.0; extra == "gui"
42
+ Requires-Dist: Pillow>=9.0.0; extra == "gui"
43
+ Requires-Dist: pystray>=0.19.0; extra == "gui"
44
+ Provides-Extra: full
45
+ Requires-Dist: torch>=2.0.0; extra == "full"
46
+ Requires-Dist: customtkinter>=5.2.0; extra == "full"
47
+ Requires-Dist: Pillow>=9.0.0; extra == "full"
48
+ Requires-Dist: pystray>=0.19.0; extra == "full"
49
+ Provides-Extra: dev
50
+ Requires-Dist: pytest>=7.0.0; extra == "dev"
51
+ Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
52
+ Requires-Dist: black>=23.0.0; extra == "dev"
53
+ Requires-Dist: ruff>=0.0.280; extra == "dev"
54
+ Requires-Dist: torch>=2.0.0; extra == "dev"
55
+ Dynamic: license-file
56
+
57
+ <p align="center">
58
+ <img src="assets/logo.png" alt="NeuroShard Logo" width="120" height="120">
59
+ </p>
60
+
61
+ <h1 align="center">NeuroShard</h1>
62
+
63
+ <p align="center">
64
+ <strong>Decentralized LLM Training Network</strong>
65
+ </p>
66
+
67
+ <p align="center">
68
+ <a href="https://pypi.org/project/neuroshard/"><img src="https://badge.fury.io/py/neuroshard.svg" alt="PyPI version"></a>
69
+ <a href="https://www.python.org/downloads/"><img src="https://img.shields.io/badge/python-3.9+-blue.svg" alt="Python 3.9+"></a>
70
+ <a href="https://github.com/Nexaroa/neuroshard/blob/main/LICENSE"><img src="https://img.shields.io/badge/License-Apache%202.0-blue.svg" alt="License: Apache 2.0"></a>
71
+ <a href="https://discord.gg/4R49xpj7vn"><img src="https://img.shields.io/discord/1234567890?color=7289da&label=Discord&logo=discord&logoColor=white" alt="Discord"></a>
72
+ </p>
73
+
74
+ <p align="center">
75
+ <a href="https://neuroshard.com">Website</a> •
76
+ <a href="https://docs.neuroshard.com">Documentation</a> •
77
+ <a href="docs/whitepaper/neuroshard_whitepaper.pdf">Whitepaper</a> •
78
+ <a href="https://discord.gg/4R49xpj7vn">Discord</a> •
79
+ <a href="https://x.com/shardneuro">Twitter</a>
80
+ </p>
81
+
82
+ ---
83
+
84
+ ## What is NeuroShard?
85
+
86
+ NeuroShard is a **decentralized network** for training large language models. Anyone can contribute GPU/CPU power and earn **NEURO tokens** through Proof of Neural Work.
87
+
88
+ Unlike centralized AI companies, NeuroShard distributes both the compute AND the rewards across all participants.
89
+
90
+ ### Key Features
91
+
92
+ | Feature | Description |
93
+ |---------|-------------|
94
+ | **DiLoCo Training** | Distributed Low-Communication training - sync every 500 steps, not every step |
95
+ | **Byzantine Tolerance** | Robust gradient aggregation (Krum, Trimmed Mean) handles malicious nodes |
96
+ | **NEURO Rewards** | Earn tokens for contributing compute via Proof of Neural Work |
97
+ | **Cryptographic Proofs** | ECDSA-signed proofs ensure trustless verification |
98
+ | **Web Dashboard** | Real-time monitoring at `http://localhost:8000` |
99
+ | **P2P Network** | Decentralized peer discovery and gossip protocol |
100
+
101
+ ---
102
+
103
+ ## Quick Start
104
+
105
+ ### Installation
106
+
107
+ ```bash
108
+ pip install neuroshard
109
+ ```
110
+
111
+ ### Run a Node
112
+
113
+ ```bash
114
+ # Get your token from neuroshard.com
115
+ neuroshard --token YOUR_TOKEN
116
+ ```
117
+
118
+ That's it! Your node will:
119
+ 1. Connect to the network
120
+ 2. Start training model layers
121
+ 3. Earn NEURO for your contribution
122
+
123
+ ### Web Dashboard
124
+
125
+ Open `http://localhost:8000` to see:
126
+ - Node status and role
127
+ - Training progress (DiLoCo inner/outer steps)
128
+ - NEURO balance
129
+ - Network statistics
130
+
131
+ ---
132
+
133
+ ## System Requirements
134
+
135
+ | Component | Minimum | Recommended |
136
+ |-----------|---------|-------------|
137
+ | **RAM** | 4 GB | 8+ GB |
138
+ | **Python** | 3.9+ | 3.10+ |
139
+ | **GPU** | Optional | NVIDIA 8GB+ VRAM |
140
+
141
+ ### GPU Support (Optional)
142
+
143
+ For NVIDIA GPUs with CUDA:
144
+
145
+ ```bash
146
+ pip install torch --index-url https://download.pytorch.org/whl/cu118
147
+ ```
148
+
149
+ ---
150
+
151
+ ## How It Works
152
+
153
+ ### DiLoCo Distributed Training
154
+
155
+ NeuroShard uses [DiLoCo](https://arxiv.org/abs/2311.08105) (Distributed Low-Communication) for efficient distributed training:
156
+
157
+ ```
158
+ ┌─────────────────────────────────────────────────┐
159
+ │ INNER LOOP (500 steps - no communication) │
160
+ │ • Each node trains independently │
161
+ │ • Local AdamW optimization │
162
+ └─────────────────────────────────────────────────┘
163
+
164
+ ┌─────────────────────────────────────────────────┐
165
+ │ OUTER LOOP (sync with peers) │
166
+ │ • Compute pseudo-gradient: Δθ = θ₀ - θ₅₀₀ │
167
+ │ • Gossip to peers │
168
+ │ • Byzantine-tolerant aggregation │
169
+ │ • Nesterov momentum update │
170
+ └─────────────────────────────────────────────────┘
171
+
172
+ (Repeat)
173
+ ```
174
+
175
+ This reduces network communication by **500x** compared to synchronous training!
176
+
177
+ ### Proof of Neural Work
178
+
179
+ Nodes earn NEURO by submitting cryptographically signed proofs of their work:
180
+
181
+ - Training batches processed
182
+ - Inference requests served
183
+ - Uptime contribution
184
+ - Data samples provided
185
+
186
+ All proofs are verified using ECDSA signatures (secp256k1).
187
+
188
+ ---
189
+
190
+ ## Configuration
191
+
192
+ ### CLI Options
193
+
194
+ ```bash
195
+ neuroshard --token YOUR_TOKEN \
196
+ --port 8000 \
197
+ --tracker https://tracker.neuroshard.com \
198
+ --training \
199
+ --diloco-steps 500
200
+ ```
201
+
202
+ | Option | Default | Description |
203
+ |--------|---------|-------------|
204
+ | `--token` | Required | Your node authentication token |
205
+ | `--port` | 8000 | HTTP server port |
206
+ | `--tracker` | Auto | Tracker server URL |
207
+ | `--training` | False | Enable training mode |
208
+ | `--diloco-steps` | 500 | Inner steps before sync |
209
+
210
+ See [full CLI reference](https://docs.neuroshard.com/guide/cli-reference) for all options.
211
+
212
+ ---
213
+
214
+ ## Architecture
215
+
216
+ ```
217
+ ┌─────────────────────────────────────────────────────────────┐
218
+ │ NeuroShard Node │
219
+ ├─────────────────────────────────────────────────────────────┤
220
+ │ ┌─────────────┐ ┌─────────────┐ ┌─────────────────────┐ │
221
+ │ │ NeuroLLM │ │ DiLoCo │ │ Proof of Neural │ │
222
+ │ │ (Model) │ │ Trainer │ │ Work Ledger │ │
223
+ │ └─────────────┘ └─────────────┘ └─────────────────────┘ │
224
+ │ ┌─────────────┐ ┌─────────────┐ ┌─────────────────────┐ │
225
+ │ │ P2P/DHT │ │ Gradient │ │ ECDSA Crypto │ │
226
+ │ │ Network │ │ Aggregator │ │ (secp256k1) │ │
227
+ │ └─────────────┘ └─────────────┘ └─────────────────────┘ │
228
+ └─────────────────────────────────────────────────────────────┘
229
+ ```
230
+
231
+ ---
232
+
233
+ ## Documentation
234
+
235
+ - **[Whitepaper](docs/whitepaper/neuroshard_whitepaper.pdf)** - Technical whitepaper (PDF)
236
+ - **[Getting Started](https://docs.neuroshard.com/guide/quick-start)** - First steps
237
+ - **[Running a Node](https://docs.neuroshard.com/guide/running-a-node)** - Detailed setup
238
+ - **[Architecture](https://docs.neuroshard.com/architecture/overview)** - System design
239
+ - **[Economics](https://docs.neuroshard.com/economics/overview)** - NEURO tokenomics
240
+ - **[API Reference](https://docs.neuroshard.com/api/overview)** - SDK & endpoints
241
+
242
+ ---
243
+
244
+ ## Links
245
+
246
+ | Resource | Link |
247
+ |----------|------|
248
+ | Website | [neuroshard.com](https://neuroshard.com) |
249
+ | Documentation | [docs.neuroshard.com](https://docs.neuroshard.com) |
250
+ | Whitepaper | [PDF](docs/whitepaper/neuroshard_whitepaper.pdf) |
251
+ | Discord | [discord.gg/4R49xpj7vn](https://discord.gg/4R49xpj7vn) |
252
+ | Twitter | [@shardneuro](https://x.com/shardneuro) |
253
+ | PyPI | [pypi.org/project/neuroshard](https://pypi.org/project/neuroshard/) |
254
+
255
+ ---
256
+
257
+ ## Contributing
258
+
259
+ We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details.
260
+
261
+ ```bash
262
+ # Clone the repo
263
+ git clone https://github.com/Nexaroa/neuroshard.git
264
+ cd neuroshard
265
+
266
+ # Install dev dependencies
267
+ pip install -e ".[dev]"
268
+
269
+ # Run tests
270
+ pytest
271
+ ```
272
+
273
+ ---
274
+
275
+ ## License
276
+
277
+ Apache License 2.0 - see [LICENSE](LICENSE) for details.
278
+
279
+ ---
280
+
281
+ <p align="center">
282
+ <strong>Train AI. Earn NEURO. Own the Network.</strong>
283
+ </p>
@@ -0,0 +1,78 @@
1
+ neuroshard/__init__.py,sha256=hs1z2vrdHRUffNx_HIIR8WBz0E6sfUzWhTyiwNl68WU,1816
2
+ neuroshard/__main__.py,sha256=UERfOw_HxzNQjocDj11CqtPuc3Omu1Z7lzg0JrwKSrc,75
3
+ neuroshard/cli.py,sha256=aM0kA_HdE1C2cac0SezBJunlqWnD9KF-KUTvU4pXKz4,15305
4
+ neuroshard/governance_cli.py,sha256=nfndsuTTHKtPVOrMdJ5lAqwfphyPrdXm7aDi-2ZQX5w,23748
5
+ neuroshard/grpc_server.py,sha256=CMgqI0rsGmnFuC0TWoplAIE-d_kWNLsM_SwAcIU1j2A,38039
6
+ neuroshard/runner.py,sha256=b04QnVbuEdzwGez2EtiVyRebfor60ldTJtQ7sjR11PY,127617
7
+ neuroshard/version.py,sha256=BtvlzlO7UNG5nD9ftqoP0J2wHDhVCXpzuMsjYBw0Wfg,24
8
+ neuroshard/core/__init__.py,sha256=ceGh-I4x0xpq7N_3agYX2Yml3BAOQ5e6ihAMVqpjMcs,3685
9
+ neuroshard/core/consensus/verifier.py,sha256=amxkvY42lEHUBOGsGPIT7XXup8_jQ1j2M2TxD7SdKZo,10216
10
+ neuroshard/core/crypto/__init__.py,sha256=V3i6sTOPwtpD5DOCWBzqErzZ-c3aSgwUV_u-p5ROi6A,574
11
+ neuroshard/core/crypto/ecdsa.py,sha256=ra8VNiFxNbigs4Zi4zec3_-Jvafe4tgw7OXpPMRk4EA,12037
12
+ neuroshard/core/economics/__init__.py,sha256=aUgA4H8_NKF06enGOTGJu5L8OKlj5jsgfjDjWoxWfq0,1902
13
+ neuroshard/core/economics/constants.py,sha256=KkyzFhXNNwDPVRgRi88LvnfDzzJc9FlMBF6gHKijTHw,19415
14
+ neuroshard/core/economics/ledger.py,sha256=KBfrYpxpvg7Q6PcUokoV0u34iaISll6egDPk7F-FQXk,87395
15
+ neuroshard/core/economics/market.py,sha256=Ia9cFAavqRk1AlljYtvkpRp-AvHlvZHBWEl6Z9RaL1c,39261
16
+ neuroshard/core/economics/wallet.py,sha256=MrUFUsCHbXt9ejWm03oeddvvC8fzKrvQKbIQ_J0Rlfk,5125
17
+ neuroshard/core/governance/__init__.py,sha256=TaVWlJEcFNb7hJyZGy74xjw-vpHCLn6FuTzOeeVJ_Gk,1813
18
+ neuroshard/core/governance/proposal.py,sha256=mLM3B1ZpnV6EiPRtYnVIv_asYWH82S9_RFK7ArWStYY,19550
19
+ neuroshard/core/governance/registry.py,sha256=_eVmgmEjShB6xSiQW9xsCYDies3K2CFhfxQp6Ged9Oo,20474
20
+ neuroshard/core/governance/versioning.py,sha256=KuanpynrE8unp7XlfqnZSq_JiuRLITCxLNuHXWKOPcI,11062
21
+ neuroshard/core/governance/voting.py,sha256=kscWe3P7bxyX0mkk58ALzMqBiXSbwwwInXx7eMwAlv4,14499
22
+ neuroshard/core/model/__init__.py,sha256=ZEtJQGvLlX-89BVdtBshmwivmB78D3WmrxRNk_20KEg,758
23
+ neuroshard/core/model/dynamic.py,sha256=Wa9G-sF-lOWMzMFgj0iilKDrvlPkhxz10jMSpDhwM8Y,193625
24
+ neuroshard/core/model/llm.py,sha256=QBj6mPgO3QOY1OCWEirE6GybalhL0XHO5isOaTO9DTY,31815
25
+ neuroshard/core/model/registry.py,sha256=i7cns9m97IqlCKEAHzas31eLltV1uQzxFHAU-gywneY,5351
26
+ neuroshard/core/model/scaler.py,sha256=JTWa4BiWqIiL9TJ19MLI8yLby-6WCuPWSKLHS4AyrbQ,15561
27
+ neuroshard/core/model/tokenizer.py,sha256=8P_qiDPRwCi2BNDpXWqSpYaLop6cd-dnWFk5wIRhbV8,20786
28
+ neuroshard/core/network/__init__.py,sha256=almT0nYxro7tnsV_VEzpyFCvn5nVHPxFVJ6H_naNI4g,1926
29
+ neuroshard/core/network/connection_pool.py,sha256=Bn1ZB_Cr6B2J481-zUikifqhGQR4PWw6Y5Iyg_DpoVc,2866
30
+ neuroshard/core/network/dht.py,sha256=ubRZPOX7GbTtGQEAFsPxZzKml7eiZAkuJBIjE0vNUlQ,4262
31
+ neuroshard/core/network/dht_plan.py,sha256=ra7KQ2oJnCFmFng6DA1SXKxcZz695iaGvYOPdKzyDd0,1670
32
+ neuroshard/core/network/dht_proof_store.py,sha256=iHC1CCd3IonkPUCQkMhvE_9NgMHxjRUF1MEqzot9o88,23039
33
+ neuroshard/core/network/dht_protocol.py,sha256=IM3mILEK9YD4bkJPpHsuj5XFdWPMycWGKQDwSnHlxvM,10325
34
+ neuroshard/core/network/dht_service.py,sha256=qYn03Xf_dhQIVCssDhzdUHvBF6r-tBy1zCOT0ffG0j4,22353
35
+ neuroshard/core/network/encrypted_channel.py,sha256=E_o34WSdE4HICVMomDnw-fAaexvKCjFcGUNwo3cNiEM,4560
36
+ neuroshard/core/network/nat.py,sha256=Xv9d4pLVQGX_PtRk4qtopfr5rYH_ktY5MYVL3nZFxe0,8736
37
+ neuroshard/core/network/nat_traversal.py,sha256=zHyVFfUaEpm7cOsCLDwQMP3qUbsXNmrW4enGVUGWXQw,23083
38
+ neuroshard/core/network/p2p.py,sha256=CTXCEWZVhLDqSc3WQpHFCFtvlEoGj3zFDOK55dsIUUA,43473
39
+ neuroshard/core/network/p2p_data.py,sha256=Tg1tYWxjhMe30zwPlaDlwUozFPOvieHUUphsfuQLXWQ,5794
40
+ neuroshard/core/swarm/__init__.py,sha256=k-rS0ssUhNmzDnD-JWwh4EeIKcF-u9WxLf0d9cHQ5d8,3597
41
+ neuroshard/core/swarm/aggregation.py,sha256=60SI-Vuiqv03AcNlVUOvVDJThcaYN46rOYBlrU4PxQ8,24614
42
+ neuroshard/core/swarm/buffers.py,sha256=RT10848Q8EyUpIXRZXQHtAfNgIkq6IkyLqd41B-iOX0,21884
43
+ neuroshard/core/swarm/checkpoint.py,sha256=veOgX3TmxXKt3NronSZ8dUG6S1FAxFcPzQkMQelMBCk,24494
44
+ neuroshard/core/swarm/compute.py,sha256=FeDRTcwhS_hMM6cMjhp1Ev8zkZqLYzBqKSKiB3WaPQ4,22104
45
+ neuroshard/core/swarm/diloco.py,sha256=Oav4ZUWresvbkJsZoAC7vsLkH5Qe3JFk5nFYbf1AhTA,29307
46
+ neuroshard/core/swarm/factory.py,sha256=4knlYSThC-1SdJuHQP_rlzVQzcHVARljAtQGOCtaMng,52909
47
+ neuroshard/core/swarm/heartbeat.py,sha256=VBn7HpwmxumJF7Sf-Z5D5kFrFJe_dYkLjpoHDctrBus,24190
48
+ neuroshard/core/swarm/logger.py,sha256=Qkllfl0BtpBMRL9K72W3fkg8ylgHPmqMTfjHRXWRnug,15903
49
+ neuroshard/core/swarm/router.py,sha256=X6hHzDVyMbkLN_Cm6TyXSRZQt13YwYC72fo-8anTVxQ,23794
50
+ neuroshard/core/swarm/service.py,sha256=x9q5C1G8lPljds0ZlB-twX8IzwqwfTjW-jJJBrwbd6U,22625
51
+ neuroshard/core/training/__init__.py,sha256=h5SdG90k2smX4SiFw63UlcKIHCYXJLqJizEfzQM3bms,1186
52
+ neuroshard/core/training/checkpoint.py,sha256=wywkLTY1qktoxlI9P-B85l9CbYWTUIq52CEQIgf8vqw,20800
53
+ neuroshard/core/training/distributed.py,sha256=Oqq4jrJxRffjY3Xm8wHu3S6DMfXVKL8YtcYWkIVuUec,65683
54
+ neuroshard/core/training/global_tracker.py,sha256=BnCY9J_c6XReSysndgjncDhgnqaFuMbQNE2MyAAo3Kg,23341
55
+ neuroshard/core/training/production.py,sha256=pZoWHccZznRkvD5ZChubjqd3QviOHz8qAKdFobo9NM4,9441
56
+ neuroshard/sdk/__init__.py,sha256=qEd55d_DO4WuhgQQHuxEIB6bTlRwS-cA9lZmxRJs9GE,1844
57
+ neuroshard/sdk/client.py,sha256=VnYfSeyMFAyHVAAyAru43CUty5KKx7_sp3sAoa55wPk,34307
58
+ neuroshard/sdk/errors.py,sha256=kvHbo7Dtpb-PRRkUCCUxUr2EBLLDpOwEAhW1VGEbgyU,3309
59
+ neuroshard/sdk/types.py,sha256=A5Wq-sbyTqyFamcDnagm8itgZfyURBUu-yFSIgC6DcI,6593
60
+ neuroshard/tracker/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
61
+ neuroshard/tracker/server.py,sha256=3X2Eo_FGk34OuePodTeK22Wkf3_Pu9um-xmWodGQWlE,33031
62
+ neuroshard/ui/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
63
+ neuroshard/ui/app.py,sha256=2yq3Z3aL0lXCD75Wh_oAdoCptZPHK9jBbSNkktfGMiI,2898
64
+ neuroshard/ui/templates/index.html,sha256=hdCLGA3FDaALoa2M8WKWWeCSv5UH3Avlx6e17KrFkXc,54423
65
+ neuroshard/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
66
+ neuroshard/utils/autostart.py,sha256=dy_eGvHODhZDzgz-7tWgDJmr7V-mIT9B9XO0zps6JfE,2509
67
+ neuroshard/utils/hardware.py,sha256=VOMmk5Tc2LNx1lHWhsmcvcfC5BHnWX3z_ObK-50Y3Qw,3566
68
+ neuroshard/utils/serialization.py,sha256=rVFqLzn2EErNzXDqbOUAdd7yRFR9VIeuG1Aox3-OwKA,3389
69
+ nexaroa-0.0.111.dist-info/licenses/LICENSE,sha256=ELu7jtPExUAz8HqkYx5qleJDjBAVSC3TxEEob18Lecw,10756
70
+ protos/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
71
+ protos/neuroshard.proto,sha256=cIjQHEC8u4Ma7TIan5ZSWPd9R2jZhHgugMxXhUHZt_Y,19586
72
+ protos/neuroshard_pb2.py,sha256=pNBe4e8x35xAtXQiJ7O04Vtm2PS9cYiv0mqdIRu01NM,25741
73
+ protos/neuroshard_pb2_grpc.py,sha256=oxa3Cg3338Hyo4QJp4KONxVBM3vdxtklPQD3jcPq5G8,51472
74
+ nexaroa-0.0.111.dist-info/METADATA,sha256=be2WDFl3aKF51XuA94aVYV1sNg9ZvTMvenkDMRIKsR8,10558
75
+ nexaroa-0.0.111.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
76
+ nexaroa-0.0.111.dist-info/entry_points.txt,sha256=UpgqEOj8YhHtIaXtvoGUvH_QQNsaFtFl51yEDjhTjQ0,144
77
+ nexaroa-0.0.111.dist-info/top_level.txt,sha256=-iOU8F_mFPWif-RCEC3U2E8A_t0k0zDZxgV96W6RElo,18
78
+ nexaroa-0.0.111.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (80.9.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,4 @@
1
+ [console_scripts]
2
+ neuroshard = neuroshard.cli:main
3
+ neuroshard-governance = neuroshard.governance_cli:main
4
+ neuroshard-node = neuroshard.cli:main