shard-engine 1.8.1__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.
- shard_engine/__init__.py +3 -0
- shard_engine/__main__.py +3 -0
- shard_engine/cache_index.py +37 -0
- shard_engine/cli.py +1994 -0
- shard_engine/constants.py +23 -0
- shard_engine/dashboard.html +4993 -0
- shard_engine/engine.py +1518 -0
- shard_engine/engine_optimizations.json +428 -0
- shard_engine/feedback.py +942 -0
- shard_engine/fit.py +289 -0
- shard_engine/formatters.py +30 -0
- shard_engine/gguf_backend.py +769 -0
- shard_engine/hardware.py +165 -0
- shard_engine/hf_hub.py +290 -0
- shard_engine/lan.py +1613 -0
- shard_engine/main.py +32 -0
- shard_engine/model_browser.py +687 -0
- shard_engine/net_discovery.py +1145 -0
- shard_engine/net_identity.py +1072 -0
- shard_engine/net_platform_linux.py +910 -0
- shard_engine/net_platform_win.py +930 -0
- shard_engine/net_strategy.py +2169 -0
- shard_engine/net_tunnel.py +2234 -0
- shard_engine/net_wireguard.py +780 -0
- shard_engine/paths.py +173 -0
- shard_engine/process.py +231 -0
- shard_engine/server.py +2652 -0
- shard_engine/session_registry.py +105 -0
- shard_engine/settings.py +142 -0
- shard_engine/shard_bridge.py +289 -0
- shard_engine/soup_adapter.py +1202 -0
- shard_engine/storage.py +457 -0
- shard_engine/telemetry.py +43 -0
- shard_engine/training.py +1137 -0
- shard_engine/updater.py +861 -0
- shard_engine/validators.py +16 -0
- shard_engine-1.8.1.dist-info/METADATA +549 -0
- shard_engine-1.8.1.dist-info/RECORD +42 -0
- shard_engine-1.8.1.dist-info/WHEEL +5 -0
- shard_engine-1.8.1.dist-info/entry_points.txt +2 -0
- shard_engine-1.8.1.dist-info/licenses/LICENSE +17 -0
- shard_engine-1.8.1.dist-info/top_level.txt +1 -0
shard_engine/__init__.py
ADDED
shard_engine/__main__.py
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import os
|
|
2
|
+
from typing import Dict, List, Optional
|
|
3
|
+
class LocalCacheEntry:
|
|
4
|
+
def __init__(self, model_id: str, local_path: str, file_size: int, mtime: float):
|
|
5
|
+
self.model_id = model_id
|
|
6
|
+
self.local_path = local_path
|
|
7
|
+
self.file_size = file_size
|
|
8
|
+
self.mtime = mtime
|
|
9
|
+
class LocalCacheIndex:
|
|
10
|
+
def __init__(self, root_dirs: Optional[List[str]] = None):
|
|
11
|
+
self.root_dirs = root_dirs or []
|
|
12
|
+
self._entries: Dict[str, LocalCacheEntry] = {}
|
|
13
|
+
def scan(self) -> Dict[str, LocalCacheEntry]:
|
|
14
|
+
self._entries.clear()
|
|
15
|
+
for root in self.root_dirs:
|
|
16
|
+
if not os.path.isdir(root):
|
|
17
|
+
continue
|
|
18
|
+
for r, _, files in os.walk(root):
|
|
19
|
+
for f in files:
|
|
20
|
+
if f.lower().endswith((".gguf", ".safetensors", ".bin")):
|
|
21
|
+
p = os.path.join(r, f)
|
|
22
|
+
try:
|
|
23
|
+
st = os.stat(p)
|
|
24
|
+
if st.st_size > 0:
|
|
25
|
+
entry = LocalCacheEntry(model_id=f, local_path=p, file_size=st.st_size, mtime=st.st_mtime)
|
|
26
|
+
self._entries[f] = entry
|
|
27
|
+
except OSError:
|
|
28
|
+
continue
|
|
29
|
+
return self._entries
|
|
30
|
+
def get_entry(self, identifier: str) -> Optional[LocalCacheEntry]:
|
|
31
|
+
return self._entries.get(identifier)
|
|
32
|
+
def has_weights(self, identifier: str) -> bool:
|
|
33
|
+
entry = self.get_entry(identifier)
|
|
34
|
+
return entry is not None and entry.file_size > 0 and os.path.exists(entry.local_path)
|
|
35
|
+
def invalidate(self):
|
|
36
|
+
self._entries.clear()
|
|
37
|
+
__all__ = ["LocalCacheEntry", "LocalCacheIndex"]
|