Deploy audited RTX 6000D Flash-Next 128K multimodal baseline
This commit is contained in:
@@ -0,0 +1,65 @@
|
||||
"""Small live API acceptance suite; writes evidence without API credentials."""
|
||||
import argparse
|
||||
import json
|
||||
import time
|
||||
import urllib.request
|
||||
from pathlib import Path
|
||||
|
||||
p = argparse.ArgumentParser()
|
||||
p.add_argument('--url', default='http://127.0.0.1:8000')
|
||||
p.add_argument('--key-file', type=Path, default=Path(__file__).resolve().parents[1] / 'secrets/api-key')
|
||||
p.add_argument('--output', type=Path, required=True)
|
||||
args = p.parse_args()
|
||||
key = args.key_file.read_text().strip()
|
||||
|
||||
def request(path, body=None):
|
||||
payload = None if body is None else json.dumps(body, ensure_ascii=False).encode()
|
||||
req = urllib.request.Request(args.url + path, data=payload,
|
||||
headers={'Authorization': 'Bearer ' + key, 'Content-Type': 'application/json'})
|
||||
return urllib.request.urlopen(req, timeout=600)
|
||||
|
||||
args.output.parent.mkdir(parents=True, exist_ok=True)
|
||||
with args.output.open('x') as out:
|
||||
def record(data):
|
||||
line = json.dumps(data, ensure_ascii=False)
|
||||
out.write(line + '\n'); out.flush(); print(line, flush=True)
|
||||
|
||||
record({'models': json.load(request('/v1/models'))})
|
||||
for name, text, expected in [
|
||||
('math', 'Compute 17 * 19. Reply with only the integer.', '323'),
|
||||
('chinese', '请只回复:模型已就绪', '模型已就绪'),
|
||||
]:
|
||||
body = dict(model='qwen3.8-flash-next', messages=[dict(role='user', content=text)],
|
||||
temperature=0, reasoning_effort='low', max_tokens=1024,
|
||||
stream=True, stream_options={'include_usage': True})
|
||||
start = time.monotonic(); first = None; content = ''; reasoning = ''; usage = {}; finish = None
|
||||
with request('/v1/chat/completions', body) as response:
|
||||
for raw in response:
|
||||
if not raw.startswith(b'data: '): continue
|
||||
data = raw[6:].strip()
|
||||
if data == b'[DONE]': break
|
||||
item = json.loads(data)
|
||||
if item.get('usage'): usage = item['usage']
|
||||
for choice in item.get('choices', []):
|
||||
delta = choice.get('delta', {})
|
||||
c = delta.get('content') or ''
|
||||
r = delta.get('reasoning') or delta.get('reasoning_content') or ''
|
||||
if (c or r) and first is None: first = time.monotonic()
|
||||
content += c; reasoning += r
|
||||
finish = choice.get('finish_reason') or finish
|
||||
elapsed = time.monotonic() - start
|
||||
passed = content.strip() == expected and finish == 'stop'
|
||||
record(dict(test=name, passed=passed, content=content, reasoning_chars=len(reasoning),
|
||||
ttft_s=None if first is None else first-start, elapsed_s=elapsed,
|
||||
finish_reason=finish, usage=usage))
|
||||
if not passed: raise SystemExit('Acceptance failure: ' + name)
|
||||
body = dict(model='qwen3.8-flash-next', temperature=0, reasoning_effort='low', max_tokens=1024,
|
||||
messages=[dict(role='user',content='Use get_weather to check the weather in Shanghai.')],
|
||||
tools=[dict(type='function',function=dict(name='get_weather',description='Get current weather',
|
||||
parameters=dict(type='object',properties={'city':{'type':'string'}},required=['city'])))],
|
||||
tool_choice='auto')
|
||||
result = json.load(request('/v1/chat/completions',body))
|
||||
calls = result['choices'][0]['message'].get('tool_calls') or []
|
||||
passed = bool(calls) and calls[0]['function']['name']=='get_weather'
|
||||
record(dict(test='tool',passed=passed,response=result))
|
||||
if not passed: raise SystemExit('Tool acceptance failure')
|
||||
@@ -0,0 +1,33 @@
|
||||
"""Fixed 256-token single-stream timing; not a task-quality score."""
|
||||
import argparse
|
||||
import json
|
||||
import time
|
||||
import urllib.request
|
||||
from pathlib import Path
|
||||
|
||||
p=argparse.ArgumentParser(); p.add_argument('--output',type=Path,required=True); a=p.parse_args()
|
||||
key=(Path(__file__).resolve().parents[1]/'secrets/api-key').read_text().strip()
|
||||
body=dict(model='qwen3.8-flash-next',messages=[dict(role='user',content='Write a Python function that merges overlapping intervals. Explain the algorithm, edge cases and complexity.')],
|
||||
temperature=0,seed=6000,reasoning_effort='low',max_tokens=256,ignore_eos=True,
|
||||
stream=True,stream_options={'include_usage':True})
|
||||
with a.output.open('x') as out:
|
||||
for i in range(4):
|
||||
req=urllib.request.Request('http://127.0.0.1:8000/v1/chat/completions',data=json.dumps(body).encode(),
|
||||
headers={'Content-Type':'application/json','Authorization':'Bearer '+key})
|
||||
start=time.monotonic(); first=None; usage={}; content=''; reasoning=''
|
||||
with urllib.request.urlopen(req,timeout=600) as resp:
|
||||
for raw in resp:
|
||||
if not raw.startswith(b'data: '): continue
|
||||
data=raw[6:].strip()
|
||||
if data==b'[DONE]': break
|
||||
x=json.loads(data); usage=x.get('usage') or usage
|
||||
for c in x.get('choices',[]):
|
||||
d=c.get('delta',{}); s=d.get('content') or ''; r=d.get('reasoning') or d.get('reasoning_content') or ''
|
||||
if first is None and (s or r): first=time.monotonic()
|
||||
content+=s; reasoning+=r
|
||||
end=time.monotonic(); tokens=usage['completion_tokens']
|
||||
if tokens != 256 or first is None: raise RuntimeError('Incomplete timing sample')
|
||||
row=dict(run=i,warmup=i==0,ttft_s=first-start,elapsed_s=end-start,
|
||||
decode_tps=(tokens-1)/(end-first),usage=usage,content=content,reasoning=reasoning)
|
||||
line=json.dumps(row); out.write(line+'\n'); out.flush()
|
||||
print(json.dumps({k:v for k,v in row.items() if k not in ['content','reasoning']}),flush=True)
|
||||
@@ -0,0 +1,57 @@
|
||||
"""Token-counted retrieval and repeat-prefix acceptance, not a broad quality eval."""
|
||||
import argparse
|
||||
import json
|
||||
import random
|
||||
import time
|
||||
import urllib.request
|
||||
from pathlib import Path
|
||||
|
||||
p=argparse.ArgumentParser()
|
||||
p.add_argument('--tokens',type=int,default=28000)
|
||||
p.add_argument('--output',type=Path,required=True)
|
||||
p.add_argument('--url',default='http://127.0.0.1:8000')
|
||||
a=p.parse_args()
|
||||
key=(Path(__file__).resolve().parents[1]/'secrets/api-key').read_text().strip()
|
||||
def request(path,body):
|
||||
return urllib.request.urlopen(urllib.request.Request(a.url+path,
|
||||
data=json.dumps(body).encode(),headers={'Content-Type':'application/json',
|
||||
'Authorization':'Bearer '+key}),timeout=900)
|
||||
|
||||
rng=random.Random(6000)
|
||||
lines=['Internal inventory. Find the exact special verification code when asked.\n',
|
||||
'The special verification code is VIOLET-74219.\n']
|
||||
lines += [f'Record {i:06d}: batch {rng.randrange(10**8):08d}, location shelf {rng.randrange(1000):03d}, status archived.\n' for i in range(a.tokens//8+1000)]
|
||||
question='\nWhat is the special verification code? Reply with only that code.'
|
||||
def messages(n):
|
||||
return [{'role':'user','content':''.join(lines[:n])+question}]
|
||||
lo,hi=2,len(lines)
|
||||
while lo < hi:
|
||||
mid=(lo+hi+1)//2
|
||||
with request('/tokenize',dict(model='qwen3.8-flash-next',messages=messages(mid),
|
||||
chat_template_kwargs={'reasoning_effort':'low'})) as resp:
|
||||
count=json.load(resp)['count']
|
||||
if count<=a.tokens: lo=mid
|
||||
else: hi=mid-1
|
||||
a.output.parent.mkdir(parents=True,exist_ok=True)
|
||||
with a.output.open('x') as out:
|
||||
for repetition in range(2):
|
||||
start=time.monotonic(); first=None; content=''; usage={}; finish=None
|
||||
with request('/v1/chat/completions',dict(model='qwen3.8-flash-next',messages=messages(lo),
|
||||
temperature=0,reasoning_effort='low',max_tokens=2048,stream=True,
|
||||
stream_options={'include_usage':True})) as resp:
|
||||
for raw in resp:
|
||||
if not raw.startswith(b'data: '): continue
|
||||
data=raw[6:].strip()
|
||||
if data==b'[DONE]': break
|
||||
item=json.loads(data)
|
||||
usage=item.get('usage') or usage
|
||||
for c in item.get('choices',[]):
|
||||
d=c.get('delta',{})
|
||||
if first is None and any(d.get(x) for x in ['content','reasoning','reasoning_content']): first=time.monotonic()
|
||||
content+=d.get('content') or ''
|
||||
finish=c.get('finish_reason') or finish
|
||||
row=dict(repetition=repetition,content=content,usage=usage,finish_reason=finish,
|
||||
ttft_s=None if first is None else first-start,elapsed_s=time.monotonic()-start,
|
||||
passed=content.strip()=='VIOLET-74219' and finish=='stop')
|
||||
line=json.dumps(row); out.write(line+'\n'); out.flush(); print(line,flush=True)
|
||||
if not row['passed']: raise SystemExit('Long-context retrieval failed')
|
||||
@@ -0,0 +1,22 @@
|
||||
"""Log host/GPU headroom; stop the test server on host OOM or low RAM."""
|
||||
import json
|
||||
import subprocess
|
||||
import time
|
||||
from pathlib import Path
|
||||
|
||||
def kv(path):
|
||||
return {s.split()[0].rstrip(':'): int(s.split()[1]) for s in Path(path).read_text().splitlines() if len(s.split())>=2}
|
||||
|
||||
baseline = kv('/proc/vmstat')['oom_kill']
|
||||
while True:
|
||||
mem = kv('/proc/meminfo'); vm = kv('/proc/vmstat')
|
||||
gpu = subprocess.run(['nvidia-smi','--query-gpu=memory.used,memory.total,utilization.gpu,temperature.gpu',
|
||||
'--format=csv,noheader,nounits'],capture_output=True,text=True,timeout=10)
|
||||
low = mem['MemAvailable'] < 8*1024*1024
|
||||
oom = vm['oom_kill'] > baseline
|
||||
print(json.dumps(dict(time=time.time(),available_gib=mem['MemAvailable']/1024**2,
|
||||
oom_kill=vm['oom_kill'],gpu=gpu.stdout.strip(),stop=low or oom)),flush=True)
|
||||
if low or oom:
|
||||
subprocess.run(['docker','stop','-t','10','qwen38-flash-6000d'],timeout=30)
|
||||
raise SystemExit('Host memory safeguard stopped server')
|
||||
time.sleep(2)
|
||||
@@ -0,0 +1,31 @@
|
||||
"""Verify actual image/video ingestion using deterministic local probes."""
|
||||
import argparse
|
||||
import base64
|
||||
import json
|
||||
import time
|
||||
import urllib.request
|
||||
from pathlib import Path
|
||||
|
||||
p=argparse.ArgumentParser()
|
||||
p.add_argument('--output',type=Path,required=True)
|
||||
p.add_argument('--assets',type=Path,default=Path('/data/flash-next/cache'))
|
||||
a=p.parse_args()
|
||||
key=(Path(__file__).resolve().parents[1]/'secrets/api-key').read_text().strip()
|
||||
cases=[('image','image/png','probe.png','What is the main color of this image? Reply with one English word.', ['red']),
|
||||
('video','video/mp4','probe.mp4','List the background colors in chronological order. Reply only with the three English color names.', ['red','green','blue'])]
|
||||
with a.output.open('x') as out:
|
||||
for kind,mime,name,prompt,colors in cases:
|
||||
url='data:'+mime+';base64,'+base64.b64encode((a.assets/name).read_bytes()).decode()
|
||||
part=kind+'_url'
|
||||
body=dict(model='qwen3.8-flash-next',temperature=0,reasoning_effort='low',max_tokens=1024,
|
||||
messages=[dict(role='user',content=[dict(type='text',text=prompt),{'type':part,part:{'url':url}}])])
|
||||
start=time.monotonic()
|
||||
req=urllib.request.Request('http://127.0.0.1:8000/v1/chat/completions',data=json.dumps(body).encode(),
|
||||
headers={'Content-Type':'application/json','Authorization':'Bearer '+key})
|
||||
with urllib.request.urlopen(req,timeout=600) as response: result=json.load(response)
|
||||
choice=result['choices'][0]; content=choice['message'].get('content') or ''
|
||||
pos=[content.lower().find(c) for c in colors]
|
||||
passed=all(x>=0 for x in pos) and pos==sorted(pos) and choice['finish_reason']=='stop'
|
||||
row=dict(test=kind,passed=passed,elapsed_s=time.monotonic()-start,response=result)
|
||||
line=json.dumps(row,ensure_ascii=False); out.write(line+'\n'); out.flush(); print(line,flush=True)
|
||||
if not passed: raise SystemExit('Multimodal probe failed: '+kind)
|
||||
Reference in New Issue
Block a user