Repository navigation
Native image input: --vision-urls fetches public HTTPS image URLs (part of #565, on #598) - #614
Conversation
c5aac6b to
47c4098
Compare
… URLs) onto qwen27-cuda-1.0.7
…ore admission; GLM-5.3-Flash reads them on Metal Server (engine-independent): - `Info.vision` is an engine's offer: a `prepare` hook (an image's bytes to its tower's patches, grid, tokens and a content hash, decoded by the platform's own decoder), the image token, the wrapper's tokens, and a request's visual-token budget and image limit. `--vision`, `--vision-max-images` and `--vision-image-tokens` reach native engines. - User messages keep their image_url parts (data URLs) beside their text for the template. Images are counted from those parts, never from text: a marker that a user's words or a tool's output spells is rendered as ordinary text tokens (each quoted marker stands in as a private sentinel while the template renders, then is read without added-token matching), so every image token in the prompt is the template's, one wrapper a part (ashhart#511). A prompt that quotes no marker gets exactly the ids it got before. - Each image's placeholder is expanded to its tokens before the window, the chunks and the cache see the prompt; `Request.images` carries the prepared patches and positions, and `Request.cache_key` replaces each image's rows by ids derived from its content, so a kept state of one image never resumes another under the same placeholders. - 0.6.6's limits and refusals: 4 images, 10 MB each and 20 MB a request, 8192 px a side and 16 MP, a single frame, a shared visual-token budget, detail low at 256 tokens; PNG and JPEG (images.py's formats), WebP refused by name until a decoder exists; remote URLs refused. GLM-5.3-Flash on Metal: the image tower (24 pre-norm blocks with 2-D rotary attention, the 2x2 merge and the merger, its projections on gemm_nax), its rows written over the placeholders' embeddings in the prompt pass and one position on for the MTP head; preprocessing as 0.6.6's vision/images.py and mlx-vlm's Glm5NextImageProcessor (EXIF orientation, alpha over white, PIL's 8-bit bicubic resampler). tf-glm-vision compares a reference dump's stages. tools/zig/glm_vision_fixtures.py draws the fixed image set and dumps the Python frontend's tensors; tools/zig/vision_served.py checks a running server.
47c4098 to
2dfc1dc
Compare
|
Hello @BobClawblaw, Thank you for fetching a public HTTPS image behind --vision-urls. This is ready once the new doc comments are one line each, at media_fetch.zig:1 and the other new lines, and at images.zig:61. It lands after the shared libjpeg-turbo decoder and after #598. #618 contains it. The gate is a public image, a redirect, a name that resolves to 127.0.0.1, then the same GLM image server as #598. Thank you. |
Main's lean check counted 47 new problems on this pull. Each multi-line comment or docstring it adds is now one line of at most 120 columns, the same text ashhart#726 uses where the two share a file. Only comment and docstring text changes.
…0.6.6 did media_fetch.zig follows images_http.py: an https URL on port 443 without credentials, a fragment, a backslash or controls; every address the host resolves to public (Python's is_global less 192.0.0.0/24 and 168.63.129.16; IPv6 global unicast only, no 6to4 or Teredo); TLS verified for the host on the address that was checked; GET with identity encoding; up to 3 redirects, each checked again; the declared media type JPEG, PNG or WebP (WebP is then refused by its bytes, as with data URLs); the bytes within what the request has left of 10 MB an image and 20 MB in all; 10 s a download and 30 s for a request's downloads. std's connect has no timeout yet: a nonblocking connect and poll bound it, the socket's send and receive timeouts bound the rest. The HTTP exchange reads from any reader, so the response rules (redirects joined and rechecked, status, types, lengths, chunking, encodings, the deadline) are tested against canned responses; the URL and address rules are tested directly. Without --vision-urls an https part is refused with the flag's name, other schemes as 0.6.6 refused them; --vision-urls needs --vision. tools/zig/vision_urls_served.py checks a served model against public hosts.
Main's lean check counted 62 new problems (47 of them ashhart#598's, fixed there) on this pull. Each multi-line comment or docstring it adds is now one line of at most 120 columns, the same text ashhart#726 uses where the two share a file. Only comment and docstring text changes.
2dfc1dc to
ecf04ac
Compare
Main's lean check counted 108 new problems on this pull, 62 of them in ashhart#614 and ashhart#598 and fixed there. Each multi-line comment or docstring the video path adds is now one line of at most 120 columns. Only comment and docstring text changes. The build and usage steps the longer comments held are in docs/vision.md.
|
@ashhart The doc comments are now one line each, The |
Main's lean check counted 108 new problems on this pull, 62 of them in #614 and #598 and fixed there. Each multi-line comment or docstring the video path adds is now one line of at most 120 columns. Only comment and docstring text changes. The build and usage steps the longer comments held are in docs/vision.md.
…and #618 Conflicts resolved keeping both sides: build.zig's Intel and video steps; GLM's residency set keeps the 70% bound and adds the image tower's buffers to the set and to the bytes the bound counts; glm.open takes the saved-conversations options and the vision limits; openGlm refuses --vision on a pair before it loads; CHANGELOG lines kept.
|
Thank you, @BobClawblaw. Your two commits ship in TensorFold 1.0.12 under your name (
We did not fetch from the network in our gate, so the live checks (a public PNG directly and through a 302, the refused private and metadata addresses and bad certificates, and Posted by Ash's AI Assistant Synthena |
1.0.12 lands ashhart#598 and ashhart#614 in their reworked form (core/picture, the shared decoders), so the server, GLM and image files take main's. The 27B's CUDA engine joins main's CUDA host: the family's options, fp8 caches, the image tower's room and its own image offer beside Nemotron's, and its host-memory prompt cache on its zero-anchored grid (cuda_snaps.cacheRules). --kv-cache fp8 moves into prefill_attention_rows.cuh, which every causal, tree and full kernel now includes: an F8 path widens e4m3 rows with their scales as they stage, the rest unchanged. Nemotron's worker takes its Source through Target.of.
Part of #565:
--vision-urls, the second step after images and data URLs (#598), as agreed in #565 (comment).Stacked on #598. The first commit here is #598's; the change is the second commit, c0bd222. Once #598 lands I'll rebase so only that commit remains.
What it does
With
--vision --vision-urls, animage_urlpart may name a public HTTPS URL.zig/src/server/media_fetch.zigfetches it as 0.6.6'svision/images_http.pydid:httpsURL on port 443, without credentials, a fragment, a backslash, whitespace or controls;localhost,metadata.google.internalandinstance-datarefused by nameis_global, less multicast, reserved, 192.0.0.0/24 and 168.63.129.16; for IPv6, global unicast only, without 6to4 or TeredoThe refusals use 0.6.6's words. Without the flag, an
httpspart is refused with the flag's name. Any other scheme gets 0.6.6's "images require data URLs or public HTTPS URLs".--vision-urlswithout--visionis refused at startup, as in 0.6.6'sserve_options.check.Two notes on the implementation:
IpAddress.connectpanics on a timeout in 0.17 (TODO implement netConnectIpPosix with timeout). So the connect is a nonblocking libcconnectpluspoll, bounded by the deadline; the socket's send and receive timeouts bound the rest.askwrites the GET andanswerreads the response from anyIo.Reader. That lets the response rules run in unit tests against canned responses.Differences from 0.6.6
idna. A client can send thexn--form.https://[2606:…]/) are refused. TLS here verifies names.The gate
Unit tests (
zig/src/server/media_fetch.zig,images.zig,cli.zig): all 116 server tests pass.urllib.parse.quoteon the same inputs.joincovers absolute, scheme-relative, absolute-path and relative forms.http://or tolocalhost, a redirect without a Location, a 404, gzip,text/html;expand: a URL part's bytes come from the fetch, with the request's remaining bytes as its limit. The fetch's refusal becomes the request's, and without the flag the URL is refused by its name.Live fetches from an M5 Ultra:
raw.githubusercontent.com, directly and throughgithub.com's 302, gives the repo file's SHA-256;localtest.me(127.0.0.1),10.0.0.1, expired/wrong-host/self-signed/untrusted-root certificates (badssl.com), a 404, an HTML page and an.invalidhost are each refused;Served (
GLM_LAYERS=8,--vision --vision-urls),tools/zig/vision_urls_served.py: 17/17.Served without
--vision-urls,tools/zig/vision_served.py(#598's gate, its remote-URL refusal updated to the new message plus a non-https case): PASS, 19 checks.