Integrate Basalt telemetry and shared GPU speech runtimes
Publish the reviewed accumulated runtime, scheduler, profile, UI, native recipes and historical maintenance evidence. Includes Qwen GPU ASR correction and shared Anna/atelier ownership. Validated with 784 local tests, Python/JSON parsing and eight JavaScript syntax checks. Live GPU acceptance and full fresh-host restore limits remain documented.
This commit is contained in:
1 parent
4e404d077d
commit
c0bc5d3a1b
172 files changed
+52473
-147
No files matched your search
@@ -0,0 +1,60 @@
|
||||
# Basalt-Deck-Anbindung: lokaler Entwicklungsstand
|
||||
|
||||
## Ergebnis
|
||||
|
||||
Eigene Basalt-Laufzeit und eigener Worker, Chat-Routing hinter derselben Deck-
|
||||
API, feste öffentliche Paketquelle, Modellkatalog-/Profil-/Preset-Validierung,
|
||||
per-Slot-API-Metadaten, Laufzeitseite und Backup-/Restore-Rezept implementiert.
|
||||
Strata bleibt erhalten. Kein Produktivwechsel, Modellstart, Neustart oder
|
||||
Verschieben des bestehenden Kandidaten durch diese Entwicklungsprüfung.
|
||||
|
||||
## Tatsächliche Prüfungen
|
||||
|
||||
```sh
|
||||
PYTHONWARNINGS=ignore::ResourceWarning python -m unittest \
|
||||
test_basalt test_strata test_model_management test_dashboard_data \
|
||||
test_backup test_execution_setup test_endpoint test_chat_test \
|
||||
test_reasoning_budget -q
|
||||
```
|
||||
|
||||
Letzter Lauf: **174 Tests bestanden**, 67.487 Sekunden. Die vorherige rote
|
||||
Backup-Fixture hatte zuerst eine willkürliche statt quellabgeleitete Modell-ID,
|
||||
anschließend ein geteiltes Python-Parameterobjekt für Profil und Preset.
|
||||
Beides in der Fixture korrigiert; keine Abschwächung der Backup-Validierung.
|
||||
Der gezielte Regressionstest und der gesamte obige Satz sind grün.
|
||||
Die TTS-Logzeilen dieses Laufs gehören ausschließlich zu synthetischen lokalen
|
||||
Tests einschließlich erwarteter Fehlerfälle, nicht zu Produktiv-TTS.
|
||||
|
||||
`git diff --check` und `node --check` für `profiles-ui.js`, `strata-ui.js`,
|
||||
`dashboard-ui.js`, `studio.js` und `app.js` bestanden.
|
||||
|
||||
Echte Browser-DOM-Prüfung mit tatsächlichem Editor-JavaScript und ausdrücklich
|
||||
synthetischer isolierter API: Basalt-Paket vorausgewählt, 5080 vorgeschlagen,
|
||||
Strata → llama.cpp → Basalt umgeschaltet, zugehörige Regler geprüft, zwei
|
||||
262144-Kontext-Slots eingegeben und Speicherpayload durch die wirkliche
|
||||
Python-`chat_parameters`-Validierung geprüft. Auch Basalt-Laufzeitseite,
|
||||
Installationsknopf, Paketstatus und Profilknopf geprüft. Keine produktiven
|
||||
POSTs und keine echte Modellantwort in diesem Browser-Test.
|
||||
|
||||
## Offene Grenzen / Aktivierungssperren
|
||||
|
||||
- Noch keine Installation/Aktivierung dieses Deck-Codes auf Athena, kein
|
||||
echter Modelltest durch den neuen Worker, kein qualifizierter nativer
|
||||
Gesamtbuild mit diesem neuen Installer und kein Fresh-Host-Vollrestore.
|
||||
- Das bestehende geprüfte Paket liegt weiterhin auf der Samsung 980 PRO,
|
||||
nicht auf dem `/data`-Datenträger WD Blue SN580. Der neue Downloadweg nutzt
|
||||
den gewöhnlichen Deck-Modellkatalog. Vor Aktivierung Katalog-Mount und
|
||||
verwaltete Übernahme auf der gewünschten Samsung ausdrücklich klären;
|
||||
kein ungeprüfter Zweitdownload oder versteckter Kandidaten-Pfad.
|
||||
- Zentrale Basalt-Live-/Summen-Tokenraten sind noch nicht angebunden.
|
||||
Inhaltsfreie Slots/Properties werden angezeigt; Basalts JSON-Request-
|
||||
Historie wird nicht als Dashboard-Metrik eingesammelt. Testchat-Timings
|
||||
bleiben separat verfügbar.
|
||||
- Zunächst nur Text. TTS-/STT-Betrieb und vorhandene Projektoren nicht geändert;
|
||||
Qwen-TTS oder Vision auf GPU sind ein eigener späterer Auftrag.
|
||||
- Produktionsaktivierung einschließlich notwendigem Deck/API-Neustart und
|
||||
Modellwechsel braucht ein separates Go und nachgewiesenen normalen Drain.
|
||||
Frühere Kandidatentests sind keine dauerhafte Aktivierungsfreigabe.
|
||||
|
||||
Native Voraussetzungen, feste Quellen, Speicherpolitik, Wiederherstellung und
|
||||
Rückfall: [Basalt-Rezept](../../../deploy/BASALT_NATIVE.md).
|
||||
@@ -0,0 +1,88 @@
|
||||
# Dashboard / Athena Pulse: Basalt-Telemetrie
|
||||
|
||||
## Stand: aktiviert; API-Funktionsprüfungen bestanden, GUI-Endabnahme offen
|
||||
|
||||
Nach Michaels ausdrücklichem Go und normaler Management-Anmeldung regulär
|
||||
drainiert: API gestoppt, aktive/wartende/TTS-wartende Anfragen jeweils null,
|
||||
kein Schedulerwechsel. Overlay auf dem laufenden TTS-RAM-Fix-Image gebaut,
|
||||
vollständigen isolierten Server-Konstruktor geprüft, anschließend aktiviert.
|
||||
Produktives Image `athena-deck-standalone:basalt-telemetry`, Zustand `healthy`.
|
||||
Alle sechs App-Dateihashes sowohl im Image als auch in der kanonischen Quelle
|
||||
geprüft. Profile, Endpoint-, Audio-, CPU- und Reasoning-Einstellungen unverändert.
|
||||
|
||||
Bestehendes Basalt-Profil wieder geladen, Antwort `BEREIT` nach 22,01 Sekunden.
|
||||
Danach vier begrenzte echte synthetische Chat-Aufrufe und ein Speech-Aufruf:
|
||||
beide Slots gleichzeitig, positive Einlese-/Generierungsraten und Cache-Reuse
|
||||
beobachtet. Folgeaufruf: 13827 Cache-Token. Die echten Antwort-Timings enthalten
|
||||
positive MTP-Draft-/Akzeptanzwerte. Anna lieferte 4,08 Sekunden 24-kHz-Mono-WAV.
|
||||
Dieser Prüfungssatz dauerte 13,51 Sekunden und ist kein Benchmark.
|
||||
Evidenz auf dem NAS: `/opt/data/profiles/athena-deck/cache/scratch/telemetry-live-acceptance.json`.
|
||||
Basalt auf 5080, Vision und TTS auf 3060 durch GPU-Prozessmetadaten bestätigt.
|
||||
|
||||
**Noch offen:** Der Neustart beendet normale Management-Sitzungen; anschließender
|
||||
Dashboard-Aufruf liefert HTTP 401. Erneute normale Anmeldung für die produktive
|
||||
GUI-Prüfung und das Ablesen der globalen Queue-/MTP-/Modellstartzähler erforderlich.
|
||||
Kein erneutes Aktivierungs-Go und kein weiterer Neustart nötig. Native Mac-
|
||||
Client- und vollständige Fresh-Host-/Restore-Abnahme bleiben ebenfalls offen.
|
||||
|
||||
## Implementierung und vorausgegangene Prüfungen
|
||||
|
||||
Ursache: Der bisherige Dashboard-Pfad setzte Basalt nicht auf den gemeinsamen
|
||||
Slot-/Metrikvertrag um; deshalb fehlten Anzeigen oder zeigten scheinbare Nullen.
|
||||
Basalts ursprüngliches JSON-`/metrics` enthält Requestverlauf und ist hierfür
|
||||
keine geeignete Quelle.
|
||||
|
||||
`basalt_serve.py` ergänzt den gepinnten Upstream-Server um ein authentifiziertes,
|
||||
inhaltsfreies `/telemetry`. `basalt_telemetry.py` liefert Slot 0/1, Belegung und
|
||||
Phasen, rollierende Generierungsrate, Engine-Prefill-Mittel sowie Cache-/MTP-
|
||||
und Tokenzähler. Abschlusszähler sind vom 500-Einträge-Verlauf unabhängig.
|
||||
Modellprozess-Generationen setzen sauber zurück; gleichzeitiger Requestabschluss
|
||||
oder Prozesswechsel beim Sampling wird ohne Doppelzählung behandelt. Unbekannte
|
||||
Werte werden nicht in Nullen oder unvollständige Lebenszeitsummen umgewandelt.
|
||||
|
||||
Dashboard und bestehendes `/v1/telemetry/speed` beziehen dieselbe Projektion.
|
||||
Pulse behält seinen bisherigen Schema-1-Vertrag und Backend-Gesamtscope.
|
||||
Keine Änderung am Plugin, anderen Hermes-Profilen oder der Mac-App erforderlich.
|
||||
Das ist eine Vertragsprüfung, noch keine native Mac-Client-Endabnahme.
|
||||
|
||||
## Tatsächlich ausgeführt
|
||||
|
||||
- 48 gezielte Python-Tests bestanden:
|
||||
`python -m unittest test_basalt_telemetry test_dashboard_data test_speed_telemetry test_basalt test_tts_ram test_tts -q`.
|
||||
- `node --check dashboard-ui.js` und `git diff --check` bestanden.
|
||||
- Bestehende eigene Pulse-Tests: 5 Python- und 2 Node-Tests bestanden.
|
||||
- Echte Browser-DOM-Prüfung mit dem tatsächlichen Dashboard-JavaScript und
|
||||
**ausschließlich synthetischen Daten**: beide Slotkarten, Generierungs- und
|
||||
Einleserate, aktive/wartende Anfragen, Cache, MTP und Tokenzähler angezeigt.
|
||||
Bei anschließend fehlender Telemetrie verschwinden die vorherigen Messwerte;
|
||||
unbekannte Anfragen und Raten erscheinen als `–`, nicht als erfundene Nullen.
|
||||
- `check_telemetry_mock.py` zweimal erfolgreich gegen die tatsächlich installierte
|
||||
gepinnte Upstream-`Service`-/Handler-Implementierung ausgeführt: HTTP 401 ohne
|
||||
Anmeldung, bestehende Chatroute weiterhin funktionstüchtig, numerische Zähler
|
||||
nach synthetischer Mock-Antwort, keine Test-Promptinhalte/Zugangsschlüssel im
|
||||
Telemetrieergebnis. Kein reales Modell, keine GPU-Inferenz, kein Neustart.
|
||||
|
||||
Der letzte Test lief in der **aktuellen Deck-Containerumgebung**, mit deren
|
||||
verwalteter Basalt-Python-Umgebung und CPU-Mock. Der anfängliche Aufruf desselben
|
||||
venv direkt auf dem Host scheiterte wegen fehlender Python-3.12-Standardbibliothek.
|
||||
Das ist keine native Host-/Fresh-Debian-Abnahme. Testskript und Launcher lagen
|
||||
isoliert unter `state/basalt-runtime/tmp/deck-telemetry-test`; installierter
|
||||
App-Code und Upstream-Checkout blieben unverändert.
|
||||
|
||||
## Ursprünglicher Aktivierungsplan (Go inzwischen erteilt und umgesetzt)
|
||||
|
||||
Separates Go für Deck/API-Aktivierung, regulären nachgewiesenen Drain und
|
||||
Wiederladen des bestehenden Basalt-/Qwen-Profils erforderlich. Vorher normale
|
||||
Management-Anmeldung herstellen; die Browserprüfung zeigte die Zugangsseite,
|
||||
kein gespeicherter Vault-Login vorhanden. Keine Admin-Umgehung.
|
||||
|
||||
Vorgesehene kurze Abnahme, erst nach Freigabe: drei begrenzte synthetische
|
||||
parallele Anfragen für beide Slots und Warteschlange, ein Cache-Folgeaufruf,
|
||||
Abgleich von Einlesen/Generierung/MTP/Modellstartzählern und Pulse-Vertrag.
|
||||
Maximal 15 Minuten Modelltestbudget, keine Benchmarks oder Variantenmatrix.
|
||||
Bestehende Profile, GPU-Aufteilung, Stimmen und Endpunktfreigaben erhalten.
|
||||
Danach den tatsächlich produktiven Stand und offene Client-/Restore-Grenzen
|
||||
hier nachtragen. Git-Publikation ersetzt diese Aktivierungsfreigabe nicht.
|
||||
|
||||
Native Installation, gemeinsame App-/Launcher-Umstellung und Rückfall:
|
||||
[Basalt-Rezept](../../../deploy/BASALT_NATIVE.md).
|
||||
@@ -0,0 +1,43 @@
|
||||
#!/usr/bin/env python3
|
||||
"""NAS Hermes: four synthetic telemetry checks and one short speech check."""
|
||||
import concurrent.futures,importlib.util,io,json,threading,time,urllib.request,wave
|
||||
from pathlib import Path
|
||||
s=importlib.util.spec_from_file_location('managed_transport',Path(__file__).resolve().parent.parent/'basalt-candidate-2026-11-01/paired_transport.py');assert s and s.loader
|
||||
m=importlib.util.module_from_spec(s);s.loader.exec_module(m);KEY=m.key()
|
||||
BASE='http://192.168.1.212:8120';OUT=Path('/opt/data/profiles/athena-deck/cache/scratch/telemetry-live-acceptance.json')
|
||||
START=time.monotonic();samples=[];stop=threading.Event()
|
||||
def call(path,data=None,binary=False):
|
||||
assert time.monotonic()-START<900,'Short test budget exceeded'
|
||||
req=urllib.request.Request(BASE+path,data=json.dumps(data).encode() if data is not None else None,headers={'Authorization':'Bearer '+KEY,'Content-Type':'application/json'})
|
||||
with urllib.request.urlopen(req,timeout=180 if data is not None else 10) as r:return r.read() if binary else json.load(r)
|
||||
def poll():
|
||||
while not stop.is_set():
|
||||
try:samples.append(call('/v1/telemetry/speed'))
|
||||
except Exception as e:samples.append({'error':type(e).__name__})
|
||||
stop.wait(.15)
|
||||
def chat(messages):
|
||||
out=call('/v1/chat/completions',dict(model='flash-next-basalt',messages=messages,max_tokens=128,temperature=0,chat_template_kwargs={'enable_thinking':False}))
|
||||
assert out['choices'][0]['message'].get('content')
|
||||
return {'usage':out.get('usage'),'timings':out.get('timings')}
|
||||
def main():
|
||||
worker=threading.Thread(target=poll,daemon=True);worker.start()
|
||||
base='\n'.join(f'Datenzeile {i:04d}: alpha beta gamma delta epsilon, unveraenderte Testdaten.' for i in range(600))
|
||||
first=[{'role':'user','content':base+'\nSchreibe jetzt die Zahlen von 1 bis 300, mit Komma getrennt.'}]
|
||||
second=[{'role':'user','content':base+'\nSchreibe jetzt die Zahlen von 301 bis 600, mit Komma getrennt.'}]
|
||||
third=[{'role':'user','content':'Schreibe die Zahlen von 601 bis 900, mit Komma getrennt.'}]
|
||||
try:
|
||||
with concurrent.futures.ThreadPoolExecutor(max_workers=3) as pool:
|
||||
jobs=[pool.submit(chat,msg) for msg in (first,second,third)];results=[j.result() for j in jobs]
|
||||
follow=chat(first)
|
||||
finally:stop.set();worker.join(timeout=12)
|
||||
valid=[x for x in samples if x.get('available',True) and 'error' not in x]
|
||||
checks=dict(two_slots_observed=any(x.get('active_slots')==2 for x in valid),generation_observed=any((x.get('generation_tok_s') or 0)>0 for x in valid),prefill_observed=any((x.get('prefill_tok_s') or 0)>0 for x in valid),cache_reused=(follow.get('usage',{}).get('prompt_tokens_details',{}).get('cached_tokens') or 0)>0)
|
||||
result=dict(checks=checks,requests=results,cached_followup=follow,samples=samples,seconds=time.monotonic()-START)
|
||||
OUT.write_text(json.dumps(result,indent=2));print(json.dumps({'stage':'LLM acceptance','checks':checks,'seconds':result['seconds'],'evidence':str(OUT)}),flush=True)
|
||||
assert all(checks.values()),'One or more actual LLM telemetry checks failed'
|
||||
audio=call('/v1/audio/speech',dict(model='qwen-anna-gpu-3060',input='Anna ist bereit. Die Anzeige wurde aktualisiert.',voice='default',response_format='wav'),binary=True)
|
||||
with wave.open(io.BytesIO(audio),'rb') as w:voice=dict(rate=w.getframerate(),channels=w.getnchannels(),frames=w.getnframes(),seconds=w.getnframes()/w.getframerate())
|
||||
assert voice['rate']==24000 and voice['channels']==1 and voice['frames']>0
|
||||
result.update(tts=voice,seconds=time.monotonic()-START);OUT.write_text(json.dumps(result,indent=2));assert json.loads(OUT.read_text())['tts']==voice
|
||||
print(json.dumps({'stage':'Anna API passed','voice':voice,'total_seconds':result['seconds']}),flush=True)
|
||||
if __name__=='__main__':main()
|
||||
@@ -0,0 +1,122 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Athena host: exact app overlay + drained activation using validated Profiles.save.
|
||||
Requires separate Michael Go and prior normal authenticated GUI drain.
|
||||
"""
|
||||
import argparse
|
||||
import hashlib
|
||||
import importlib.util
|
||||
import json
|
||||
import os
|
||||
from pathlib import Path
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
import time
|
||||
|
||||
ROOT=Path('/opt/athena-deck-dev/basalt-deck-activation')
|
||||
BASE=Path('/opt/athena-deck-dev/runtime')
|
||||
STATE=BASE/'state'
|
||||
CANON=Path('/opt/athena-deck-dev/source')
|
||||
TARGET='0c25bfe00240414397c41a980ecbe4f0'
|
||||
SETTINGS=('profiles.json','endpoint.json','audio-policy.json','cpu-partition.json','reasoning-budget.json')
|
||||
IMAGE='athena-deck-standalone:basalt-vision-9175e7a'
|
||||
|
||||
def digest(path):
|
||||
with Path(path).open('rb') as f:return hashlib.file_digest(f,'sha256').hexdigest()
|
||||
|
||||
def installed():return json.loads(subprocess.check_output(['docker','inspect','athena-deck-dev'],text=True))[0]
|
||||
|
||||
def record(**updates):
|
||||
path=ROOT/'activation.json';data=json.loads(path.read_text()) if path.exists() else {}
|
||||
data.update(updated_at=time.time(),**updates);path.write_text(json.dumps(data,indent=2));path.chmod(0o600)
|
||||
assert json.loads(path.read_text())==data
|
||||
return data
|
||||
|
||||
def prepare():
|
||||
assert not (ROOT/'activation.json').exists()
|
||||
prep=json.loads((ROOT/'preparation.json').read_text());assert prep['phase']=='prepared; original production unchanged'
|
||||
info=installed();assert info['Image']==prep['image_before']
|
||||
app=ROOT/'image/app';files=[p for p in app.rglob('*') if p.is_file()];assert files
|
||||
assert not any(p.name=='vpn.auth' or 'vpn' in p.parts for p in files)
|
||||
# Preserve the actual installed launcher's changes, not an older local snapshot.
|
||||
original=(CANON/'deploy/install.py').read_text();anchor="FILES += ['cpu_partition.py']"
|
||||
assert anchor in original
|
||||
changed=original.replace(anchor,anchor+"\nFILES += ['basalt_runtime.py','basalt_worker.py','basalt_sources.json','deploy/install_basalt.py','deploy/BASALT_NATIVE.md']",1)
|
||||
before="'--pids-limit','256' if config.get('image_runtime') else '128'"
|
||||
after="'--pids-limit',str(config.get('pids_limit',256 if config.get('image_runtime') else 128))"
|
||||
assert before in changed;changed=changed.replace(before,after,1)
|
||||
(app/'deploy').mkdir(exist_ok=True);(app/'deploy/install.py').write_text(changed)
|
||||
names=sorted(str(p.relative_to(app)) for p in app.rglob('*') if p.is_file())
|
||||
baseline={n:digest(CANON/n) if (CANON/n).is_file() else None for n in names}
|
||||
base_tag=info['Config']['Image']
|
||||
assert subprocess.check_output(['docker','image','inspect','--format','{{.Id}}',base_tag],text=True).strip()==info['Image']
|
||||
(ROOT/'image/Dockerfile').write_text('FROM '+base_tag+'\nUSER root\nCOPY app/ /app/\nUSER 65534:65534\n')
|
||||
(ROOT/'image/.dockerignore').write_text('*\n!Dockerfile\n!app/\n!app/**\n')
|
||||
with (ROOT/'image-build.log').open('w') as out:subprocess.run(['docker','build','--network','none','--pull=false','-t',IMAGE,ROOT/'image'],check=True,stdout=out,stderr=subprocess.STDOUT,timeout=300)
|
||||
image_id=subprocess.check_output(['docker','image','inspect','--format','{{.Id}}',IMAGE],text=True).strip()
|
||||
probe='from basalt_runtime import BasaltRuntime;from basalt_worker import BasaltWorker;from server import Server;print("Basalt image imports passed")'
|
||||
subprocess.run(['docker','run','--rm','--network','none','--read-only','--cap-drop','ALL','--user','65534:65534','--memory','256m','--pids-limit','128','-e','NVIDIA_VISIBLE_DEVICES=void','--entrypoint','python3',image_id,'-B','-c',probe],check=True)
|
||||
assert installed()['Image']==info['Image'] and installed()['State']['StartedAt']==info['State']['StartedAt']
|
||||
settings={n:digest(STATE/n) for n in SETTINGS}
|
||||
profile=next(p for p in json.loads((STATE/'profiles.json').read_text()) if p['id']==TARGET)
|
||||
record(phase='image prepared; normal GUI drain required',image_before=info['Config']['Image'],image_id_before=info['Image'],image=IMAGE,image_id=image_id,files=names,baseline=baseline,settings_before=settings,profile_before=profile,manifest_before=json.loads((BASE/'installation.json').read_text()),inference_performed=False)
|
||||
print(json.dumps(dict(phase='image prepared',image_id=image_id,files=len(names))),flush=True)
|
||||
|
||||
def apply():
|
||||
r=json.loads((ROOT/'activation.json').read_text());assert r['phase'] in ('image prepared; normal GUI drain required','drained; old Deck stopped')
|
||||
info=installed();assert info['Image']==r['image_id_before']
|
||||
# The operator stores this fresh read-back only after the real normal GUI stop.
|
||||
d=json.loads((ROOT/'drained.json').read_text())
|
||||
assert d['state']=='stopped'
|
||||
if r['phase']=='image prepared; normal GUI drain required':assert time.time()-d['checked_at']<60
|
||||
else:assert info['State']['Running'] is False
|
||||
assert d['active_requests']==0 and type(d['active_requests']) is int
|
||||
for field in ('active_requests','waiting_requests','tts_waiting_requests'):assert type(d['scheduler'][field]) is int and d['scheduler'][field]==0
|
||||
assert d['scheduler']['switching'] is False
|
||||
assert not (STATE/'strata-worker/worker.json').exists()
|
||||
assert not subprocess.check_output(['nvidia-smi','--query-compute-apps=pid','--format=csv,noheader,nounits'],text=True).strip()
|
||||
assert all(digest(STATE/n)==v for n,v in r['settings_before'].items() if n!='endpoint.json')
|
||||
for n,value in r['baseline'].items():assert (digest(CANON/n) if (CANON/n).is_file() else None)==value
|
||||
profiles_before=json.loads((STATE/'profiles.json').read_text())
|
||||
if info['State']['Running']:subprocess.run(['docker','stop','--timeout','45','athena-deck-dev'],check=True)
|
||||
record(phase='drained; old Deck stopped')
|
||||
# Validate and save through the maintained class, not a hand-written profile JSON patch.
|
||||
code='''import json,pathlib
|
||||
from catalog import Catalog
|
||||
from profiles import Profiles
|
||||
root=pathlib.Path('/var/lib/deck');store=Profiles(root/'profiles.json',Catalog(root/'models'))
|
||||
p=next(p for p in store.rows if p['id']=='0c25bfe00240414397c41a980ecbe4f0')
|
||||
params={**p['parameters'],'chat_runtime':'basalt','context':262144,'slots':2,'gpu_devices':['GPU-8ad38c6c-5a01-9d8e-1dfa-ed662ad78fbe'],'split_mode':'none','tensor_split':[],'load_mode':'none','gpu_offload':'auto','gpu_reserve_mode':'auto','gpu_reserve_mib':{},'vision_projector':'232f7c84e9cec16e19d86171c431f07fc3e9f8a633845bf1f8f5901539903743','vision_device':'GPU-4834d9d7-5b61-3004-1fb3-4ae49d482d4b'}
|
||||
saved=store.save(dict(id=p['id'],revision=p['revision'],name='Flash Next Basalt',api_id='flash-next-basalt',kind='chat',model_id='88b40b59c99641a51bc87bdab5198c3b8db4832a0325d2fd57c79294a26a236d',parameters=params))
|
||||
assert 'flash-next-strata-iq3-dual' in saved['api_aliases']
|
||||
actual=next(p for p in json.loads((root/'profiles.json').read_text()) if p['id']==saved['id']);assert actual==saved
|
||||
endpoint=json.loads((root/'endpoint.json').read_text());assert saved['id'] in endpoint['enabled_profiles'];endpoint['autostart']=True
|
||||
(root/'endpoint.json').write_text(json.dumps(endpoint))
|
||||
print(json.dumps({'profile':saved['name'],'api_id':saved['api_id'],'legacy_alias_kept':True,'slots':saved['parameters']['slots'],'context':saved['parameters']['context']}))
|
||||
'''
|
||||
mounts=[];manifest=r['manifest_before']
|
||||
for value in [manifest.get('strata_storage'),*manifest.get('strata_storage_mounts',[]),*manifest.get('external_model_roots',[])]:
|
||||
if not value:continue
|
||||
path=Path(value);assert path.is_absolute() and path.is_dir() and not {'vpn','vpn.auth','OpenVPN-KIT','GluetunVPN'} & set(path.parts)
|
||||
mounts+=['--mount','type=bind,src='+str(path)+',dst='+str(path)+',readonly']
|
||||
subprocess.run(['docker','run','--rm','--network','none','--read-only','--cap-drop','ALL','--user','65534:65534','-e','NVIDIA_VISIBLE_DEVICES=void','--mount','type=bind,src='+str(STATE)+',dst=/var/lib/deck',*mounts,'--entrypoint','python3',r['image_id'],'-B','-c',code],check=True)
|
||||
# No other profile or audio policy is rewritten.
|
||||
now=json.loads((STATE/'profiles.json').read_text())
|
||||
assert [p for p in now if p['id']!=TARGET]==[p for p in profiles_before if p['id']!=TARGET]
|
||||
p=next(p for p in now if p['id']==TARGET);assert p['name']=='Flash Next Basalt' and p['parameters']['context']==262144
|
||||
for n in ('audio-policy.json','cpu-partition.json','reasoning-budget.json'):assert digest(STATE/n)==r['settings_before'][n]
|
||||
for n in r['files']:
|
||||
target=CANON/n;target.parent.mkdir(parents=True,exist_ok=True);shutil.copy2(ROOT/'image/app'/n,target)
|
||||
spec=importlib.util.spec_from_file_location('deck_install',CANON/'deploy/install.py');assert spec is not None and spec.loader is not None
|
||||
installer=importlib.util.module_from_spec(spec);spec.loader.exec_module(installer)
|
||||
config=dict(r['manifest_before'],image=r['image'],previous_image=r['image_before'],pids_limit=2048)
|
||||
subprocess.run(['docker','rm','athena-deck-dev'],check=True)
|
||||
installer.launch(config);installer.ready(config);installer.write_manifest(BASE,config)
|
||||
live=installed();assert live['Image']==r['image_id']
|
||||
record(phase='activated; short text/vision acceptance required',profile_after=p,pids_limit=2048,manifest_image=live['Image'])
|
||||
print(json.dumps(dict(activated=True,profile=p['name'],api_id=p['api_id'],legacy_alias='flash-next-strata-iq3-dual',slots=2,context_per_slot=262144)),flush=True)
|
||||
|
||||
if __name__=='__main__':
|
||||
parser=argparse.ArgumentParser();parser.add_argument('operation',choices=('prepare','apply'));parser.add_argument('--go',action='store_true');args=parser.parse_args()
|
||||
if not args.go:parser.error('Current Michael activation Go required')
|
||||
prepare() if args.operation=='prepare' else apply()
|
||||
@@ -0,0 +1,68 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Athena host only: exact telemetry overlay, regular GUI drain, no profile edits."""
|
||||
import argparse,hashlib,importlib.util,json,shutil,subprocess,time
|
||||
from pathlib import Path
|
||||
ROOT=Path('/opt/athena-deck-dev/dashboard-telemetry-activation')
|
||||
BASE=Path('/opt/athena-deck-dev/runtime');STATE=BASE/'state';SOURCE=Path('/opt/athena-deck-dev/source')
|
||||
IMAGE='athena-deck-standalone:basalt-telemetry'
|
||||
FILES=('basalt_worker.py','basalt_serve.py','basalt_telemetry.py','dashboard_data.py','dashboard-ui.js','deploy/install.py')
|
||||
SETTINGS=('profiles.json','endpoint.json','audio-policy.json','cpu-partition.json','reasoning-budget.json')
|
||||
def info():return json.loads(subprocess.check_output(['docker','inspect','athena-deck-dev'],text=True))[0]
|
||||
def sha(p):return hashlib.sha256(p.read_bytes()).hexdigest() if p.is_file() else None
|
||||
def save(data):
|
||||
p=ROOT/'activation.json';p.write_text(json.dumps(data,indent=2));p.chmod(0o600);assert json.loads(p.read_text())==data
|
||||
return data
|
||||
def installer():
|
||||
s=importlib.util.spec_from_file_location('deck_install',SOURCE/'deploy/install.py');assert s and s.loader
|
||||
m=importlib.util.module_from_spec(s);s.loader.exec_module(m);return m
|
||||
def healthy():
|
||||
end=time.monotonic()+90
|
||||
while info()['State'].get('Health',{}).get('Status')=='starting' and time.monotonic()<end:time.sleep(1)
|
||||
assert info()['State']['Health']['Status']=='healthy'
|
||||
def prepare():
|
||||
assert not (ROOT/'activation.json').exists(),'Preparation already exists; inspect rather than overwrite'
|
||||
d=info();tag=d['Config']['Image'];assert subprocess.check_output(['docker','image','inspect','--format','{{.Id}}',tag],text=True).strip()==d['Image']
|
||||
app=ROOT/'image/app';(app/'deploy').mkdir(parents=True,exist_ok=True)
|
||||
original=(SOURCE/'deploy/install.py').read_text();anchor="FILES += ['cpu_partition.py']";assert anchor in original
|
||||
(app/'deploy/install.py').write_text(original.replace(anchor,anchor+"\nFILES += ['basalt_serve.py','basalt_telemetry.py']",1))
|
||||
before={n:sha(SOURCE/n) for n in FILES};after={n:sha(app/n) for n in FILES};assert all(after.values())
|
||||
for n in FILES:
|
||||
(app/n).chmod(0o644)
|
||||
if before[n] is not None:
|
||||
p=ROOT/'before'/n;p.parent.mkdir(parents=True,exist_ok=True);shutil.copy2(SOURCE/n,p)
|
||||
(ROOT/'image/Dockerfile').write_text('FROM '+tag+'\nUSER root\nCOPY app/ /app/\nUSER 65534:65534\n')
|
||||
(ROOT/'image/.dockerignore').write_text('*\n!Dockerfile\n!app/\n!app/**\n')
|
||||
with (ROOT/'image-build.log').open('w') as out:subprocess.run(['docker','build','--network','none','--pull=false','-t',IMAGE,ROOT/'image'],stdout=out,stderr=subprocess.STDOUT,check=True,timeout=180)
|
||||
probe="""from pathlib import Path
|
||||
import tempfile
|
||||
from server import Server
|
||||
from basalt_telemetry import Counters
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
s=Server(0,state_dir=Path(tmp));s.endpoint.close();s.video.close();s.dashboard.close();s.server_close()
|
||||
print('Full isolated Server constructor passed; no production state or models')
|
||||
"""
|
||||
subprocess.run(['docker','run','--rm','--network','none','--read-only','--user','65534:65534','--memory','512m','--pids-limit','256','--cap-drop','ALL','-e','NVIDIA_VISIBLE_DEVICES=void','-e','DECK_REQUIRE_SETUP=0','-e','DECK_NETWORK_MODE=disabled','-e','TMPDIR=/test-tmp','--mount','type=bind,src='+str(STATE/'basalt-runtime/tmp')+',dst=/test-tmp','--entrypoint','python3',IMAGE,'-B','-c',probe],check=True,timeout=45)
|
||||
assert info()['State']['StartedAt']==d['State']['StartedAt']
|
||||
save(dict(phase='prepared',image_before=tag,image_id_before=d['Image'],started_before=d['State']['StartedAt'],source_before=before,source_after=after,config=json.loads((BASE/'installation.json').read_text()),settings={n:(STATE/n).read_text() for n in SETTINGS},prepared_at=time.time()))
|
||||
print('Image and full constructor verified; production unchanged')
|
||||
def apply():
|
||||
a=json.loads((ROOT/'activation.json').read_text());assert a['phase']=='prepared'
|
||||
d=json.loads((ROOT/'drained.json').read_text());assert time.time()-d['checked_at']<60 and d['state']=='stopped'
|
||||
assert type(d['active_requests']) is int and d['active_requests']==0
|
||||
assert all(type(d['scheduler'][k]) is int and d['scheduler'][k]==0 for k in ('active_requests','waiting_requests','tts_waiting_requests')) and d['scheduler']['switching'] is False
|
||||
assert info()['Image']==a['image_id_before'] and all(sha(SOURCE/n)==a['source_before'][n] for n in FILES)
|
||||
assert all((STATE/n).read_text()==a['settings'][n] for n in SETTINGS if n!='endpoint.json')
|
||||
subprocess.run(['docker','stop','--timeout','45','athena-deck-dev'],check=True)
|
||||
assert not subprocess.check_output(['nvidia-smi','--query-compute-apps=pid','--format=csv,noheader,nounits'],text=True).strip(),'Unexpected GPU work; no process will be killed'
|
||||
try:
|
||||
for n in FILES:shutil.copy2(ROOT/'image/app'/n,SOURCE/n)
|
||||
(STATE/'endpoint.json').write_text(a['settings']['endpoint.json'])
|
||||
subprocess.run(['docker','rm','athena-deck-dev'],check=True)
|
||||
c=dict(a['config'],image=IMAGE,previous_image=a['image_before']);i=installer();i.launch(c);i.ready(c);healthy();i.write_manifest(BASE,c)
|
||||
assert all(sha(SOURCE/n)==a['source_after'][n] for n in FILES) and all((STATE/n).read_text()==a['settings'][n] for n in SETTINGS)
|
||||
save(dict(a,phase='activated; live acceptance pending',activated_at=time.time()));print('Activated and healthy; profiles and all protected settings unchanged')
|
||||
except Exception:
|
||||
save(dict(a,phase='activation failed; inspect before rollback'));raise
|
||||
if __name__=='__main__':
|
||||
p=argparse.ArgumentParser();p.add_argument('operation',choices=('prepare','apply'));p.add_argument('--go',action='store_true');a=p.parse_args();assert a.go,'Explicit Michael Go required'
|
||||
prepare() if a.operation=='prepare' else apply()
|
||||
@@ -0,0 +1,36 @@
|
||||
#!/usr/bin/env python3
|
||||
"""CPU-only upstream mock; run in the worker's actual Python environment."""
|
||||
import argparse,json,os,signal,socket,subprocess,time,urllib.request,urllib.error
|
||||
from pathlib import Path
|
||||
p=argparse.ArgumentParser();p.add_argument('--python',required=True);p.add_argument('--source',required=True);p.add_argument('--launcher',required=True);a=p.parse_args()
|
||||
with socket.socket() as s:s.bind(('127.0.0.1',0));port=s.getsockname()[1]
|
||||
base='http://127.0.0.1:'+str(port);key='synthetic-telemetry-test-key'
|
||||
log=Path(a.launcher).parent/'mock-check.log'
|
||||
def request(path,data=None,auth=True):
|
||||
h={'Content-Type':'application/json'}
|
||||
if auth:h['Authorization']='Bearer '+key
|
||||
req=urllib.request.Request(base+path,data=json.dumps(data).encode() if data is not None else None,headers=h)
|
||||
with urllib.request.urlopen(req,timeout=5) as r:return json.load(r)
|
||||
with log.open('w') as out:
|
||||
process=subprocess.Popen([a.python,a.launcher,'--deck-source',a.source,'--mock-engine','--host','127.0.0.1','--port',str(port),'--api-key',key],stdout=out,stderr=subprocess.STDOUT,env=dict(os.environ,CUDA_VISIBLE_DEVICES='',NVIDIA_VISIBLE_DEVICES='void',PYTHONUNBUFFERED='1'),start_new_session=True)
|
||||
try:
|
||||
deadline=time.monotonic()+25
|
||||
while True:
|
||||
try:before=request('/telemetry');break
|
||||
except (OSError,ValueError):
|
||||
if process.poll() is not None or time.monotonic()>deadline:raise RuntimeError('Upstream mock did not start; inspect own mock-check.log') from None
|
||||
time.sleep(.1)
|
||||
assert before['schema_version']==1 and before['backend']=='basalt' and before['available']
|
||||
try:request('/telemetry',auth=False);raise AssertionError('Missing auth accepted')
|
||||
except urllib.error.HTTPError as e:assert e.code==401
|
||||
model=request('/v1/models')['data'][0]['id']
|
||||
response=request('/v1/chat/completions',dict(model=model,messages=[dict(role='user',content='SYNTHETIC_PRIVATE_MARKER')],max_tokens=16,stream=False))
|
||||
after=request('/telemetry');assert after['metrics']['requests_completed_total']==1
|
||||
assert after['metrics']['tokens_predicted_total']>0
|
||||
text=json.dumps(after);assert 'SYNTHETIC_PRIVATE_MARKER' not in text and key not in text and 'requests' not in after and 'history' not in after
|
||||
print(json.dumps(dict(real_upstream_mock=True,auth_401=True,existing_chat_route=True,numeric_counters=True,content_free=True,slots=len(after['slots']))),flush=True)
|
||||
finally:
|
||||
if process.poll() is None:
|
||||
os.killpg(process.pid,signal.SIGTERM)
|
||||
try:process.wait(timeout=5)
|
||||
except subprocess.TimeoutExpired:os.killpg(process.pid,signal.SIGKILL);process.wait()
|
||||
@@ -0,0 +1,37 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Athena host: correct owned overlay directory modes, constructor-test, finish activation."""
|
||||
import importlib.util
|
||||
import json
|
||||
from pathlib import Path
|
||||
import subprocess
|
||||
import time
|
||||
ROOT=Path('/opt/athena-deck-dev/basalt-deck-activation')
|
||||
BASE=Path('/opt/athena-deck-dev/runtime')
|
||||
CANON=Path('/opt/athena-deck-dev/source')
|
||||
r=json.loads((ROOT/'activation.json').read_text())
|
||||
d=json.loads(subprocess.check_output(['docker','inspect','athena-deck-dev'],text=True))[0]
|
||||
assert d['Image']==r['image_id'] and (d['State']['Health']['Status']=='unhealthy' or not d['State']['Running'])
|
||||
subprocess.run(['docker','stop','--timeout','10','athena-deck-dev'],check=True)
|
||||
assert subprocess.check_output(['docker','image','inspect','--format','{{.Id}}',r['image_before']],text=True).strip()==r['image_id_before']
|
||||
(ROOT/'image/Dockerfile').write_text('FROM '+r['image_before']+'\nUSER root\nCOPY app/ /app/\nUSER 65534:65534\n')
|
||||
with (ROOT/'image-repair.log').open('w') as out:subprocess.run(['docker','build','--network','none','--pull=false','-t',r['image'],ROOT/'image'],stdout=out,stderr=subprocess.STDOUT,check=True,timeout=180)
|
||||
image_id=subprocess.check_output(['docker','image','inspect','--format','{{.Id}}',r['image']],text=True).strip()
|
||||
probe='''from pathlib import Path
|
||||
import tempfile
|
||||
from server import Server
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
s=Server(0,state_dir=Path(tmp))
|
||||
s.endpoint.close();s.video.close();s.dashboard.close();s.server_close()
|
||||
print('Full isolated Server constructor passed; no model or production state')
|
||||
'''
|
||||
subprocess.run(['docker','run','--rm','--network','none','--read-only','--user','65534:65534','--memory','512m','--pids-limit','256','--cap-drop','ALL','-e','NVIDIA_VISIBLE_DEVICES=void','-e','DECK_REQUIRE_SETUP=0','-e','DECK_NETWORK_MODE=disabled','-e','TMPDIR=/test-tmp','--mount','type=bind,src='+str(BASE/'state/basalt-runtime/tmp')+',dst=/test-tmp','--entrypoint','python3',image_id,'-B','-c',probe],check=True,timeout=45)
|
||||
spec=importlib.util.spec_from_file_location('deck_install',CANON/'deploy/install.py');assert spec and spec.loader
|
||||
installer=importlib.util.module_from_spec(spec);spec.loader.exec_module(installer)
|
||||
config=dict(r['manifest_before'],image=r['image'],previous_image=r['image_before'],pids_limit=2048)
|
||||
subprocess.run(['docker','rm','athena-deck-dev'],check=True)
|
||||
installer.launch(config);installer.ready(config);installer.write_manifest(BASE,config)
|
||||
a=json.loads(subprocess.check_output(['docker','inspect','athena-deck-dev'],text=True))[0];assert a['Image']==image_id and a['State']['Running']
|
||||
p=next(p for p in json.loads((BASE/'state/profiles.json').read_text()) if p['id']=='0c25bfe00240414397c41a980ecbe4f0')
|
||||
r.update(phase='activated; short text/vision acceptance required',image_id=image_id,profile_after=p,pids_limit=2048,updated_at=time.time(),directory_modes_corrected=True,full_constructor_verified=True)
|
||||
p=ROOT/'activation.json';p.write_text(json.dumps(r,indent=2));assert json.loads(p.read_text())==r
|
||||
print(json.dumps(dict(activated=True,image_id=image_id,profile='Flash Next Basalt',slots=2,context_per_slot=262144)))
|
||||
@@ -0,0 +1,86 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Athena host only: owned runtime adoption + GPU-less SM86/120 vision build.
|
||||
No service/model stop, no production source replacement, no inference.
|
||||
"""
|
||||
import argparse
|
||||
import hashlib
|
||||
import json
|
||||
import os
|
||||
from pathlib import Path
|
||||
import shutil
|
||||
import subprocess
|
||||
import time
|
||||
|
||||
BASE=Path('/opt/athena-deck-dev/runtime')
|
||||
STATE=BASE/'state'
|
||||
CAND=Path('/opt/athena-deck-dev/basalt-candidate-9175e7a3211b')
|
||||
ROOT=Path('/opt/athena-deck-dev/basalt-deck-activation')
|
||||
DEST=STATE/'basalt-runtime'
|
||||
VIEW=Path('/var/lib/deck/basalt-runtime')
|
||||
BLOCK={'vpn','vpn.auth','OpenVPN-KIT','GluetunVPN'}
|
||||
|
||||
def digest(path):
|
||||
with Path(path).open('rb') as f:return hashlib.file_digest(f,'sha256').hexdigest()
|
||||
|
||||
def ignored(directory,names):return [n for n in names if n in BLOCK or n in ('__pycache__','.pytest_cache')]
|
||||
|
||||
def chown_tree(root):
|
||||
for directory,dirs,files in os.walk(root,followlinks=False):
|
||||
dirs[:]=[n for n in dirs if n not in BLOCK]
|
||||
os.chown(directory,65534,65534)
|
||||
for name in files:
|
||||
if name not in BLOCK:os.chown(Path(directory)/name,65534,65534,follow_symlinks=False)
|
||||
|
||||
def save(phase,**values):
|
||||
path=ROOT/'preparation.json';data=json.loads(path.read_text()) if path.exists() else {}
|
||||
data.update(phase=phase,updated_at=time.time(),**values);path.write_text(json.dumps(data,indent=2));print(json.dumps(dict(phase=phase,**values)),flush=True)
|
||||
|
||||
def main():
|
||||
recipe=json.loads((ROOT/'basalt_sources.json').read_text());pin=recipe['model']
|
||||
assert not DEST.exists(),'Existing managed runtime: inspect instead of repeating'
|
||||
assert shutil.disk_usage(STATE).free>15*1024**3
|
||||
git=['git','-c','safe.directory='+str(CAND/'source'),'-C',str(CAND/'source')]
|
||||
assert subprocess.check_output(git+['rev-parse','HEAD'],text=True).strip()==recipe['code']
|
||||
assert not subprocess.check_output(git+['status','--porcelain','--untracked-files=no'],text=True).strip()
|
||||
info=json.loads(subprocess.check_output(['docker','inspect','athena-deck-dev'],text=True))[0]
|
||||
save('copy managed public runtime; original worker stays loaded',image_before=info['Image'],started_before=info['State']['StartedAt'])
|
||||
shutil.copytree(CAND/'source',DEST/'source',symlinks=True,ignore=ignored)
|
||||
shutil.copytree(CAND/'venv',DEST/'venv',symlinks=True,ignore=ignored)
|
||||
shutil.copytree(STATE/'strata-runtime/cuda',DEST/'cuda',symlinks=True,ignore=ignored)
|
||||
# Relocate text launchers only. No candidate file is changed.
|
||||
for p in (DEST/'venv/bin').iterdir():
|
||||
if p.name in BLOCK or p.is_symlink() or not p.is_file():continue
|
||||
with p.open('rb') as f:first=f.read(2)
|
||||
if first==b'#!':
|
||||
data=p.read_bytes().replace(str(CAND/'venv').encode(),str(VIEW/'venv').encode());p.write_bytes(data)
|
||||
for name in ('tmp','home','cache'):(DEST/name).mkdir(exist_ok=True)
|
||||
chown_tree(DEST)
|
||||
source=CAND/'models'/pin['file'];ident=hashlib.sha256((pin['repo']+pin['revision']+pin['file']).encode()).hexdigest();target=STATE/'models'/ident
|
||||
assert source.stat().st_size==pin['size'] and source.stat().st_uid==65534
|
||||
assert source.stat().st_dev==(STATE/'models').stat().st_dev,'No cross-filesystem copy or silent slower-disk adoption'
|
||||
save('verify existing whole model pack; no download or duplicate',model_id=ident)
|
||||
assert digest(source)==pin['sha256']
|
||||
target.mkdir(mode=0o700);os.chown(target,65534,65534);os.link(source,target/'model.basalt')
|
||||
entry=dict(pin,kind='chat',downloaded_at=time.time(),state='downloaded',runtime_ready=False,upstream_hash_verified=True,runtime_metadata={})
|
||||
path=target/'entry.json';path.write_text(json.dumps(entry));os.chown(path,65534,65534)
|
||||
assert (target/'model.basalt').stat().st_ino==source.stat().st_ino
|
||||
save('compile independent SM86/120 vision sidecar; no GPU attached',model_id=ident)
|
||||
v=str(VIEW);cmake=v+'/venv/bin/cmake';nvcc=v+'/cuda/bin/nvcc';ninja=v+'/venv/bin/ninja'
|
||||
configure=[cmake,'-S',v+'/source/tools/vision','-B',v+'/build-vision','-G','Ninja','-DCMAKE_BUILD_TYPE=Release','-DBUILD_TESTING=OFF','-DCMAKE_CUDA_ARCHITECTURES=86;120','-DCMAKE_CUDA_COMPILER='+nvcc,'-DCUDAToolkit_ROOT='+v+'/cuda','-DCMAKE_MAKE_PROGRAM='+ninja]
|
||||
build=[cmake,'--build',v+'/build-vision','--target','basalt-vision','--parallel','1']
|
||||
import shlex
|
||||
script='set -e; '+shlex.join(configure)+'; '+shlex.join(build)+'; '+shlex.join([v+'/venv/bin/python','-m','pip','check'])+'; '+shlex.join([v+'/venv/bin/python','-m','serve.server','--help'])
|
||||
command=['docker','run','--rm','--name','athena-basalt-vision-build','--network','none','--read-only','--cap-drop','ALL','--security-opt','no-new-privileges:true','--user','65534:65534','--cpus','1','--cpu-shares','2','--memory','3g','--memory-swap','3g','--pids-limit','256','-e','NVIDIA_VISIBLE_DEVICES=void','-e','CUDA_VISIBLE_DEVICES=','-e','HOME='+v+'/home','-e','TMPDIR='+v+'/tmp','-e','LD_LIBRARY_PATH='+v+'/cuda/lib64:'+v+'/cuda/lib','--mount','type=bind,src='+str(DEST)+',dst='+v,'--mount','type=bind,src='+str(DEST/'tmp')+',dst=/tmp','--workdir',v+'/source','--entrypoint','nice',info['Image'],'-n','19','sh','-c',script]
|
||||
with (ROOT/'vision-build.log').open('w') as out:subprocess.run(command,stdout=out,stderr=subprocess.STDOUT,check=True,timeout=1200)
|
||||
cache=(DEST/'build-vision/CMakeCache.txt').read_text();assert 'CMAKE_CUDA_ARCHITECTURES:UNINITIALIZED=86;120' in cache
|
||||
assert (DEST/'source/bin/basalt-vision').is_file()
|
||||
marker=dict(commit=recipe['code'],version=recipe['version'],cuda='13.0',architectures=[120],vision_architectures=[86,120],origin='verified-candidate-adoption-plus-separate-vision-build',python='3.12.3',binary_sha256=digest(DEST/'source/bin/basalt'),vision_sha256=digest(DEST/'source/bin/basalt-vision'),inference_performed=False)
|
||||
path=DEST/'ready.json';path.write_text(json.dumps(marker,indent=2));os.chown(path,65534,65534)
|
||||
after=json.loads(subprocess.check_output(['docker','inspect','athena-deck-dev'],text=True))[0]
|
||||
assert after['Image']==info['Image'] and after['State']['StartedAt']==info['State']['StartedAt']
|
||||
save('prepared; original production unchanged',model_id=ident,vision_architectures=[86,120],managed_runtime=str(DEST),whole_model_sha256_verified=True,shared_inode=True)
|
||||
|
||||
if __name__=='__main__':
|
||||
parser=argparse.ArgumentParser();parser.add_argument('--go',action='store_true');args=parser.parse_args()
|
||||
if not args.go:parser.error('Current Michael activation Go required')
|
||||
main()
|
||||
@@ -0,0 +1,63 @@
|
||||
#!/usr/bin/env python3
|
||||
"""NAS/Hermes Python: four bounded synthetic acceptance requests, own managed key."""
|
||||
import concurrent.futures
|
||||
import importlib.util
|
||||
import json
|
||||
from pathlib import Path
|
||||
import struct
|
||||
import time
|
||||
import urllib.error
|
||||
import urllib.request
|
||||
import zlib
|
||||
import base64
|
||||
|
||||
ROOT=Path(__file__).resolve().parent
|
||||
spec=importlib.util.spec_from_file_location('athena_profile_transport',ROOT.parent/'basalt-candidate-2026-11-01/paired_transport.py');assert spec and spec.loader
|
||||
transport=importlib.util.module_from_spec(spec);spec.loader.exec_module(transport)
|
||||
KEY=transport.key()
|
||||
BASE='http://192.168.1.212:8120'
|
||||
MODEL='flash-next-basalt'
|
||||
START=time.monotonic()
|
||||
|
||||
def get(path):
|
||||
req=urllib.request.Request(BASE+path,headers={'Authorization':'Bearer '+KEY})
|
||||
with urllib.request.urlopen(req,timeout=15) as r:return json.load(r)
|
||||
|
||||
def chat(messages,tokens=40,model=MODEL):
|
||||
assert time.monotonic()-START<600,'Short acceptance budget exhausted'
|
||||
body=dict(model=model,messages=messages,max_tokens=tokens,temperature=0,chat_template_kwargs={'enable_thinking':False})
|
||||
req=urllib.request.Request(BASE+'/v1/chat/completions',data=json.dumps(body).encode(),headers={'Authorization':'Bearer '+KEY,'Content-Type':'application/json'})
|
||||
t=time.monotonic()
|
||||
try:
|
||||
with urllib.request.urlopen(req,timeout=240) as r:out=json.load(r)
|
||||
except urllib.error.HTTPError as exc:
|
||||
data=exc.read(8192).decode();raise RuntimeError('HTTP '+str(exc.code)+': '+data) from None
|
||||
text=out['choices'][0]['message'].get('content') or ''
|
||||
return dict(content=text,seconds=round(time.monotonic()-t,3),usage=out.get('usage'),timings=out.get('timings'))
|
||||
|
||||
def main():
|
||||
models=get('/v1/models')['data'];row=next(m for m in models if m['id']==MODEL)
|
||||
assert row['name']=='Flash Next Basalt' and row['parallel_slots']==2 and row['context_window']==262144 and row['context_scope']=='per_slot',row
|
||||
print(json.dumps(dict(stage='advertised',profile=row['name'],api_id=row['id'],slots=row['parallel_slots'],context_per_slot=row['context_window'])),flush=True)
|
||||
warm=chat([dict(role='user',content='Antworte nur mit dem Wort BEREIT.')]);assert 'BEREIT' in warm['content'].upper(),warm
|
||||
print(json.dumps(dict(stage='model loaded and text passed',seconds=warm['seconds'],content=warm['content'])),flush=True)
|
||||
props=get('/props?model='+MODEL)
|
||||
assert props['total_slots']==2 and props['default_generation_settings']['n_ctx']==262144 and props['modalities']['vision'] is True,props
|
||||
def one(marker):
|
||||
result=chat([dict(role='user',content='Schreibe ausschließlich diese Kennung: '+marker)])
|
||||
assert marker in result['content'],result
|
||||
return result
|
||||
with concurrent.futures.ThreadPoolExecutor(max_workers=2) as pool:pair=list(pool.map(one,('BASALT_LINKS_7421','BASALT_RECHTS_8293')))
|
||||
print(json.dumps(dict(stage='parallel pair passed',answers=[r['content'] for r in pair])),flush=True)
|
||||
def chunk(name,payload):return struct.pack('>I',len(payload))+name+payload+struct.pack('>I',zlib.crc32(name+payload)&0xffffffff)
|
||||
size=128;raw=(b'\0'+bytes((255,0,0))*size)*size
|
||||
image=b'\x89PNG\r\n\x1a\n'+chunk(b'IHDR',struct.pack('>IIBBBBB',size,size,8,2,0,0,0))+chunk(b'IDAT',zlib.compress(raw))+chunk(b'IEND',b'')
|
||||
uri='data:image/png;base64,'+base64.b64encode(image).decode()
|
||||
vision=chat([dict(role='user',content=[dict(type='text',text='Welche Farbe hat dieses Bild? Antworte auf Deutsch mit genau einem Farbwort.'),dict(type='image_url',image_url={'url':uri})])],24)
|
||||
assert 'rot' in vision['content'].lower(),vision
|
||||
print(json.dumps(dict(stage='vision passed',answer=vision['content'],seconds=vision['seconds'])),flush=True)
|
||||
legacy=get('/props?model=flash-next-strata-iq3-dual');assert legacy['total_slots']==2 and legacy['modalities']['vision'] is True
|
||||
result=dict(profile='Flash Next Basalt',api_id=MODEL,legacy_alias='flash-next-strata-iq3-dual',slots=2,context_per_slot=262144,vision=True,warm=warm,parallel=pair,vision_result=vision,elapsed_seconds=round(time.monotonic()-START,3),scope='Four short synthetic requests, not a benchmark or full-context fill')
|
||||
out=Path('/opt/data/profiles/athena-deck/cache/scratch/basalt-live-acceptance.json');out.write_text(json.dumps(result,indent=2));print('Acceptance evidence: '+str(out),flush=True)
|
||||
|
||||
if __name__=='__main__':main()
|
||||
Reference in new issue
Block a user