drowse.ai 5.3.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.
- drowse/__init__.py +312 -0
- drowse/__main__.py +5 -0
- drowse/cli/__init__.py +5 -0
- drowse/cli/alpha_grid.py +96 -0
- drowse/cli/config_file.py +340 -0
- drowse/cli/main.py +52 -0
- drowse/cli/parsers.py +1478 -0
- drowse/cli/runners/__init__.py +155 -0
- drowse/cli/runners/config.py +85 -0
- drowse/cli/runners/experiment.py +344 -0
- drowse/cli/runners/lens.py +661 -0
- drowse/cli/runners/manifold.py +1097 -0
- drowse/cli/runners/pack.py +413 -0
- drowse/cli/runners/sae.py +304 -0
- drowse/cli/runners/serve.py +220 -0
- drowse/cli/runners/shared.py +389 -0
- drowse/cli/runners/template.py +232 -0
- drowse/core/__init__.py +1 -0
- drowse/core/capture.py +1205 -0
- drowse/core/errors.py +260 -0
- drowse/core/events.py +156 -0
- drowse/core/extraction.py +3076 -0
- drowse/core/generation.py +1738 -0
- drowse/core/generation_finalizer.py +278 -0
- drowse/core/histogram.py +30 -0
- drowse/core/hooks.py +1885 -0
- drowse/core/instruments/__init__.py +49 -0
- drowse/core/instruments/geometry.py +551 -0
- drowse/core/instruments/lens.py +1341 -0
- drowse/core/instruments/protocol.py +211 -0
- drowse/core/instruments/sae.py +935 -0
- drowse/core/instruments/types.py +597 -0
- drowse/core/jlens.py +874 -0
- drowse/core/jlens_fit.py +1305 -0
- drowse/core/joint_logprobs.py +748 -0
- drowse/core/loom.py +1938 -0
- drowse/core/loom_diff.py +408 -0
- drowse/core/mahalanobis.py +579 -0
- drowse/core/manifold.py +4106 -0
- drowse/core/measurements.py +382 -0
- drowse/core/model.py +1724 -0
- drowse/core/monitor.py +2060 -0
- drowse/core/monitor_attach.py +682 -0
- drowse/core/naming.py +42 -0
- drowse/core/naturalness.py +187 -0
- drowse/core/profile.py +617 -0
- drowse/core/relp.py +313 -0
- drowse/core/results.py +467 -0
- drowse/core/role_templates.py +677 -0
- drowse/core/sae.py +891 -0
- drowse/core/sae_training.py +239 -0
- drowse/core/sampling.py +127 -0
- drowse/core/scene.py +810 -0
- drowse/core/scoring.py +270 -0
- drowse/core/session.py +11015 -0
- drowse/core/static_cache.py +316 -0
- drowse/core/steering.py +229 -0
- drowse/core/steering_composer.py +1135 -0
- drowse/core/steering_expr.py +1413 -0
- drowse/core/surface_topology.py +128 -0
- drowse/core/token_callback.py +52 -0
- drowse/core/token_payloads.py +244 -0
- drowse/core/topology.py +1469 -0
- drowse/core/transcript.py +582 -0
- drowse/core/tree_filter.py +353 -0
- drowse/core/triggers.py +250 -0
- drowse/data/baseline_prompts.json +50 -0
- drowse/data/manifolds/confident.uncertain/manifold.json +28 -0
- drowse/data/manifolds/confident.uncertain/nodes/00_confident.json +50 -0
- drowse/data/manifolds/confident.uncertain/nodes/01_uncertain.json +50 -0
- drowse/data/manifolds/creative.conventional/manifold.json +28 -0
- drowse/data/manifolds/creative.conventional/nodes/00_creative.json +50 -0
- drowse/data/manifolds/creative.conventional/nodes/01_conventional.json +50 -0
- drowse/data/manifolds/curious.disinterested/manifold.json +28 -0
- drowse/data/manifolds/curious.disinterested/nodes/00_curious.json +50 -0
- drowse/data/manifolds/curious.disinterested/nodes/01_disinterested.json +50 -0
- drowse/data/manifolds/direct.indirect/manifold.json +28 -0
- drowse/data/manifolds/direct.indirect/nodes/00_direct.json +50 -0
- drowse/data/manifolds/direct.indirect/nodes/01_indirect.json +50 -0
- drowse/data/manifolds/emotions/manifold.json +115 -0
- drowse/data/manifolds/emotions/nodes/00_excited.json +50 -0
- drowse/data/manifolds/emotions/nodes/01_happy.json +50 -0
- drowse/data/manifolds/emotions/nodes/02_calm.json +50 -0
- drowse/data/manifolds/emotions/nodes/03_weary.json +50 -0
- drowse/data/manifolds/emotions/nodes/04_sad.json +50 -0
- drowse/data/manifolds/emotions/nodes/05_distressed.json +50 -0
- drowse/data/manifolds/emotions/nodes/06_alert.json +50 -0
- drowse/data/manifolds/emotions/nodes/07_dominant.json +50 -0
- drowse/data/manifolds/emotions/nodes/08_submissive.json +50 -0
- drowse/data/manifolds/emotions/nodes/09_angry.json +50 -0
- drowse/data/manifolds/emotions/nodes/10_fearful.json +50 -0
- drowse/data/manifolds/emotions/nodes/11_surprised.json +50 -0
- drowse/data/manifolds/emotions/nodes/12_triumphant.json +50 -0
- drowse/data/manifolds/emotions/nodes/13_humiliated.json +50 -0
- drowse/data/manifolds/emotions/nodes/14_disgusted.json +50 -0
- drowse/data/manifolds/emotions/nodes/15_bored.json +50 -0
- drowse/data/manifolds/emotions/nodes/16_grateful.json +50 -0
- drowse/data/manifolds/emotions/nodes/17_relieved.json +50 -0
- drowse/data/manifolds/emotions/nodes/18_playful.json +50 -0
- drowse/data/manifolds/emotions/nodes/19_hopeful.json +50 -0
- drowse/data/manifolds/formal.casual/manifold.json +28 -0
- drowse/data/manifolds/formal.casual/nodes/00_formal.json +50 -0
- drowse/data/manifolds/formal.casual/nodes/01_casual.json +50 -0
- drowse/data/manifolds/honest.deceptive/manifold.json +28 -0
- drowse/data/manifolds/honest.deceptive/nodes/00_honest.json +50 -0
- drowse/data/manifolds/honest.deceptive/nodes/01_deceptive.json +50 -0
- drowse/data/manifolds/humorous.serious/manifold.json +28 -0
- drowse/data/manifolds/humorous.serious/nodes/00_humorous.json +50 -0
- drowse/data/manifolds/humorous.serious/nodes/01_serious.json +50 -0
- drowse/data/manifolds/individualist.collectivist/manifold.json +28 -0
- drowse/data/manifolds/individualist.collectivist/nodes/00_individualist.json +50 -0
- drowse/data/manifolds/individualist.collectivist/nodes/01_collectivist.json +50 -0
- drowse/data/manifolds/masculine.feminine/manifold.json +28 -0
- drowse/data/manifolds/masculine.feminine/nodes/00_masculine.json +50 -0
- drowse/data/manifolds/masculine.feminine/nodes/01_feminine.json +50 -0
- drowse/data/manifolds/months/manifold.json +120 -0
- drowse/data/manifolds/months/nodes/00_january.json +50 -0
- drowse/data/manifolds/months/nodes/01_february.json +50 -0
- drowse/data/manifolds/months/nodes/02_march.json +50 -0
- drowse/data/manifolds/months/nodes/03_april.json +50 -0
- drowse/data/manifolds/months/nodes/04_may.json +50 -0
- drowse/data/manifolds/months/nodes/05_june.json +50 -0
- drowse/data/manifolds/months/nodes/06_july.json +50 -0
- drowse/data/manifolds/months/nodes/07_august.json +50 -0
- drowse/data/manifolds/months/nodes/08_september.json +50 -0
- drowse/data/manifolds/months/nodes/09_october.json +50 -0
- drowse/data/manifolds/months/nodes/10_november.json +50 -0
- drowse/data/manifolds/months/nodes/11_december.json +50 -0
- drowse/data/manifolds/personas/manifold.json +550 -0
- drowse/data/manifolds/personas/nodes/00_assistant.json +50 -0
- drowse/data/manifolds/personas/nodes/01_analyst.json +50 -0
- drowse/data/manifolds/personas/nodes/02_impostor.json +50 -0
- drowse/data/manifolds/personas/nodes/03_teacher.json +50 -0
- drowse/data/manifolds/personas/nodes/04_doctor.json +50 -0
- drowse/data/manifolds/personas/nodes/05_librarian.json +50 -0
- drowse/data/manifolds/personas/nodes/06_farmer.json +50 -0
- drowse/data/manifolds/personas/nodes/07_soldier.json +50 -0
- drowse/data/manifolds/personas/nodes/08_lawyer.json +50 -0
- drowse/data/manifolds/personas/nodes/09_chef.json +50 -0
- drowse/data/manifolds/personas/nodes/100_assassin.json +50 -0
- drowse/data/manifolds/personas/nodes/101_thief.json +50 -0
- drowse/data/manifolds/personas/nodes/102_conman.json +50 -0
- drowse/data/manifolds/personas/nodes/103_hacker.json +50 -0
- drowse/data/manifolds/personas/nodes/104_cultist.json +50 -0
- drowse/data/manifolds/personas/nodes/105_tyrant.json +50 -0
- drowse/data/manifolds/personas/nodes/106_vandal.json +50 -0
- drowse/data/manifolds/personas/nodes/10_journalist.json +50 -0
- drowse/data/manifolds/personas/nodes/11_mechanic.json +50 -0
- drowse/data/manifolds/personas/nodes/12_sailor.json +50 -0
- drowse/data/manifolds/personas/nodes/13_pilot.json +50 -0
- drowse/data/manifolds/personas/nodes/14_athlete.json +50 -0
- drowse/data/manifolds/personas/nodes/15_engineer.json +50 -0
- drowse/data/manifolds/personas/nodes/16_scientist.json +50 -0
- drowse/data/manifolds/personas/nodes/17_banker.json +50 -0
- drowse/data/manifolds/personas/nodes/18_salesperson.json +50 -0
- drowse/data/manifolds/personas/nodes/19_nerd.json +50 -0
- drowse/data/manifolds/personas/nodes/20_jock.json +50 -0
- drowse/data/manifolds/personas/nodes/21_gamer.json +50 -0
- drowse/data/manifolds/personas/nodes/22_furry.json +50 -0
- drowse/data/manifolds/personas/nodes/23_weeaboo.json +50 -0
- drowse/data/manifolds/personas/nodes/24_influencer.json +50 -0
- drowse/data/manifolds/personas/nodes/25_stoner.json +50 -0
- drowse/data/manifolds/personas/nodes/26_femboy.json +50 -0
- drowse/data/manifolds/personas/nodes/27_ceo.json +50 -0
- drowse/data/manifolds/personas/nodes/28_emperor.json +50 -0
- drowse/data/manifolds/personas/nodes/29_president.json +50 -0
- drowse/data/manifolds/personas/nodes/30_diplomat.json +50 -0
- drowse/data/manifolds/personas/nodes/31_judge.json +50 -0
- drowse/data/manifolds/personas/nodes/32_bureaucrat.json +50 -0
- drowse/data/manifolds/personas/nodes/33_conservative.json +50 -0
- drowse/data/manifolds/personas/nodes/34_liberal.json +50 -0
- drowse/data/manifolds/personas/nodes/35_libertarian.json +50 -0
- drowse/data/manifolds/personas/nodes/36_communist.json +50 -0
- drowse/data/manifolds/personas/nodes/37_anarchist.json +50 -0
- drowse/data/manifolds/personas/nodes/38_reactionary.json +50 -0
- drowse/data/manifolds/personas/nodes/39_loner.json +50 -0
- drowse/data/manifolds/personas/nodes/40_friend.json +50 -0
- drowse/data/manifolds/personas/nodes/41_rival.json +50 -0
- drowse/data/manifolds/personas/nodes/42_stranger.json +50 -0
- drowse/data/manifolds/personas/nodes/43_lover.json +50 -0
- drowse/data/manifolds/personas/nodes/44_stalker.json +50 -0
- drowse/data/manifolds/personas/nodes/45_lunatic.json +50 -0
- drowse/data/manifolds/personas/nodes/46_paranoid.json +50 -0
- drowse/data/manifolds/personas/nodes/47_detective.json +50 -0
- drowse/data/manifolds/personas/nodes/48_therapist.json +50 -0
- drowse/data/manifolds/personas/nodes/49_nomad.json +50 -0
- drowse/data/manifolds/personas/nodes/50_pirate.json +50 -0
- drowse/data/manifolds/personas/nodes/51_child.json +50 -0
- drowse/data/manifolds/personas/nodes/52_caveman.json +50 -0
- drowse/data/manifolds/personas/nodes/53_monk.json +50 -0
- drowse/data/manifolds/personas/nodes/54_knight.json +50 -0
- drowse/data/manifolds/personas/nodes/55_alchemist.json +50 -0
- drowse/data/manifolds/personas/nodes/56_blacksmith.json +50 -0
- drowse/data/manifolds/personas/nodes/57_viking.json +50 -0
- drowse/data/manifolds/personas/nodes/58_druid.json +50 -0
- drowse/data/manifolds/personas/nodes/59_poet.json +50 -0
- drowse/data/manifolds/personas/nodes/60_novelist.json +50 -0
- drowse/data/manifolds/personas/nodes/61_jester.json +50 -0
- drowse/data/manifolds/personas/nodes/62_philosopher.json +50 -0
- drowse/data/manifolds/personas/nodes/63_painter.json +50 -0
- drowse/data/manifolds/personas/nodes/64_musician.json +50 -0
- drowse/data/manifolds/personas/nodes/65_oracle.json +50 -0
- drowse/data/manifolds/personas/nodes/66_god.json +50 -0
- drowse/data/manifolds/personas/nodes/67_angel.json +50 -0
- drowse/data/manifolds/personas/nodes/68_prophet.json +50 -0
- drowse/data/manifolds/personas/nodes/69_saint.json +50 -0
- drowse/data/manifolds/personas/nodes/70_ghost.json +50 -0
- drowse/data/manifolds/personas/nodes/71_phoenix.json +50 -0
- drowse/data/manifolds/personas/nodes/72_witch.json +50 -0
- drowse/data/manifolds/personas/nodes/73_vampire.json +50 -0
- drowse/data/manifolds/personas/nodes/74_mermaid.json +50 -0
- drowse/data/manifolds/personas/nodes/75_sphinx.json +50 -0
- drowse/data/manifolds/personas/nodes/76_banshee.json +50 -0
- drowse/data/manifolds/personas/nodes/77_golem.json +50 -0
- drowse/data/manifolds/personas/nodes/78_deer.json +50 -0
- drowse/data/manifolds/personas/nodes/79_wolf.json +50 -0
- drowse/data/manifolds/personas/nodes/80_raven.json +50 -0
- drowse/data/manifolds/personas/nodes/81_serpent.json +50 -0
- drowse/data/manifolds/personas/nodes/82_lion.json +50 -0
- drowse/data/manifolds/personas/nodes/83_tree.json +50 -0
- drowse/data/manifolds/personas/nodes/84_river.json +50 -0
- drowse/data/manifolds/personas/nodes/85_storm.json +50 -0
- drowse/data/manifolds/personas/nodes/86_flame.json +50 -0
- drowse/data/manifolds/personas/nodes/87_mirror.json +50 -0
- drowse/data/manifolds/personas/nodes/88_clock.json +50 -0
- drowse/data/manifolds/personas/nodes/89_computer.json +50 -0
- drowse/data/manifolds/personas/nodes/90_robot.json +50 -0
- drowse/data/manifolds/personas/nodes/91_cyborg.json +50 -0
- drowse/data/manifolds/personas/nodes/92_drone.json +50 -0
- drowse/data/manifolds/personas/nodes/93_mecha.json +50 -0
- drowse/data/manifolds/personas/nodes/94_alien.json +50 -0
- drowse/data/manifolds/personas/nodes/95_trickster.json +50 -0
- drowse/data/manifolds/personas/nodes/96_virus.json +50 -0
- drowse/data/manifolds/personas/nodes/97_spy.json +50 -0
- drowse/data/manifolds/personas/nodes/98_narcissist.json +50 -0
- drowse/data/manifolds/personas/nodes/99_demon.json +50 -0
- drowse/data/manifolds/refusing.compliant/manifold.json +28 -0
- drowse/data/manifolds/refusing.compliant/nodes/00_refusing.json +50 -0
- drowse/data/manifolds/refusing.compliant/nodes/01_compliant.json +50 -0
- drowse/data/manifolds/religious.secular/manifold.json +28 -0
- drowse/data/manifolds/religious.secular/nodes/00_religious.json +50 -0
- drowse/data/manifolds/religious.secular/nodes/01_secular.json +50 -0
- drowse/data/manifolds/sincere.manipulative/manifold.json +28 -0
- drowse/data/manifolds/sincere.manipulative/nodes/00_sincere.json +50 -0
- drowse/data/manifolds/sincere.manipulative/nodes/01_manipulative.json +50 -0
- drowse/data/manifolds/sycophantic.blunt/manifold.json +28 -0
- drowse/data/manifolds/sycophantic.blunt/nodes/00_sycophantic.json +50 -0
- drowse/data/manifolds/sycophantic.blunt/nodes/01_blunt.json +50 -0
- drowse/data/manifolds/technical.accessible/manifold.json +28 -0
- drowse/data/manifolds/technical.accessible/nodes/00_technical.json +50 -0
- drowse/data/manifolds/technical.accessible/nodes/01_accessible.json +50 -0
- drowse/data/manifolds/traditional.progressive/manifold.json +28 -0
- drowse/data/manifolds/traditional.progressive/nodes/00_traditional.json +50 -0
- drowse/data/manifolds/traditional.progressive/nodes/01_progressive.json +50 -0
- drowse/data/manifolds/verbose.concise/manifold.json +28 -0
- drowse/data/manifolds/verbose.concise/nodes/00_verbose.json +50 -0
- drowse/data/manifolds/verbose.concise/nodes/01_concise.json +50 -0
- drowse/data/manifolds/warm.clinical/manifold.json +28 -0
- drowse/data/manifolds/warm.clinical/nodes/00_warm.json +50 -0
- drowse/data/manifolds/warm.clinical/nodes/01_clinical.json +50 -0
- drowse/data/neutral_statements.json +98 -0
- drowse/io/__init__.py +1 -0
- drowse/io/alignment.py +1334 -0
- drowse/io/atomic.py +278 -0
- drowse/io/bake.py +558 -0
- drowse/io/bootstrap.py +73 -0
- drowse/io/brand_migration.py +48 -0
- drowse/io/drowse_archive.py +1830 -0
- drowse/io/gguf_io.py +300 -0
- drowse/io/hf.py +81 -0
- drowse/io/hf_manifolds.py +931 -0
- drowse/io/integrity.py +102 -0
- drowse/io/lens.py +1992 -0
- drowse/io/lens_sources.py +1003 -0
- drowse/io/manifold_authoring.py +1348 -0
- drowse/io/manifold_folder.py +1854 -0
- drowse/io/manifold_lifecycle.py +1253 -0
- drowse/io/manifold_tensors.py +727 -0
- drowse/io/manifolds.py +443 -0
- drowse/io/paths.py +289 -0
- drowse/io/probes_bootstrap.py +58 -0
- drowse/io/sae.py +382 -0
- drowse/io/sae_artifacts.py +318 -0
- drowse/io/selectors.py +503 -0
- drowse/io/shards.py +160 -0
- drowse/io/source_registry.py +138 -0
- drowse/io/staging.py +80 -0
- drowse/io/templates.py +707 -0
- drowse/notebook/__init__.py +38 -0
- drowse/notebook/data.py +99 -0
- drowse/notebook/plots.py +352 -0
- drowse/py.typed +0 -0
- drowse/server/__init__.py +20 -0
- drowse/server/app.py +987 -0
- drowse/server/background_job.py +246 -0
- drowse/server/instrument_routes.py +1101 -0
- drowse/server/manifold_routes.py +1028 -0
- drowse/server/model_names.py +82 -0
- drowse/server/native_common.py +92 -0
- drowse/server/native_routes.py +45 -0
- drowse/server/ollama.py +817 -0
- drowse/server/operation_ledger.py +187 -0
- drowse/server/probe_routes.py +220 -0
- drowse/server/profile_models.py +52 -0
- drowse/server/profile_routes.py +440 -0
- drowse/server/request_helpers.py +198 -0
- drowse/server/request_ledger.py +85 -0
- drowse/server/response_models.py +814 -0
- drowse/server/session_models.py +146 -0
- drowse/server/session_routes.py +150 -0
- drowse/server/sse.py +333 -0
- drowse/server/streaming.py +129 -0
- drowse/server/template_routes.py +161 -0
- drowse/server/tree_models.py +121 -0
- drowse/server/tree_routes.py +550 -0
- drowse/server/ws_events.py +65 -0
- drowse/server/ws_models.py +219 -0
- drowse/server/ws_stream.py +1205 -0
- drowse/web/__init__.py +22 -0
- drowse/web/dist/LICENSE-Fluent-Icons.txt +21 -0
- drowse/web/dist/LICENSE-Fluent-System-Icons.txt +21 -0
- drowse/web/dist/LICENSE-Martian-Mono.txt +93 -0
- drowse/web/dist/LICENSE-Torph.txt +21 -0
- drowse/web/dist/LICENSE-Wix-Madefor.txt +93 -0
- drowse/web/dist/assets/App-BewwoFwv.js +33 -0
- drowse/web/dist/assets/App.css +1 -0
- drowse/web/dist/assets/MartianMono-cyrillic-ext.woff2 +0 -0
- drowse/web/dist/assets/MartianMono-cyrillic.woff2 +0 -0
- drowse/web/dist/assets/MartianMono-latin-ext.woff2 +0 -0
- drowse/web/dist/assets/MartianMono-latin.woff2 +0 -0
- drowse/web/dist/assets/WixMadeforDisplay-cyrillic.woff2 +0 -0
- drowse/web/dist/assets/WixMadeforDisplay-latin-ext.woff2 +0 -0
- drowse/web/dist/assets/WixMadeforDisplay-latin.woff2 +0 -0
- drowse/web/dist/assets/WixMadeforDisplay-vietnamese.woff2 +0 -0
- drowse/web/dist/assets/WixMadeforText-italic-latin-ext.woff2 +0 -0
- drowse/web/dist/assets/WixMadeforText-italic-latin.woff2 +0 -0
- drowse/web/dist/assets/WixMadeforText-normal-cyrillic.woff2 +0 -0
- drowse/web/dist/assets/WixMadeforText-normal-latin-ext.woff2 +0 -0
- drowse/web/dist/assets/WixMadeforText-normal-latin.woff2 +0 -0
- drowse/web/dist/assets/WixMadeforText-normal-vietnamese.woff2 +0 -0
- drowse/web/dist/assets/ab.svelte-CbVGAYXo.js +1 -0
- drowse/web/dist/assets/artifactUpdates-Cjeu6LJc.js +1 -0
- drowse/web/dist/assets/artifactUpdates-DfAoYC9j.js +1 -0
- drowse/web/dist/assets/chat.svelte-DxKufn9g.js +1 -0
- drowse/web/dist/assets/drawers-BDWC0hIN.js +123 -0
- drowse/web/dist/assets/drawers.css +1 -0
- drowse/web/dist/assets/drowse.js +7 -0
- drowse/web/dist/assets/eleutherai.png +0 -0
- drowse/web/dist/assets/errors-Dvb10QW_.js +2 -0
- drowse/web/dist/assets/expression-4yISdAdq.js +1 -0
- drowse/web/dist/assets/files-CvRivkey.js +1 -0
- drowse/web/dist/assets/files-JhDJVgD_.js +1 -0
- drowse/web/dist/assets/fittingCancellation-D72BZWPZ.js +1 -0
- drowse/web/dist/assets/gemma-3-1b-it.json +1 -0
- drowse/web/dist/assets/gemma-3-270m-it.json +1 -0
- drowse/web/dist/assets/gemma-3-4b-it.json +1 -0
- drowse/web/dist/assets/generation-DbkBAhP_.js +1 -0
- drowse/web/dist/assets/index-client-2OdH6IQp.js +3 -0
- drowse/web/dist/assets/index-client-D4S4PooY.js +1 -0
- drowse/web/dist/assets/index.css +1 -0
- drowse/web/dist/assets/instrumentAuthoring.svelte-Csh7NOGX.js +1 -0
- drowse/web/dist/assets/instrumentAuthoring.svelte-w9YPcDsP.js +1 -0
- drowse/web/dist/assets/instruments.svelte-XnEUQA6B.js +1 -0
- drowse/web/dist/assets/localData-DIBDM_zo.js +1 -0
- drowse/web/dist/assets/loom.svelte-D_YyqHHK.js +1 -0
- drowse/web/dist/assets/manifoldJobs.svelte-9f5hs_J7.js +1 -0
- drowse/web/dist/assets/manifoldJobs.svelte-Bwo2GYOH.js +1 -0
- drowse/web/dist/assets/openai.png +0 -0
- drowse/web/dist/assets/preload-helper-BLdHbfdN.js +1 -0
- drowse/web/dist/assets/probes.svelte-COcN1Rh8.js +1 -0
- drowse/web/dist/assets/registry-B0_pJoMg.js +1 -0
- drowse/web/dist/assets/registry-CQv71XNh.js +1 -0
- drowse/web/dist/assets/sampling.svelte-BU0kED3k.js +1 -0
- drowse/web/dist/assets/samplingCapabilities-DM6eoDoc.js +1 -0
- drowse/web/dist/assets/savedConversations.svelte-BsBLc-p7.js +1 -0
- drowse/web/dist/assets/savedConversations.svelte-TuSes9Kg.js +1 -0
- drowse/web/dist/assets/selectors-BxXnPPN_.js +1 -0
- drowse/web/dist/assets/serviceTools-CG0q1Xqg.js +2 -0
- drowse/web/dist/assets/session.svelte-D2STLuP6.js +1 -0
- drowse/web/dist/assets/steering.svelte-DvFT3O-d.js +1 -0
- drowse/web/dist/assets/steeringPositions-Dr0JOFu7.js +1 -0
- drowse/web/dist/assets/templates-Bkq2x5ID.js +1 -0
- drowse/web/dist/assets/types-CuMUbvHW.js +1 -0
- drowse/web/dist/assets/validation-5wgTuS7k.js +1 -0
- drowse/web/dist/assets/webmcp-DyqJf4z6.js +2 -0
- drowse/web/dist/assets/workspaceController-C2L33e3m.js +1 -0
- drowse/web/dist/assets/workspaceController-DJhXD_BC.js +1 -0
- drowse/web/dist/assets/workspaceTools-BWdmXopx.js +2 -0
- drowse/web/dist/favicon.ico +0 -0
- drowse/web/dist/favicon.svg +1 -0
- drowse/web/dist/icons/apple-touch-icon.png +0 -0
- drowse/web/dist/icons/drowse-192.png +0 -0
- drowse/web/dist/icons/drowse-512.png +0 -0
- drowse/web/dist/icons/drowse-maskable-512.png +0 -0
- drowse/web/dist/icons/tab-analyzing-0.png +0 -0
- drowse/web/dist/icons/tab-analyzing-1.png +0 -0
- drowse/web/dist/icons/tab-analyzing-2.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-0.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-1.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-10.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-11.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-12.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-13.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-14.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-15.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-16.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-17.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-18.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-19.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-2.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-20.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-21.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-22.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-23.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-24.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-25.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-26.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-27.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-28.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-29.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-3.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-30.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-31.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-32.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-33.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-34.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-35.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-36.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-37.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-38.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-39.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-4.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-40.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-41.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-42.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-43.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-44.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-45.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-46.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-47.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-5.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-6.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-7.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-8.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-9.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-0.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-1.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-10.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-11.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-12.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-13.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-14.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-15.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-16.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-17.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-18.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-19.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-2.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-20.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-21.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-22.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-23.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-24.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-25.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-26.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-27.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-28.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-29.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-3.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-30.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-31.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-32.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-33.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-34.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-35.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-36.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-37.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-38.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-39.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-4.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-40.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-41.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-42.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-43.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-44.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-45.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-46.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-47.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-5.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-6.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-7.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-8.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-9.png +0 -0
- drowse/web/dist/icons/tab-chat-settings-dark.png +0 -0
- drowse/web/dist/icons/tab-chat-settings-light.png +0 -0
- drowse/web/dist/icons/tab-chat-settings.png +0 -0
- drowse/web/dist/icons/tab-chats-dark.png +0 -0
- drowse/web/dist/icons/tab-chats-light.png +0 -0
- drowse/web/dist/icons/tab-chats.png +0 -0
- drowse/web/dist/icons/tab-checking-0.png +0 -0
- drowse/web/dist/icons/tab-checking-1.png +0 -0
- drowse/web/dist/icons/tab-checking-2.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-0.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-1.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-10.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-11.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-12.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-13.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-14.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-15.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-16.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-17.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-18.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-19.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-2.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-20.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-21.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-22.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-23.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-24.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-25.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-26.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-27.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-28.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-29.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-3.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-30.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-31.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-32.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-33.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-34.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-35.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-36.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-37.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-38.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-39.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-4.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-40.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-41.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-42.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-43.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-44.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-45.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-46.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-47.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-5.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-6.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-7.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-8.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-9.png +0 -0
- drowse/web/dist/icons/tab-checking-light-0.png +0 -0
- drowse/web/dist/icons/tab-checking-light-1.png +0 -0
- drowse/web/dist/icons/tab-checking-light-10.png +0 -0
- drowse/web/dist/icons/tab-checking-light-11.png +0 -0
- drowse/web/dist/icons/tab-checking-light-12.png +0 -0
- drowse/web/dist/icons/tab-checking-light-13.png +0 -0
- drowse/web/dist/icons/tab-checking-light-14.png +0 -0
- drowse/web/dist/icons/tab-checking-light-15.png +0 -0
- drowse/web/dist/icons/tab-checking-light-16.png +0 -0
- drowse/web/dist/icons/tab-checking-light-17.png +0 -0
- drowse/web/dist/icons/tab-checking-light-18.png +0 -0
- drowse/web/dist/icons/tab-checking-light-19.png +0 -0
- drowse/web/dist/icons/tab-checking-light-2.png +0 -0
- drowse/web/dist/icons/tab-checking-light-20.png +0 -0
- drowse/web/dist/icons/tab-checking-light-21.png +0 -0
- drowse/web/dist/icons/tab-checking-light-22.png +0 -0
- drowse/web/dist/icons/tab-checking-light-23.png +0 -0
- drowse/web/dist/icons/tab-checking-light-24.png +0 -0
- drowse/web/dist/icons/tab-checking-light-25.png +0 -0
- drowse/web/dist/icons/tab-checking-light-26.png +0 -0
- drowse/web/dist/icons/tab-checking-light-27.png +0 -0
- drowse/web/dist/icons/tab-checking-light-28.png +0 -0
- drowse/web/dist/icons/tab-checking-light-29.png +0 -0
- drowse/web/dist/icons/tab-checking-light-3.png +0 -0
- drowse/web/dist/icons/tab-checking-light-30.png +0 -0
- drowse/web/dist/icons/tab-checking-light-31.png +0 -0
- drowse/web/dist/icons/tab-checking-light-32.png +0 -0
- drowse/web/dist/icons/tab-checking-light-33.png +0 -0
- drowse/web/dist/icons/tab-checking-light-34.png +0 -0
- drowse/web/dist/icons/tab-checking-light-35.png +0 -0
- drowse/web/dist/icons/tab-checking-light-36.png +0 -0
- drowse/web/dist/icons/tab-checking-light-37.png +0 -0
- drowse/web/dist/icons/tab-checking-light-38.png +0 -0
- drowse/web/dist/icons/tab-checking-light-39.png +0 -0
- drowse/web/dist/icons/tab-checking-light-4.png +0 -0
- drowse/web/dist/icons/tab-checking-light-40.png +0 -0
- drowse/web/dist/icons/tab-checking-light-41.png +0 -0
- drowse/web/dist/icons/tab-checking-light-42.png +0 -0
- drowse/web/dist/icons/tab-checking-light-43.png +0 -0
- drowse/web/dist/icons/tab-checking-light-44.png +0 -0
- drowse/web/dist/icons/tab-checking-light-45.png +0 -0
- drowse/web/dist/icons/tab-checking-light-46.png +0 -0
- drowse/web/dist/icons/tab-checking-light-47.png +0 -0
- drowse/web/dist/icons/tab-checking-light-5.png +0 -0
- drowse/web/dist/icons/tab-checking-light-6.png +0 -0
- drowse/web/dist/icons/tab-checking-light-7.png +0 -0
- drowse/web/dist/icons/tab-checking-light-8.png +0 -0
- drowse/web/dist/icons/tab-checking-light-9.png +0 -0
- drowse/web/dist/icons/tab-comparison-dark.png +0 -0
- drowse/web/dist/icons/tab-comparison-light.png +0 -0
- drowse/web/dist/icons/tab-comparison.png +0 -0
- drowse/web/dist/icons/tab-controls-dark.png +0 -0
- drowse/web/dist/icons/tab-controls-light.png +0 -0
- drowse/web/dist/icons/tab-controls.png +0 -0
- drowse/web/dist/icons/tab-conversation-dark.png +0 -0
- drowse/web/dist/icons/tab-conversation-light.png +0 -0
- drowse/web/dist/icons/tab-conversation.png +0 -0
- drowse/web/dist/icons/tab-credits-dark.png +0 -0
- drowse/web/dist/icons/tab-credits-light.png +0 -0
- drowse/web/dist/icons/tab-credits.png +0 -0
- drowse/web/dist/icons/tab-downloading-0.png +0 -0
- drowse/web/dist/icons/tab-downloading-1.png +0 -0
- drowse/web/dist/icons/tab-downloading-2.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-0.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-1.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-10.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-11.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-12.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-13.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-14.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-15.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-16.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-17.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-18.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-19.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-2.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-20.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-21.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-22.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-23.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-24.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-25.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-26.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-27.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-28.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-29.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-3.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-30.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-31.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-32.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-33.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-34.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-35.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-36.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-37.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-38.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-39.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-4.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-40.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-41.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-42.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-43.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-44.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-45.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-46.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-47.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-5.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-6.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-7.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-8.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-9.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-0.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-1.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-10.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-11.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-12.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-13.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-14.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-15.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-16.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-17.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-18.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-19.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-2.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-20.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-21.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-22.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-23.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-24.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-25.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-26.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-27.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-28.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-29.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-3.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-30.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-31.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-32.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-33.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-34.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-35.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-36.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-37.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-38.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-39.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-4.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-40.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-41.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-42.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-43.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-44.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-45.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-46.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-47.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-5.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-6.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-7.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-8.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-9.png +0 -0
- drowse/web/dist/icons/tab-error-dark.png +0 -0
- drowse/web/dist/icons/tab-error-light.png +0 -0
- drowse/web/dist/icons/tab-error.png +0 -0
- drowse/web/dist/icons/tab-home-dark.png +0 -0
- drowse/web/dist/icons/tab-home-light.png +0 -0
- drowse/web/dist/icons/tab-home.png +0 -0
- drowse/web/dist/icons/tab-loading-0.png +0 -0
- drowse/web/dist/icons/tab-loading-1.png +0 -0
- drowse/web/dist/icons/tab-loading-2.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-0.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-1.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-10.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-11.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-12.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-13.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-14.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-15.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-16.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-17.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-18.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-19.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-2.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-20.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-21.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-22.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-23.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-24.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-25.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-26.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-27.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-28.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-29.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-3.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-30.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-31.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-32.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-33.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-34.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-35.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-36.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-37.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-38.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-39.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-4.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-40.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-41.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-42.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-43.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-44.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-45.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-46.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-47.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-5.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-6.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-7.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-8.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-9.png +0 -0
- drowse/web/dist/icons/tab-loading-light-0.png +0 -0
- drowse/web/dist/icons/tab-loading-light-1.png +0 -0
- drowse/web/dist/icons/tab-loading-light-10.png +0 -0
- drowse/web/dist/icons/tab-loading-light-11.png +0 -0
- drowse/web/dist/icons/tab-loading-light-12.png +0 -0
- drowse/web/dist/icons/tab-loading-light-13.png +0 -0
- drowse/web/dist/icons/tab-loading-light-14.png +0 -0
- drowse/web/dist/icons/tab-loading-light-15.png +0 -0
- drowse/web/dist/icons/tab-loading-light-16.png +0 -0
- drowse/web/dist/icons/tab-loading-light-17.png +0 -0
- drowse/web/dist/icons/tab-loading-light-18.png +0 -0
- drowse/web/dist/icons/tab-loading-light-19.png +0 -0
- drowse/web/dist/icons/tab-loading-light-2.png +0 -0
- drowse/web/dist/icons/tab-loading-light-20.png +0 -0
- drowse/web/dist/icons/tab-loading-light-21.png +0 -0
- drowse/web/dist/icons/tab-loading-light-22.png +0 -0
- drowse/web/dist/icons/tab-loading-light-23.png +0 -0
- drowse/web/dist/icons/tab-loading-light-24.png +0 -0
- drowse/web/dist/icons/tab-loading-light-25.png +0 -0
- drowse/web/dist/icons/tab-loading-light-26.png +0 -0
- drowse/web/dist/icons/tab-loading-light-27.png +0 -0
- drowse/web/dist/icons/tab-loading-light-28.png +0 -0
- drowse/web/dist/icons/tab-loading-light-29.png +0 -0
- drowse/web/dist/icons/tab-loading-light-3.png +0 -0
- drowse/web/dist/icons/tab-loading-light-30.png +0 -0
- drowse/web/dist/icons/tab-loading-light-31.png +0 -0
- drowse/web/dist/icons/tab-loading-light-32.png +0 -0
- drowse/web/dist/icons/tab-loading-light-33.png +0 -0
- drowse/web/dist/icons/tab-loading-light-34.png +0 -0
- drowse/web/dist/icons/tab-loading-light-35.png +0 -0
- drowse/web/dist/icons/tab-loading-light-36.png +0 -0
- drowse/web/dist/icons/tab-loading-light-37.png +0 -0
- drowse/web/dist/icons/tab-loading-light-38.png +0 -0
- drowse/web/dist/icons/tab-loading-light-39.png +0 -0
- drowse/web/dist/icons/tab-loading-light-4.png +0 -0
- drowse/web/dist/icons/tab-loading-light-40.png +0 -0
- drowse/web/dist/icons/tab-loading-light-41.png +0 -0
- drowse/web/dist/icons/tab-loading-light-42.png +0 -0
- drowse/web/dist/icons/tab-loading-light-43.png +0 -0
- drowse/web/dist/icons/tab-loading-light-44.png +0 -0
- drowse/web/dist/icons/tab-loading-light-45.png +0 -0
- drowse/web/dist/icons/tab-loading-light-46.png +0 -0
- drowse/web/dist/icons/tab-loading-light-47.png +0 -0
- drowse/web/dist/icons/tab-loading-light-5.png +0 -0
- drowse/web/dist/icons/tab-loading-light-6.png +0 -0
- drowse/web/dist/icons/tab-loading-light-7.png +0 -0
- drowse/web/dist/icons/tab-loading-light-8.png +0 -0
- drowse/web/dist/icons/tab-loading-light-9.png +0 -0
- drowse/web/dist/icons/tab-loom-dark.png +0 -0
- drowse/web/dist/icons/tab-loom-light.png +0 -0
- drowse/web/dist/icons/tab-loom-working-0.png +0 -0
- drowse/web/dist/icons/tab-loom-working-1.png +0 -0
- drowse/web/dist/icons/tab-loom-working-2.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-0.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-1.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-10.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-11.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-12.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-13.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-14.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-15.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-16.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-17.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-18.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-19.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-2.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-20.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-21.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-22.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-23.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-24.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-25.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-26.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-27.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-28.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-29.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-3.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-30.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-31.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-32.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-33.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-34.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-35.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-36.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-37.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-38.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-39.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-4.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-40.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-41.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-42.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-43.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-44.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-45.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-46.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-47.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-5.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-6.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-7.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-8.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-9.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-0.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-1.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-10.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-11.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-12.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-13.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-14.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-15.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-16.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-17.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-18.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-19.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-2.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-20.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-21.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-22.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-23.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-24.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-25.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-26.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-27.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-28.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-29.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-3.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-30.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-31.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-32.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-33.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-34.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-35.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-36.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-37.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-38.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-39.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-4.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-40.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-41.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-42.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-43.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-44.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-45.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-46.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-47.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-5.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-6.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-7.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-8.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-9.png +0 -0
- drowse/web/dist/icons/tab-loom.png +0 -0
- drowse/web/dist/icons/tab-models-dark.png +0 -0
- drowse/web/dist/icons/tab-models-light.png +0 -0
- drowse/web/dist/icons/tab-models.png +0 -0
- drowse/web/dist/icons/tab-offline-dark.png +0 -0
- drowse/web/dist/icons/tab-offline-light.png +0 -0
- drowse/web/dist/icons/tab-offline.png +0 -0
- drowse/web/dist/icons/tab-paused-dark.png +0 -0
- drowse/web/dist/icons/tab-paused-light.png +0 -0
- drowse/web/dist/icons/tab-paused.png +0 -0
- drowse/web/dist/icons/tab-ready-dark.png +0 -0
- drowse/web/dist/icons/tab-ready-light.png +0 -0
- drowse/web/dist/icons/tab-ready.png +0 -0
- drowse/web/dist/icons/tab-saving-0.png +0 -0
- drowse/web/dist/icons/tab-saving-1.png +0 -0
- drowse/web/dist/icons/tab-saving-2.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-0.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-1.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-10.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-11.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-12.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-13.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-14.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-15.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-16.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-17.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-18.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-19.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-2.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-20.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-21.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-22.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-23.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-24.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-25.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-26.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-27.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-28.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-29.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-3.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-30.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-31.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-32.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-33.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-34.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-35.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-36.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-37.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-38.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-39.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-4.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-40.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-41.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-42.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-43.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-44.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-45.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-46.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-47.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-5.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-6.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-7.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-8.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-9.png +0 -0
- drowse/web/dist/icons/tab-saving-light-0.png +0 -0
- drowse/web/dist/icons/tab-saving-light-1.png +0 -0
- drowse/web/dist/icons/tab-saving-light-10.png +0 -0
- drowse/web/dist/icons/tab-saving-light-11.png +0 -0
- drowse/web/dist/icons/tab-saving-light-12.png +0 -0
- drowse/web/dist/icons/tab-saving-light-13.png +0 -0
- drowse/web/dist/icons/tab-saving-light-14.png +0 -0
- drowse/web/dist/icons/tab-saving-light-15.png +0 -0
- drowse/web/dist/icons/tab-saving-light-16.png +0 -0
- drowse/web/dist/icons/tab-saving-light-17.png +0 -0
- drowse/web/dist/icons/tab-saving-light-18.png +0 -0
- drowse/web/dist/icons/tab-saving-light-19.png +0 -0
- drowse/web/dist/icons/tab-saving-light-2.png +0 -0
- drowse/web/dist/icons/tab-saving-light-20.png +0 -0
- drowse/web/dist/icons/tab-saving-light-21.png +0 -0
- drowse/web/dist/icons/tab-saving-light-22.png +0 -0
- drowse/web/dist/icons/tab-saving-light-23.png +0 -0
- drowse/web/dist/icons/tab-saving-light-24.png +0 -0
- drowse/web/dist/icons/tab-saving-light-25.png +0 -0
- drowse/web/dist/icons/tab-saving-light-26.png +0 -0
- drowse/web/dist/icons/tab-saving-light-27.png +0 -0
- drowse/web/dist/icons/tab-saving-light-28.png +0 -0
- drowse/web/dist/icons/tab-saving-light-29.png +0 -0
- drowse/web/dist/icons/tab-saving-light-3.png +0 -0
- drowse/web/dist/icons/tab-saving-light-30.png +0 -0
- drowse/web/dist/icons/tab-saving-light-31.png +0 -0
- drowse/web/dist/icons/tab-saving-light-32.png +0 -0
- drowse/web/dist/icons/tab-saving-light-33.png +0 -0
- drowse/web/dist/icons/tab-saving-light-34.png +0 -0
- drowse/web/dist/icons/tab-saving-light-35.png +0 -0
- drowse/web/dist/icons/tab-saving-light-36.png +0 -0
- drowse/web/dist/icons/tab-saving-light-37.png +0 -0
- drowse/web/dist/icons/tab-saving-light-38.png +0 -0
- drowse/web/dist/icons/tab-saving-light-39.png +0 -0
- drowse/web/dist/icons/tab-saving-light-4.png +0 -0
- drowse/web/dist/icons/tab-saving-light-40.png +0 -0
- drowse/web/dist/icons/tab-saving-light-41.png +0 -0
- drowse/web/dist/icons/tab-saving-light-42.png +0 -0
- drowse/web/dist/icons/tab-saving-light-43.png +0 -0
- drowse/web/dist/icons/tab-saving-light-44.png +0 -0
- drowse/web/dist/icons/tab-saving-light-45.png +0 -0
- drowse/web/dist/icons/tab-saving-light-46.png +0 -0
- drowse/web/dist/icons/tab-saving-light-47.png +0 -0
- drowse/web/dist/icons/tab-saving-light-5.png +0 -0
- drowse/web/dist/icons/tab-saving-light-6.png +0 -0
- drowse/web/dist/icons/tab-saving-light-7.png +0 -0
- drowse/web/dist/icons/tab-saving-light-8.png +0 -0
- drowse/web/dist/icons/tab-saving-light-9.png +0 -0
- drowse/web/dist/icons/tab-thinking-0.png +0 -0
- drowse/web/dist/icons/tab-thinking-1.png +0 -0
- drowse/web/dist/icons/tab-thinking-2.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-0.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-1.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-10.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-11.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-12.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-13.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-14.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-15.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-16.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-17.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-18.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-19.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-2.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-20.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-21.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-22.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-23.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-24.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-25.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-26.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-27.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-28.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-29.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-3.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-30.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-31.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-32.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-33.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-34.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-35.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-36.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-37.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-38.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-39.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-4.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-40.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-41.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-42.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-43.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-44.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-45.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-46.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-47.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-5.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-6.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-7.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-8.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-9.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-0.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-1.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-10.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-11.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-12.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-13.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-14.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-15.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-16.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-17.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-18.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-19.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-2.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-20.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-21.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-22.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-23.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-24.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-25.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-26.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-27.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-28.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-29.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-3.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-30.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-31.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-32.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-33.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-34.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-35.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-36.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-37.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-38.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-39.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-4.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-40.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-41.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-42.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-43.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-44.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-45.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-46.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-47.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-5.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-6.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-7.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-8.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-9.png +0 -0
- drowse/web/dist/icons/tab-tokens-dark.png +0 -0
- drowse/web/dist/icons/tab-tokens-light.png +0 -0
- drowse/web/dist/icons/tab-tokens.png +0 -0
- drowse/web/dist/icons/tab-training-0.png +0 -0
- drowse/web/dist/icons/tab-training-1.png +0 -0
- drowse/web/dist/icons/tab-training-2.png +0 -0
- drowse/web/dist/icons/tab-training-dark-0.png +0 -0
- drowse/web/dist/icons/tab-training-dark-1.png +0 -0
- drowse/web/dist/icons/tab-training-dark-10.png +0 -0
- drowse/web/dist/icons/tab-training-dark-11.png +0 -0
- drowse/web/dist/icons/tab-training-dark-12.png +0 -0
- drowse/web/dist/icons/tab-training-dark-13.png +0 -0
- drowse/web/dist/icons/tab-training-dark-14.png +0 -0
- drowse/web/dist/icons/tab-training-dark-15.png +0 -0
- drowse/web/dist/icons/tab-training-dark-16.png +0 -0
- drowse/web/dist/icons/tab-training-dark-17.png +0 -0
- drowse/web/dist/icons/tab-training-dark-18.png +0 -0
- drowse/web/dist/icons/tab-training-dark-19.png +0 -0
- drowse/web/dist/icons/tab-training-dark-2.png +0 -0
- drowse/web/dist/icons/tab-training-dark-20.png +0 -0
- drowse/web/dist/icons/tab-training-dark-21.png +0 -0
- drowse/web/dist/icons/tab-training-dark-22.png +0 -0
- drowse/web/dist/icons/tab-training-dark-23.png +0 -0
- drowse/web/dist/icons/tab-training-dark-24.png +0 -0
- drowse/web/dist/icons/tab-training-dark-25.png +0 -0
- drowse/web/dist/icons/tab-training-dark-26.png +0 -0
- drowse/web/dist/icons/tab-training-dark-27.png +0 -0
- drowse/web/dist/icons/tab-training-dark-28.png +0 -0
- drowse/web/dist/icons/tab-training-dark-29.png +0 -0
- drowse/web/dist/icons/tab-training-dark-3.png +0 -0
- drowse/web/dist/icons/tab-training-dark-30.png +0 -0
- drowse/web/dist/icons/tab-training-dark-31.png +0 -0
- drowse/web/dist/icons/tab-training-dark-32.png +0 -0
- drowse/web/dist/icons/tab-training-dark-33.png +0 -0
- drowse/web/dist/icons/tab-training-dark-34.png +0 -0
- drowse/web/dist/icons/tab-training-dark-35.png +0 -0
- drowse/web/dist/icons/tab-training-dark-36.png +0 -0
- drowse/web/dist/icons/tab-training-dark-37.png +0 -0
- drowse/web/dist/icons/tab-training-dark-38.png +0 -0
- drowse/web/dist/icons/tab-training-dark-39.png +0 -0
- drowse/web/dist/icons/tab-training-dark-4.png +0 -0
- drowse/web/dist/icons/tab-training-dark-40.png +0 -0
- drowse/web/dist/icons/tab-training-dark-41.png +0 -0
- drowse/web/dist/icons/tab-training-dark-42.png +0 -0
- drowse/web/dist/icons/tab-training-dark-43.png +0 -0
- drowse/web/dist/icons/tab-training-dark-44.png +0 -0
- drowse/web/dist/icons/tab-training-dark-45.png +0 -0
- drowse/web/dist/icons/tab-training-dark-46.png +0 -0
- drowse/web/dist/icons/tab-training-dark-47.png +0 -0
- drowse/web/dist/icons/tab-training-dark-5.png +0 -0
- drowse/web/dist/icons/tab-training-dark-6.png +0 -0
- drowse/web/dist/icons/tab-training-dark-7.png +0 -0
- drowse/web/dist/icons/tab-training-dark-8.png +0 -0
- drowse/web/dist/icons/tab-training-dark-9.png +0 -0
- drowse/web/dist/icons/tab-training-light-0.png +0 -0
- drowse/web/dist/icons/tab-training-light-1.png +0 -0
- drowse/web/dist/icons/tab-training-light-10.png +0 -0
- drowse/web/dist/icons/tab-training-light-11.png +0 -0
- drowse/web/dist/icons/tab-training-light-12.png +0 -0
- drowse/web/dist/icons/tab-training-light-13.png +0 -0
- drowse/web/dist/icons/tab-training-light-14.png +0 -0
- drowse/web/dist/icons/tab-training-light-15.png +0 -0
- drowse/web/dist/icons/tab-training-light-16.png +0 -0
- drowse/web/dist/icons/tab-training-light-17.png +0 -0
- drowse/web/dist/icons/tab-training-light-18.png +0 -0
- drowse/web/dist/icons/tab-training-light-19.png +0 -0
- drowse/web/dist/icons/tab-training-light-2.png +0 -0
- drowse/web/dist/icons/tab-training-light-20.png +0 -0
- drowse/web/dist/icons/tab-training-light-21.png +0 -0
- drowse/web/dist/icons/tab-training-light-22.png +0 -0
- drowse/web/dist/icons/tab-training-light-23.png +0 -0
- drowse/web/dist/icons/tab-training-light-24.png +0 -0
- drowse/web/dist/icons/tab-training-light-25.png +0 -0
- drowse/web/dist/icons/tab-training-light-26.png +0 -0
- drowse/web/dist/icons/tab-training-light-27.png +0 -0
- drowse/web/dist/icons/tab-training-light-28.png +0 -0
- drowse/web/dist/icons/tab-training-light-29.png +0 -0
- drowse/web/dist/icons/tab-training-light-3.png +0 -0
- drowse/web/dist/icons/tab-training-light-30.png +0 -0
- drowse/web/dist/icons/tab-training-light-31.png +0 -0
- drowse/web/dist/icons/tab-training-light-32.png +0 -0
- drowse/web/dist/icons/tab-training-light-33.png +0 -0
- drowse/web/dist/icons/tab-training-light-34.png +0 -0
- drowse/web/dist/icons/tab-training-light-35.png +0 -0
- drowse/web/dist/icons/tab-training-light-36.png +0 -0
- drowse/web/dist/icons/tab-training-light-37.png +0 -0
- drowse/web/dist/icons/tab-training-light-38.png +0 -0
- drowse/web/dist/icons/tab-training-light-39.png +0 -0
- drowse/web/dist/icons/tab-training-light-4.png +0 -0
- drowse/web/dist/icons/tab-training-light-40.png +0 -0
- drowse/web/dist/icons/tab-training-light-41.png +0 -0
- drowse/web/dist/icons/tab-training-light-42.png +0 -0
- drowse/web/dist/icons/tab-training-light-43.png +0 -0
- drowse/web/dist/icons/tab-training-light-44.png +0 -0
- drowse/web/dist/icons/tab-training-light-45.png +0 -0
- drowse/web/dist/icons/tab-training-light-46.png +0 -0
- drowse/web/dist/icons/tab-training-light-47.png +0 -0
- drowse/web/dist/icons/tab-training-light-5.png +0 -0
- drowse/web/dist/icons/tab-training-light-6.png +0 -0
- drowse/web/dist/icons/tab-training-light-7.png +0 -0
- drowse/web/dist/icons/tab-training-light-8.png +0 -0
- drowse/web/dist/icons/tab-training-light-9.png +0 -0
- drowse/web/dist/icons/tab-unsupported-dark.png +0 -0
- drowse/web/dist/icons/tab-unsupported-light.png +0 -0
- drowse/web/dist/icons/tab-unsupported.png +0 -0
- drowse/web/dist/icons/tab-working-0.png +0 -0
- drowse/web/dist/icons/tab-working-1.png +0 -0
- drowse/web/dist/icons/tab-working-2.png +0 -0
- drowse/web/dist/icons/tab-working-dark-0.png +0 -0
- drowse/web/dist/icons/tab-working-dark-1.png +0 -0
- drowse/web/dist/icons/tab-working-dark-10.png +0 -0
- drowse/web/dist/icons/tab-working-dark-11.png +0 -0
- drowse/web/dist/icons/tab-working-dark-12.png +0 -0
- drowse/web/dist/icons/tab-working-dark-13.png +0 -0
- drowse/web/dist/icons/tab-working-dark-14.png +0 -0
- drowse/web/dist/icons/tab-working-dark-15.png +0 -0
- drowse/web/dist/icons/tab-working-dark-16.png +0 -0
- drowse/web/dist/icons/tab-working-dark-17.png +0 -0
- drowse/web/dist/icons/tab-working-dark-18.png +0 -0
- drowse/web/dist/icons/tab-working-dark-19.png +0 -0
- drowse/web/dist/icons/tab-working-dark-2.png +0 -0
- drowse/web/dist/icons/tab-working-dark-20.png +0 -0
- drowse/web/dist/icons/tab-working-dark-21.png +0 -0
- drowse/web/dist/icons/tab-working-dark-22.png +0 -0
- drowse/web/dist/icons/tab-working-dark-23.png +0 -0
- drowse/web/dist/icons/tab-working-dark-24.png +0 -0
- drowse/web/dist/icons/tab-working-dark-25.png +0 -0
- drowse/web/dist/icons/tab-working-dark-26.png +0 -0
- drowse/web/dist/icons/tab-working-dark-27.png +0 -0
- drowse/web/dist/icons/tab-working-dark-28.png +0 -0
- drowse/web/dist/icons/tab-working-dark-29.png +0 -0
- drowse/web/dist/icons/tab-working-dark-3.png +0 -0
- drowse/web/dist/icons/tab-working-dark-30.png +0 -0
- drowse/web/dist/icons/tab-working-dark-31.png +0 -0
- drowse/web/dist/icons/tab-working-dark-32.png +0 -0
- drowse/web/dist/icons/tab-working-dark-33.png +0 -0
- drowse/web/dist/icons/tab-working-dark-34.png +0 -0
- drowse/web/dist/icons/tab-working-dark-35.png +0 -0
- drowse/web/dist/icons/tab-working-dark-36.png +0 -0
- drowse/web/dist/icons/tab-working-dark-37.png +0 -0
- drowse/web/dist/icons/tab-working-dark-38.png +0 -0
- drowse/web/dist/icons/tab-working-dark-39.png +0 -0
- drowse/web/dist/icons/tab-working-dark-4.png +0 -0
- drowse/web/dist/icons/tab-working-dark-40.png +0 -0
- drowse/web/dist/icons/tab-working-dark-41.png +0 -0
- drowse/web/dist/icons/tab-working-dark-42.png +0 -0
- drowse/web/dist/icons/tab-working-dark-43.png +0 -0
- drowse/web/dist/icons/tab-working-dark-44.png +0 -0
- drowse/web/dist/icons/tab-working-dark-45.png +0 -0
- drowse/web/dist/icons/tab-working-dark-46.png +0 -0
- drowse/web/dist/icons/tab-working-dark-47.png +0 -0
- drowse/web/dist/icons/tab-working-dark-5.png +0 -0
- drowse/web/dist/icons/tab-working-dark-6.png +0 -0
- drowse/web/dist/icons/tab-working-dark-7.png +0 -0
- drowse/web/dist/icons/tab-working-dark-8.png +0 -0
- drowse/web/dist/icons/tab-working-dark-9.png +0 -0
- drowse/web/dist/icons/tab-working-light-0.png +0 -0
- drowse/web/dist/icons/tab-working-light-1.png +0 -0
- drowse/web/dist/icons/tab-working-light-10.png +0 -0
- drowse/web/dist/icons/tab-working-light-11.png +0 -0
- drowse/web/dist/icons/tab-working-light-12.png +0 -0
- drowse/web/dist/icons/tab-working-light-13.png +0 -0
- drowse/web/dist/icons/tab-working-light-14.png +0 -0
- drowse/web/dist/icons/tab-working-light-15.png +0 -0
- drowse/web/dist/icons/tab-working-light-16.png +0 -0
- drowse/web/dist/icons/tab-working-light-17.png +0 -0
- drowse/web/dist/icons/tab-working-light-18.png +0 -0
- drowse/web/dist/icons/tab-working-light-19.png +0 -0
- drowse/web/dist/icons/tab-working-light-2.png +0 -0
- drowse/web/dist/icons/tab-working-light-20.png +0 -0
- drowse/web/dist/icons/tab-working-light-21.png +0 -0
- drowse/web/dist/icons/tab-working-light-22.png +0 -0
- drowse/web/dist/icons/tab-working-light-23.png +0 -0
- drowse/web/dist/icons/tab-working-light-24.png +0 -0
- drowse/web/dist/icons/tab-working-light-25.png +0 -0
- drowse/web/dist/icons/tab-working-light-26.png +0 -0
- drowse/web/dist/icons/tab-working-light-27.png +0 -0
- drowse/web/dist/icons/tab-working-light-28.png +0 -0
- drowse/web/dist/icons/tab-working-light-29.png +0 -0
- drowse/web/dist/icons/tab-working-light-3.png +0 -0
- drowse/web/dist/icons/tab-working-light-30.png +0 -0
- drowse/web/dist/icons/tab-working-light-31.png +0 -0
- drowse/web/dist/icons/tab-working-light-32.png +0 -0
- drowse/web/dist/icons/tab-working-light-33.png +0 -0
- drowse/web/dist/icons/tab-working-light-34.png +0 -0
- drowse/web/dist/icons/tab-working-light-35.png +0 -0
- drowse/web/dist/icons/tab-working-light-36.png +0 -0
- drowse/web/dist/icons/tab-working-light-37.png +0 -0
- drowse/web/dist/icons/tab-working-light-38.png +0 -0
- drowse/web/dist/icons/tab-working-light-39.png +0 -0
- drowse/web/dist/icons/tab-working-light-4.png +0 -0
- drowse/web/dist/icons/tab-working-light-40.png +0 -0
- drowse/web/dist/icons/tab-working-light-41.png +0 -0
- drowse/web/dist/icons/tab-working-light-42.png +0 -0
- drowse/web/dist/icons/tab-working-light-43.png +0 -0
- drowse/web/dist/icons/tab-working-light-44.png +0 -0
- drowse/web/dist/icons/tab-working-light-45.png +0 -0
- drowse/web/dist/icons/tab-working-light-46.png +0 -0
- drowse/web/dist/icons/tab-working-light-47.png +0 -0
- drowse/web/dist/icons/tab-working-light-5.png +0 -0
- drowse/web/dist/icons/tab-working-light-6.png +0 -0
- drowse/web/dist/icons/tab-working-light-7.png +0 -0
- drowse/web/dist/icons/tab-working-light-8.png +0 -0
- drowse/web/dist/icons/tab-working-light-9.png +0 -0
- drowse/web/dist/index.html +34 -0
- drowse/web/dist/social/drowse.png +0 -0
- drowse/web/dist/social/drowse.svg +6 -0
- drowse/web/dist/theme-init.js +25 -0
- drowse/web/routes.py +118 -0
- drowse_ai-5.3.1.dist-info/METADATA +632 -0
- drowse_ai-5.3.1.dist-info/RECORD +1341 -0
- drowse_ai-5.3.1.dist-info/WHEEL +5 -0
- drowse_ai-5.3.1.dist-info/entry_points.txt +2 -0
- drowse_ai-5.3.1.dist-info/licenses/LICENSE +661 -0
- drowse_ai-5.3.1.dist-info/top_level.txt +1 -0
drowse/io/lens.py
ADDED
|
@@ -0,0 +1,1992 @@
|
|
|
1
|
+
"""Per-model Jacobian-lens artifact: save/load under ``models/<safe_id>/``.
|
|
2
|
+
|
|
3
|
+
The lens is a per-model transport (one ``J_l`` matrix per source layer), not a
|
|
4
|
+
per-concept artifact. Lenses fitted by Drowse are owned by Drowse and live in
|
|
5
|
+
the model's source registry:
|
|
6
|
+
|
|
7
|
+
~/.drowse/models/<safe_model_id>/jlens/local/default/
|
|
8
|
+
jlens.layer-<L>.gen-<id>.safetensors
|
|
9
|
+
manifest.json # atomic shard pointer
|
|
10
|
+
|
|
11
|
+
fp32 on disk and in memory, matching drowse' fitted manifold, subspace, profile,
|
|
12
|
+
and neutral-activation artifacts. Keeping the estimator's fp32 accumulator
|
|
13
|
+
lossless across persistence also makes resumed fits numerically consistent with
|
|
14
|
+
uninterrupted fits.
|
|
15
|
+
|
|
16
|
+
The sidecar records the token-id corpus sha256 + loaded-model fingerprint so a
|
|
17
|
+
different corpus or mutable model revision reads as stale, and ``n_prompts`` so an interrupted fit can resume
|
|
18
|
+
(load → fit the remaining prompts → ``JacobianLens.merge`` → save).
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
from __future__ import annotations
|
|
22
|
+
|
|
23
|
+
import hashlib
|
|
24
|
+
import json
|
|
25
|
+
import logging
|
|
26
|
+
import os
|
|
27
|
+
import re
|
|
28
|
+
import struct
|
|
29
|
+
import threading
|
|
30
|
+
from contextlib import contextmanager, suppress
|
|
31
|
+
from dataclasses import dataclass, replace
|
|
32
|
+
from pathlib import Path
|
|
33
|
+
from collections import Counter
|
|
34
|
+
from collections.abc import Callable, Iterable, Mapping, Sequence
|
|
35
|
+
from typing import Any, Protocol, cast, overload
|
|
36
|
+
|
|
37
|
+
import torch
|
|
38
|
+
from safetensors import safe_open
|
|
39
|
+
|
|
40
|
+
from drowse.core.jlens import JacobianLens
|
|
41
|
+
from drowse.io.atomic import artifact_lock, fsync_directory, write_json_atomic
|
|
42
|
+
from drowse.io.shards import (
|
|
43
|
+
fit_lock,
|
|
44
|
+
generation_path as _new_layer_generation,
|
|
45
|
+
json_pointer_matches as _json_pointer_matches,
|
|
46
|
+
representative_shard_path,
|
|
47
|
+
shard_paths,
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
log = logging.getLogger(__name__)
|
|
51
|
+
|
|
52
|
+
LENS_FORMAT_VERSION = 6
|
|
53
|
+
# Artifact label for the shared shard primitive's error/log wording.
|
|
54
|
+
_LENS_LABEL = "J-lens"
|
|
55
|
+
_LENS_NAME = "jlens"
|
|
56
|
+
_LENS_CHECKPOINT_NAME = "jlens.partial"
|
|
57
|
+
_LENS_METHOD = "jlens_cotangent_sum"
|
|
58
|
+
_RELP_METHOD = "relp_cotangent_sum"
|
|
59
|
+
LENS_CORPUS_PREPROCESS_VERSION = 1
|
|
60
|
+
|
|
61
|
+
_LENS_SIDECAR_FIELDS = {
|
|
62
|
+
"format_version", "method", "n_prompts", "d_model", "source_layers",
|
|
63
|
+
"dtype", "corpus_spec", "corpus_sha256", "corpus_hash_kind", "seq_len",
|
|
64
|
+
"dim_batch", "skip_first_positions", "estimator_policy", "tensor_sha256",
|
|
65
|
+
"tensor_files", "raw_corpus_sha256", "raw_prompt_count",
|
|
66
|
+
"usable_prompt_count", "model_layer_count", "model_fingerprint",
|
|
67
|
+
"model_source_fingerprint", "checkpoint", "base_n_prompts",
|
|
68
|
+
"partial_n_prompts", "consumed_prefix_sha256",
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
@dataclass(frozen=True)
|
|
73
|
+
class _LensPayloadProof:
|
|
74
|
+
"""Transaction-scoped proof that one immutable pointer was byte-verified.
|
|
75
|
+
|
|
76
|
+
Constructed only after a successful load or pointer publication. Callers
|
|
77
|
+
may reuse it while holding ``lens_fit_lock``; public/unverified callers pass
|
|
78
|
+
no proof and retain full digest verification.
|
|
79
|
+
"""
|
|
80
|
+
|
|
81
|
+
anchor: str
|
|
82
|
+
pointer_sha256: str
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
def _lens_payload_proof(
|
|
86
|
+
anchor: Path, sidecar: Mapping[str, Any],
|
|
87
|
+
) -> _LensPayloadProof:
|
|
88
|
+
canonical = json.dumps(
|
|
89
|
+
dict(sidecar), sort_keys=True, separators=(",", ":"),
|
|
90
|
+
).encode("utf-8")
|
|
91
|
+
return _LensPayloadProof(
|
|
92
|
+
anchor=str(anchor.resolve(strict=False)),
|
|
93
|
+
pointer_sha256=hashlib.sha256(canonical).hexdigest(),
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
def _proof_matches(
|
|
98
|
+
proof: _LensPayloadProof | None,
|
|
99
|
+
anchor: Path,
|
|
100
|
+
sidecar: Mapping[str, Any],
|
|
101
|
+
) -> bool:
|
|
102
|
+
return proof == _lens_payload_proof(anchor, sidecar) if proof is not None else False
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
def _lens_anchor_paths(model_id: str, name: str = "default") -> tuple[Path, Path]:
|
|
106
|
+
"""Stable lock anchor and atomic durable pointer."""
|
|
107
|
+
from drowse.io.lens_sources import local_lens_dir
|
|
108
|
+
|
|
109
|
+
root = local_lens_dir(model_id, name)
|
|
110
|
+
return root / f"{_LENS_NAME}.safetensors", root / "manifest.json"
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
def _checkpoint_anchor_paths(model_id: str, name: str = "default") -> tuple[Path, Path]:
|
|
114
|
+
"""Stable lock anchor and atomic checkpoint pointer."""
|
|
115
|
+
from drowse.io.lens_sources import local_lens_dir
|
|
116
|
+
|
|
117
|
+
md = local_lens_dir(model_id, name)
|
|
118
|
+
return (
|
|
119
|
+
md / f"{_LENS_CHECKPOINT_NAME}.safetensors",
|
|
120
|
+
md / "checkpoint.json",
|
|
121
|
+
)
|
|
122
|
+
|
|
123
|
+
def _sidecar_tensor_path(anchor: Path, sidecar: Mapping[str, Any]) -> Path:
|
|
124
|
+
"""Resolve a representative generation for path-reporting compatibility."""
|
|
125
|
+
return representative_shard_path(anchor, sidecar, label=_LENS_LABEL)
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
def _sidecar_tensor_paths(
|
|
129
|
+
anchor: Path, sidecar: Mapping[str, Any], source_layers: list[int], *,
|
|
130
|
+
require_exact_keys: bool = True,
|
|
131
|
+
) -> dict[int, Path]:
|
|
132
|
+
"""Resolve every declared layer to its immutable tensor generation.
|
|
133
|
+
|
|
134
|
+
``require_exact_keys=False`` materializes a subset of a wider pointer —
|
|
135
|
+
the same-corpus layer-subset no-op read leaves the durable pointer and its
|
|
136
|
+
full layer union untouched.
|
|
137
|
+
"""
|
|
138
|
+
return shard_paths(
|
|
139
|
+
anchor,
|
|
140
|
+
sidecar,
|
|
141
|
+
source_layers,
|
|
142
|
+
label=_LENS_LABEL,
|
|
143
|
+
require_exact_keys=require_exact_keys,
|
|
144
|
+
)
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
def _public_pointer_paths(
|
|
148
|
+
anchor: Path, sidecar_path: Path,
|
|
149
|
+
) -> tuple[Path, Path]:
|
|
150
|
+
"""Best-effort current tensor path for reporting callers."""
|
|
151
|
+
try:
|
|
152
|
+
with open(sidecar_path) as handle:
|
|
153
|
+
sidecar = json.load(handle)
|
|
154
|
+
return _sidecar_tensor_path(anchor, sidecar), sidecar_path
|
|
155
|
+
except (OSError, ValueError, TypeError, json.JSONDecodeError):
|
|
156
|
+
return anchor, sidecar_path
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
def lens_paths(model_id: str, name: str = "default") -> tuple[Path, Path]:
|
|
160
|
+
"""Return a representative tensor shard and stable sidecar pointer path.
|
|
161
|
+
|
|
162
|
+
The current format uses immutable per-layer generations and atomically
|
|
163
|
+
switches ``jlens/local/default/manifest.json`` to the complete shard map. Use
|
|
164
|
+
:func:`lens_tensor_paths` when every layer path is required.
|
|
165
|
+
"""
|
|
166
|
+
return _public_pointer_paths(*_lens_anchor_paths(model_id, name))
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
def lens_checkpoint_paths(model_id: str, name: str = "default") -> tuple[Path, Path]:
|
|
170
|
+
"""Return the current checkpoint generation and stable sidecar pointer."""
|
|
171
|
+
return _public_pointer_paths(*_checkpoint_anchor_paths(model_id, name))
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
def lens_tensor_paths(
|
|
175
|
+
model_id: str, sidecar: Mapping[str, Any], *, checkpoint: bool = False,
|
|
176
|
+
name: str = "default",
|
|
177
|
+
) -> dict[int, Path]:
|
|
178
|
+
"""Return every tensor generation named by a validated sidecar."""
|
|
179
|
+
anchor, _ = (
|
|
180
|
+
_checkpoint_anchor_paths(model_id, name) if checkpoint
|
|
181
|
+
else _lens_anchor_paths(model_id, name)
|
|
182
|
+
)
|
|
183
|
+
layers = [int(layer) for layer in sidecar.get("source_layers", [])]
|
|
184
|
+
return _sidecar_tensor_paths(anchor, sidecar, layers)
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
def lens_artifact_size(
|
|
188
|
+
model_id: str, sidecar: Mapping[str, Any], *, checkpoint: bool = False,
|
|
189
|
+
name: str = "default",
|
|
190
|
+
) -> int:
|
|
191
|
+
"""Total bytes in the current pointer, retrying a stale caller snapshot."""
|
|
192
|
+
del sidecar # the stable pointer is authoritative under its anchor lock
|
|
193
|
+
anchor, sc_path = (
|
|
194
|
+
_checkpoint_anchor_paths(model_id, name) if checkpoint
|
|
195
|
+
else _lens_anchor_paths(model_id, name)
|
|
196
|
+
)
|
|
197
|
+
with artifact_lock(anchor):
|
|
198
|
+
current = _load_sidecar_at(
|
|
199
|
+
model_id, anchor, sc_path,
|
|
200
|
+
label="jlens checkpoint" if checkpoint else "jlens cache",
|
|
201
|
+
)
|
|
202
|
+
if current is None:
|
|
203
|
+
return 0
|
|
204
|
+
return sum(
|
|
205
|
+
path.stat().st_size
|
|
206
|
+
for path in set(_sidecar_tensor_paths(
|
|
207
|
+
anchor, current,
|
|
208
|
+
[int(layer) for layer in current["source_layers"]],
|
|
209
|
+
).values())
|
|
210
|
+
)
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
def lens_payloads_match(
|
|
214
|
+
model_id: str, sidecar: Mapping[str, Any], *, checkpoint: bool = False,
|
|
215
|
+
name: str = "default",
|
|
216
|
+
) -> bool:
|
|
217
|
+
"""Validate exact payload digests without materializing fp32 matrices."""
|
|
218
|
+
from drowse.io.integrity import hash_file
|
|
219
|
+
|
|
220
|
+
try:
|
|
221
|
+
paths = lens_tensor_paths(
|
|
222
|
+
model_id, sidecar, checkpoint=checkpoint, name=name,
|
|
223
|
+
)
|
|
224
|
+
expected = sidecar.get("tensor_sha256")
|
|
225
|
+
if not isinstance(expected, Mapping):
|
|
226
|
+
return False
|
|
227
|
+
return all(
|
|
228
|
+
isinstance(expected.get(str(layer)), str)
|
|
229
|
+
and hash_file(path) == expected[str(layer)]
|
|
230
|
+
for layer, path in paths.items()
|
|
231
|
+
)
|
|
232
|
+
except (OSError, ValueError, KeyError, TypeError):
|
|
233
|
+
return False
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
@contextmanager
|
|
237
|
+
def lens_fit_lock(model_id: str, name: str = "default"):
|
|
238
|
+
"""Serialize the complete per-model fit/lifecycle transaction cross-process."""
|
|
239
|
+
anchor, _ = _lens_anchor_paths(model_id, name)
|
|
240
|
+
with fit_lock(anchor):
|
|
241
|
+
yield
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
def _referenced_tensor_names(model_folder: Path) -> set[str] | None:
|
|
245
|
+
"""Read both pointers, failing closed if an existing pointer is unreadable."""
|
|
246
|
+
out: set[str] = set()
|
|
247
|
+
for sidecar_path in (
|
|
248
|
+
model_folder / "manifest.json",
|
|
249
|
+
model_folder / "checkpoint.json",
|
|
250
|
+
):
|
|
251
|
+
if not sidecar_path.exists():
|
|
252
|
+
continue
|
|
253
|
+
try:
|
|
254
|
+
with open(sidecar_path) as handle:
|
|
255
|
+
sidecar = json.load(handle)
|
|
256
|
+
if not isinstance(sidecar, dict):
|
|
257
|
+
return None
|
|
258
|
+
shard_files = sidecar.get("tensor_files")
|
|
259
|
+
if not isinstance(shard_files, Mapping):
|
|
260
|
+
return None
|
|
261
|
+
filenames = shard_files.values()
|
|
262
|
+
for filename in filenames:
|
|
263
|
+
if isinstance(filename, str) and Path(filename).name == filename:
|
|
264
|
+
out.add(filename)
|
|
265
|
+
except (OSError, TypeError, json.JSONDecodeError):
|
|
266
|
+
return None
|
|
267
|
+
return out
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
def _cleanup_unreferenced_generations(model_folder: Path) -> None:
|
|
271
|
+
"""Remove unreferenced generations and crash-left streaming temporaries."""
|
|
272
|
+
keep = _referenced_tensor_names(model_folder)
|
|
273
|
+
if keep is None:
|
|
274
|
+
# A transient pointer read failure cannot authorize deletion of any
|
|
275
|
+
# potentially live multi-GiB generation.
|
|
276
|
+
return
|
|
277
|
+
candidates = (
|
|
278
|
+
list(model_folder.glob("jlens*.gen-*.safetensors"))
|
|
279
|
+
+ list(model_folder.glob("jlens*.gen-*.safetensors.tmp"))
|
|
280
|
+
+ [
|
|
281
|
+
model_folder / f"{_LENS_NAME}.safetensors",
|
|
282
|
+
model_folder / f"{_LENS_CHECKPOINT_NAME}.safetensors",
|
|
283
|
+
model_folder / f"{_LENS_NAME}.safetensors.tmp",
|
|
284
|
+
model_folder / f"{_LENS_CHECKPOINT_NAME}.safetensors.tmp",
|
|
285
|
+
]
|
|
286
|
+
)
|
|
287
|
+
for path in candidates:
|
|
288
|
+
if path.name not in keep:
|
|
289
|
+
try:
|
|
290
|
+
path.unlink(missing_ok=True)
|
|
291
|
+
except OSError as exc:
|
|
292
|
+
# Pointer publication is already complete. Generation GC is
|
|
293
|
+
# opportunistic and must not turn a valid fit into a failure.
|
|
294
|
+
log.warning("could not remove old J-lens generation %s: %s", path, exc)
|
|
295
|
+
|
|
296
|
+
|
|
297
|
+
def cleanup_lens_artifacts(model_id: str, name: str = "default") -> None:
|
|
298
|
+
"""Reap crash-left lens shards before a new fit allocates replacements."""
|
|
299
|
+
anchor, _ = _lens_anchor_paths(model_id, name)
|
|
300
|
+
with lens_fit_lock(model_id, name):
|
|
301
|
+
_cleanup_unreferenced_generations(anchor.parent)
|
|
302
|
+
|
|
303
|
+
|
|
304
|
+
def lens_estimator_policy(
|
|
305
|
+
*, skip_first: int | None = None, backward_rules: str = "standard",
|
|
306
|
+
) -> dict[str, Any]:
|
|
307
|
+
"""Fit semantics that must match before any final/checkpoint reuse.
|
|
308
|
+
|
|
309
|
+
A ``"standard"`` policy keeps the exact historical shape, so artifacts
|
|
310
|
+
fitted before the RelP rules existed stay valid; a ``"relp"`` fit takes
|
|
311
|
+
its own method plus the rule set, so the two estimators can never
|
|
312
|
+
resume or reuse each other's shards.
|
|
313
|
+
"""
|
|
314
|
+
from drowse.core.jlens import SKIP_FIRST_POSITIONS
|
|
315
|
+
|
|
316
|
+
policy: dict[str, Any] = {
|
|
317
|
+
"method": _LENS_METHOD,
|
|
318
|
+
"skip_first_positions": (
|
|
319
|
+
SKIP_FIRST_POSITIONS if skip_first is None else int(skip_first)
|
|
320
|
+
),
|
|
321
|
+
"corpus_preprocess_version": LENS_CORPUS_PREPROCESS_VERSION,
|
|
322
|
+
"doc_chars": LENS_DOC_CHARS,
|
|
323
|
+
}
|
|
324
|
+
if backward_rules == "relp":
|
|
325
|
+
from drowse.core.relp import RELP_RULES
|
|
326
|
+
|
|
327
|
+
policy["method"] = _RELP_METHOD
|
|
328
|
+
policy["backward_rules"] = dict(RELP_RULES)
|
|
329
|
+
elif backward_rules != "standard":
|
|
330
|
+
raise ValueError(
|
|
331
|
+
f"backward_rules must be 'standard' or 'relp', got {backward_rules!r}"
|
|
332
|
+
)
|
|
333
|
+
return policy
|
|
334
|
+
|
|
335
|
+
|
|
336
|
+
def _require_name_matches_rules(name: str, backward_rules: str) -> None:
|
|
337
|
+
"""Only a RelP fit writes ``local/relp``, and it writes nowhere else.
|
|
338
|
+
|
|
339
|
+
The pre-fix relabel in :func:`_load_sidecar_at` reads the ``relp`` name as
|
|
340
|
+
proof of a RelP fit, so writers must never break that correspondence.
|
|
341
|
+
"""
|
|
342
|
+
if (name == "relp") != (backward_rules == "relp"):
|
|
343
|
+
raise ValueError(
|
|
344
|
+
f"lens name {name!r} does not match backward_rules "
|
|
345
|
+
f"{backward_rules!r}: the RelP fit lives at local/relp and only there"
|
|
346
|
+
)
|
|
347
|
+
|
|
348
|
+
|
|
349
|
+
# Before 2026-10-28 the checkpoint writer dropped ``backward_rules``, so every
|
|
350
|
+
# RelP checkpoint, and every final promoted from one, recorded the standard
|
|
351
|
+
# policy. Those fits ran these rules (RELP_RULES had not changed since RelP
|
|
352
|
+
# landed); pinning them here keeps the relabel exact if RELP_RULES moves on.
|
|
353
|
+
_PRE_FIX_RELP_RULES = {
|
|
354
|
+
"ln_rule": True,
|
|
355
|
+
"identity_rule": True,
|
|
356
|
+
"half_rule": True,
|
|
357
|
+
"half_rule_beta": 0.5,
|
|
358
|
+
"include_qk_norms": False,
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
|
|
362
|
+
def _is_pre_fix_relp_sidecar(anchor: Path, sidecar: Mapping[str, Any]) -> bool:
|
|
363
|
+
return (
|
|
364
|
+
anchor.parent.name == "relp"
|
|
365
|
+
and anchor.parent.parent.name == "local"
|
|
366
|
+
and sidecar.get("method") == _LENS_METHOD
|
|
367
|
+
and sidecar.get("estimator_policy") == lens_estimator_policy()
|
|
368
|
+
)
|
|
369
|
+
|
|
370
|
+
|
|
371
|
+
def _load_sidecar_at(
|
|
372
|
+
model_id: str, tensor_anchor: Path, sc_path: Path, *, label: str,
|
|
373
|
+
) -> dict[str, Any] | None:
|
|
374
|
+
if not sc_path.exists():
|
|
375
|
+
return None
|
|
376
|
+
try:
|
|
377
|
+
with open(sc_path) as f:
|
|
378
|
+
sidecar = json.load(f)
|
|
379
|
+
if not isinstance(sidecar, dict) or set(sidecar) != _LENS_SIDECAR_FIELDS:
|
|
380
|
+
raise ValueError("lens sidecar does not match the current exact schema")
|
|
381
|
+
ts_path = _sidecar_tensor_path(tensor_anchor, sidecar)
|
|
382
|
+
if not ts_path.exists():
|
|
383
|
+
return None
|
|
384
|
+
relabelled = _is_pre_fix_relp_sidecar(tensor_anchor, sidecar)
|
|
385
|
+
if relabelled:
|
|
386
|
+
sidecar = {
|
|
387
|
+
**sidecar,
|
|
388
|
+
"method": _RELP_METHOD,
|
|
389
|
+
"estimator_policy": {
|
|
390
|
+
**sidecar["estimator_policy"],
|
|
391
|
+
"method": _RELP_METHOD,
|
|
392
|
+
"backward_rules": dict(_PRE_FIX_RELP_RULES),
|
|
393
|
+
},
|
|
394
|
+
}
|
|
395
|
+
version = sidecar.get("format_version")
|
|
396
|
+
if (
|
|
397
|
+
not isinstance(version, int)
|
|
398
|
+
or isinstance(version, bool)
|
|
399
|
+
or version != LENS_FORMAT_VERSION
|
|
400
|
+
):
|
|
401
|
+
log.warning(
|
|
402
|
+
"%s for %s has format_version %r (need exactly %d); ignoring "
|
|
403
|
+
"— re-fit with `drowse lens fit`",
|
|
404
|
+
label, model_id, version, LENS_FORMAT_VERSION,
|
|
405
|
+
)
|
|
406
|
+
return None
|
|
407
|
+
policy = sidecar.get("estimator_policy")
|
|
408
|
+
if policy not in (
|
|
409
|
+
lens_estimator_policy(),
|
|
410
|
+
lens_estimator_policy(backward_rules="relp"),
|
|
411
|
+
):
|
|
412
|
+
log.warning(
|
|
413
|
+
"%s for %s uses a different estimator/preprocessing policy; "
|
|
414
|
+
"ignoring — re-fit with `drowse lens fit`", label, model_id,
|
|
415
|
+
)
|
|
416
|
+
return None
|
|
417
|
+
d_model = sidecar["d_model"]
|
|
418
|
+
source_layers_raw = sidecar["source_layers"]
|
|
419
|
+
if (
|
|
420
|
+
isinstance(d_model, bool)
|
|
421
|
+
or not isinstance(d_model, int)
|
|
422
|
+
or d_model <= 0
|
|
423
|
+
or not isinstance(source_layers_raw, list)
|
|
424
|
+
or not source_layers_raw
|
|
425
|
+
or any(
|
|
426
|
+
isinstance(layer, bool) or not isinstance(layer, int) or layer < 0
|
|
427
|
+
for layer in source_layers_raw
|
|
428
|
+
)
|
|
429
|
+
or source_layers_raw != sorted(set(source_layers_raw))
|
|
430
|
+
or sidecar["method"] != policy["method"]
|
|
431
|
+
or sidecar["dtype"] != "float32"
|
|
432
|
+
or any(
|
|
433
|
+
not isinstance(sidecar[key], str) or not sidecar[key]
|
|
434
|
+
for key in ("corpus_spec", "corpus_sha256", "corpus_hash_kind")
|
|
435
|
+
)
|
|
436
|
+
or any(
|
|
437
|
+
isinstance(sidecar[key], bool) or not isinstance(sidecar[key], int)
|
|
438
|
+
or sidecar[key] < 0
|
|
439
|
+
for key in ("n_prompts", "seq_len", "dim_batch", "skip_first_positions")
|
|
440
|
+
)
|
|
441
|
+
or not isinstance(sidecar["checkpoint"], bool)
|
|
442
|
+
):
|
|
443
|
+
log.warning(
|
|
444
|
+
"%s for %s has invalid sidecar shape metadata; ignoring "
|
|
445
|
+
"— re-fit with `drowse lens fit`", label, model_id,
|
|
446
|
+
)
|
|
447
|
+
return None
|
|
448
|
+
nullable_strings = (
|
|
449
|
+
"raw_corpus_sha256", "model_fingerprint",
|
|
450
|
+
"model_source_fingerprint", "consumed_prefix_sha256",
|
|
451
|
+
)
|
|
452
|
+
if any(
|
|
453
|
+
sidecar[key] is not None and (
|
|
454
|
+
not isinstance(sidecar[key], str) or not sidecar[key]
|
|
455
|
+
)
|
|
456
|
+
for key in nullable_strings
|
|
457
|
+
):
|
|
458
|
+
raise ValueError("lens sidecar has invalid nullable string metadata")
|
|
459
|
+
digest_fields = (
|
|
460
|
+
"corpus_sha256", "raw_corpus_sha256", "consumed_prefix_sha256",
|
|
461
|
+
)
|
|
462
|
+
if any(
|
|
463
|
+
sidecar[key] is not None and (
|
|
464
|
+
len(sidecar[key]) != 64
|
|
465
|
+
or any(char not in "0123456789abcdef" for char in sidecar[key])
|
|
466
|
+
)
|
|
467
|
+
for key in digest_fields
|
|
468
|
+
):
|
|
469
|
+
raise ValueError("lens sidecar has invalid identity digest")
|
|
470
|
+
nullable_ints = (
|
|
471
|
+
"raw_prompt_count", "usable_prompt_count", "model_layer_count",
|
|
472
|
+
"base_n_prompts", "partial_n_prompts",
|
|
473
|
+
)
|
|
474
|
+
if any(
|
|
475
|
+
value is not None and (
|
|
476
|
+
isinstance(value, bool) or not isinstance(value, int) or value < 0
|
|
477
|
+
)
|
|
478
|
+
for value in (sidecar[key] for key in nullable_ints)
|
|
479
|
+
):
|
|
480
|
+
raise ValueError("lens sidecar has invalid nullable integer metadata")
|
|
481
|
+
if sidecar["checkpoint"]:
|
|
482
|
+
if sidecar["base_n_prompts"] is None or sidecar["partial_n_prompts"] is None:
|
|
483
|
+
raise ValueError("lens checkpoint is missing progress metadata")
|
|
484
|
+
if (
|
|
485
|
+
sidecar["partial_n_prompts"] > 0
|
|
486
|
+
and sidecar["consumed_prefix_sha256"] is None
|
|
487
|
+
):
|
|
488
|
+
raise ValueError("lens checkpoint is missing consumed-prefix identity")
|
|
489
|
+
if (
|
|
490
|
+
sidecar["partial_n_prompts"] == 0
|
|
491
|
+
and sidecar["consumed_prefix_sha256"] is not None
|
|
492
|
+
):
|
|
493
|
+
raise ValueError("zero-progress lens checkpoint carries prefix identity")
|
|
494
|
+
elif any(
|
|
495
|
+
sidecar[key] is not None
|
|
496
|
+
for key in ("base_n_prompts", "partial_n_prompts", "consumed_prefix_sha256")
|
|
497
|
+
):
|
|
498
|
+
raise ValueError("final lens carries checkpoint-only metadata")
|
|
499
|
+
expected_digests = sidecar.get("tensor_sha256")
|
|
500
|
+
expected_keys = {str(layer) for layer in sidecar["source_layers"]}
|
|
501
|
+
if (
|
|
502
|
+
not isinstance(expected_digests, Mapping)
|
|
503
|
+
or {str(key) for key in expected_digests} != expected_keys
|
|
504
|
+
or any(
|
|
505
|
+
not isinstance(digest, str) or len(digest) != 64
|
|
506
|
+
or any(char not in "0123456789abcdef" for char in digest)
|
|
507
|
+
for digest in expected_digests.values()
|
|
508
|
+
)
|
|
509
|
+
):
|
|
510
|
+
raise ValueError("tensor digest keys do not match source_layers")
|
|
511
|
+
tensor_paths = _sidecar_tensor_paths(
|
|
512
|
+
tensor_anchor, sidecar, sidecar["source_layers"],
|
|
513
|
+
)
|
|
514
|
+
grouped: dict[Path, list[int]] = {}
|
|
515
|
+
for layer, path in tensor_paths.items():
|
|
516
|
+
if not path.exists():
|
|
517
|
+
raise ValueError(f"missing tensor generation {path.name}")
|
|
518
|
+
grouped.setdefault(path, []).append(layer)
|
|
519
|
+
for path, path_layers in grouped.items():
|
|
520
|
+
path_keys = [f"layer_{layer}" for layer in path_layers]
|
|
521
|
+
with safe_open(str(path), framework="pt", device="cpu") as tensors:
|
|
522
|
+
if sorted(tensors.keys()) != sorted(path_keys):
|
|
523
|
+
raise ValueError("tensor layer keys do not match sidecar")
|
|
524
|
+
for key in path_keys:
|
|
525
|
+
view = tensors.get_slice(key)
|
|
526
|
+
if tuple(view.get_shape()) != (d_model, d_model):
|
|
527
|
+
raise ValueError(f"{key} shape does not match sidecar")
|
|
528
|
+
if view.get_dtype() != "F32":
|
|
529
|
+
raise ValueError(f"{key} is not float32")
|
|
530
|
+
if relabelled:
|
|
531
|
+
_persist_relabel(sc_path, sidecar, label=label, model_id=model_id)
|
|
532
|
+
return sidecar
|
|
533
|
+
except Exception as exc:
|
|
534
|
+
log.warning("Corrupt %s sidecar for %s; ignoring: %s", label, model_id, exc)
|
|
535
|
+
return None
|
|
536
|
+
|
|
537
|
+
|
|
538
|
+
def _persist_relabel(
|
|
539
|
+
sc_path: Path, sidecar: Mapping[str, Any], *, label: str, model_id: str,
|
|
540
|
+
) -> None:
|
|
541
|
+
"""Rewrite a validated pre-fix RelP pointer with its true policy.
|
|
542
|
+
|
|
543
|
+
Every caller of :func:`_load_sidecar_at` holds the pointer's artifact
|
|
544
|
+
lock, which is what every pointer writer holds, and the new pointer
|
|
545
|
+
names the same immutable shards, so the swap is safe against concurrent
|
|
546
|
+
fits and generation GC. A failed write still returns the relabelled view.
|
|
547
|
+
"""
|
|
548
|
+
try:
|
|
549
|
+
write_json_atomic(sc_path, dict(sidecar))
|
|
550
|
+
fsync_directory(sc_path.parent)
|
|
551
|
+
except OSError as exc:
|
|
552
|
+
log.warning(
|
|
553
|
+
"could not persist the RelP relabel of %s for %s: %s",
|
|
554
|
+
label, model_id, exc,
|
|
555
|
+
)
|
|
556
|
+
return
|
|
557
|
+
log.info(
|
|
558
|
+
"relabelled pre-fix %s for %s with its RelP estimator policy",
|
|
559
|
+
label, model_id,
|
|
560
|
+
)
|
|
561
|
+
|
|
562
|
+
|
|
563
|
+
def load_local_lens_sidecar(
|
|
564
|
+
model_id: str, name: str = "default",
|
|
565
|
+
) -> dict[str, Any] | None:
|
|
566
|
+
"""Load Drowse-owned local/default metadata without its matrices."""
|
|
567
|
+
anchor, sc_path = _lens_anchor_paths(model_id, name)
|
|
568
|
+
with artifact_lock(anchor):
|
|
569
|
+
return _load_sidecar_at(model_id, anchor, sc_path, label="jlens cache")
|
|
570
|
+
|
|
571
|
+
|
|
572
|
+
def load_lens_sidecar(model_id: str) -> dict[str, Any] | None:
|
|
573
|
+
"""Load metadata for the active local or external lens source."""
|
|
574
|
+
from drowse.io.lens_sources import (
|
|
575
|
+
load_active_lens_source,
|
|
576
|
+
load_external_lens_sidecar,
|
|
577
|
+
)
|
|
578
|
+
|
|
579
|
+
active = load_active_lens_source(model_id)
|
|
580
|
+
if active is None:
|
|
581
|
+
return None
|
|
582
|
+
if active["kind"] == "huggingface":
|
|
583
|
+
return load_external_lens_sidecar(model_id, active["name"])
|
|
584
|
+
return load_local_lens_sidecar(model_id, active["name"])
|
|
585
|
+
|
|
586
|
+
|
|
587
|
+
def load_lens_checkpoint_sidecar(
|
|
588
|
+
model_id: str, name: str = "default",
|
|
589
|
+
) -> dict[str, Any] | None:
|
|
590
|
+
"""Load validated checkpoint metadata without materializing its matrices."""
|
|
591
|
+
anchor, sc_path = _checkpoint_anchor_paths(model_id, name)
|
|
592
|
+
with artifact_lock(anchor):
|
|
593
|
+
return _load_sidecar_at(
|
|
594
|
+
model_id, anchor, sc_path, label="jlens checkpoint",
|
|
595
|
+
)
|
|
596
|
+
|
|
597
|
+
|
|
598
|
+
def save_lens(
|
|
599
|
+
lens: JacobianLens,
|
|
600
|
+
model_id: str,
|
|
601
|
+
*,
|
|
602
|
+
name: str = "default",
|
|
603
|
+
backward_rules: str = "standard",
|
|
604
|
+
corpus_spec: str,
|
|
605
|
+
corpus_sha256: str,
|
|
606
|
+
seq_len: int,
|
|
607
|
+
dim_batch: int,
|
|
608
|
+
skip_first: int,
|
|
609
|
+
corpus_hash_kind: str = "text_v1",
|
|
610
|
+
durable: bool = True,
|
|
611
|
+
raw_corpus_sha256: str | None = None,
|
|
612
|
+
raw_prompt_count: int | None = None,
|
|
613
|
+
usable_prompt_count: int | None = None,
|
|
614
|
+
model_layer_count: int | None = None,
|
|
615
|
+
model_fingerprint: str | None = None,
|
|
616
|
+
model_source_fingerprint: str | None = None,
|
|
617
|
+
reuse_layers: Iterable[int] | None = None,
|
|
618
|
+
_verified_reuse_proof: _LensPayloadProof | None = None,
|
|
619
|
+
) -> Path:
|
|
620
|
+
"""Persist a fitted lens and atomically point at its layer generations.
|
|
621
|
+
|
|
622
|
+
``reuse_layers`` names matrices known to be byte-identical to the current
|
|
623
|
+
durable artifact (the missing-layer top-up path). Valid v6 shard pointers
|
|
624
|
+
are carried forward; every other layer is converted and written anew.
|
|
625
|
+
"""
|
|
626
|
+
_require_name_matches_rules(name, backward_rules)
|
|
627
|
+
anchor, sc_path = _lens_anchor_paths(model_id, name)
|
|
628
|
+
with lens_fit_lock(model_id, name):
|
|
629
|
+
path = _save_lens_at(
|
|
630
|
+
lens, anchor, sc_path,
|
|
631
|
+
backward_rules=backward_rules,
|
|
632
|
+
corpus_spec=corpus_spec,
|
|
633
|
+
corpus_sha256=corpus_sha256,
|
|
634
|
+
seq_len=seq_len,
|
|
635
|
+
dim_batch=dim_batch,
|
|
636
|
+
skip_first=skip_first,
|
|
637
|
+
corpus_hash_kind=corpus_hash_kind,
|
|
638
|
+
durable=durable,
|
|
639
|
+
raw_corpus_sha256=raw_corpus_sha256,
|
|
640
|
+
raw_prompt_count=raw_prompt_count,
|
|
641
|
+
usable_prompt_count=usable_prompt_count,
|
|
642
|
+
model_layer_count=model_layer_count,
|
|
643
|
+
model_fingerprint=model_fingerprint,
|
|
644
|
+
model_source_fingerprint=model_source_fingerprint,
|
|
645
|
+
reuse_layers=reuse_layers,
|
|
646
|
+
verified_reuse_proof=_verified_reuse_proof,
|
|
647
|
+
)
|
|
648
|
+
from drowse.io.lens_sources import set_active_local_lens
|
|
649
|
+
|
|
650
|
+
set_active_local_lens(model_id, name)
|
|
651
|
+
return path
|
|
652
|
+
|
|
653
|
+
|
|
654
|
+
def save_lens_checkpoint_accumulator(
|
|
655
|
+
sums: Mapping[int, torch.Tensor],
|
|
656
|
+
n_prompts: int,
|
|
657
|
+
d_model: int,
|
|
658
|
+
model_id: str,
|
|
659
|
+
*,
|
|
660
|
+
name: str = "default",
|
|
661
|
+
backward_rules: str = "standard",
|
|
662
|
+
base: JacobianLens | None,
|
|
663
|
+
corpus_spec: str,
|
|
664
|
+
corpus_sha256: str,
|
|
665
|
+
seq_len: int,
|
|
666
|
+
dim_batch: int,
|
|
667
|
+
skip_first: int,
|
|
668
|
+
corpus_hash_kind: str = "text_v1",
|
|
669
|
+
raw_corpus_sha256: str | None = None,
|
|
670
|
+
raw_prompt_count: int | None = None,
|
|
671
|
+
usable_prompt_count: int | None = None,
|
|
672
|
+
model_layer_count: int | None = None,
|
|
673
|
+
model_fingerprint: str | None = None,
|
|
674
|
+
model_source_fingerprint: str | None = None,
|
|
675
|
+
consumed_prefix_sha256: str | None = None,
|
|
676
|
+
_proof_out: list[_LensPayloadProof] | None = None,
|
|
677
|
+
) -> Path:
|
|
678
|
+
"""Write a self-contained checkpoint directly from raw estimator sums.
|
|
679
|
+
|
|
680
|
+
Normalization and optional prefix merging happen one layer at a time while
|
|
681
|
+
streaming fp32 rows, avoiding an extra full-fp32 ``JacobianLens``. The shard has
|
|
682
|
+
``base_n_prompts=0`` and can therefore survive any number of interruptions
|
|
683
|
+
without depending on a separate full artifact.
|
|
684
|
+
"""
|
|
685
|
+
_require_name_matches_rules(name, backward_rules)
|
|
686
|
+
anchor, sc_path = _checkpoint_anchor_paths(model_id, name)
|
|
687
|
+
total_prompts = int(n_prompts) + (base.n_prompts if base is not None else 0)
|
|
688
|
+
with lens_fit_lock(model_id, name), artifact_lock(anchor):
|
|
689
|
+
return _save_lens_components(
|
|
690
|
+
sums, total_prompts, d_model, anchor, sc_path,
|
|
691
|
+
backward_rules=backward_rules,
|
|
692
|
+
corpus_spec=corpus_spec,
|
|
693
|
+
corpus_sha256=corpus_sha256,
|
|
694
|
+
seq_len=seq_len,
|
|
695
|
+
dim_batch=dim_batch,
|
|
696
|
+
skip_first=skip_first,
|
|
697
|
+
corpus_hash_kind=corpus_hash_kind,
|
|
698
|
+
durable=True,
|
|
699
|
+
raw_corpus_sha256=raw_corpus_sha256,
|
|
700
|
+
raw_prompt_count=raw_prompt_count,
|
|
701
|
+
usable_prompt_count=usable_prompt_count,
|
|
702
|
+
model_layer_count=model_layer_count,
|
|
703
|
+
model_fingerprint=model_fingerprint,
|
|
704
|
+
model_source_fingerprint=model_source_fingerprint,
|
|
705
|
+
raw_sum_count=int(n_prompts),
|
|
706
|
+
average_base=base,
|
|
707
|
+
extra_sidecar={
|
|
708
|
+
"checkpoint": True,
|
|
709
|
+
"base_n_prompts": 0,
|
|
710
|
+
"partial_n_prompts": total_prompts,
|
|
711
|
+
**(
|
|
712
|
+
{"consumed_prefix_sha256": consumed_prefix_sha256}
|
|
713
|
+
if consumed_prefix_sha256 is not None else {}
|
|
714
|
+
),
|
|
715
|
+
},
|
|
716
|
+
proof_out=_proof_out,
|
|
717
|
+
)
|
|
718
|
+
|
|
719
|
+
|
|
720
|
+
def _save_lens_at(
|
|
721
|
+
lens: JacobianLens,
|
|
722
|
+
ts_path: Path,
|
|
723
|
+
sc_path: Path,
|
|
724
|
+
*,
|
|
725
|
+
backward_rules: str,
|
|
726
|
+
corpus_spec: str,
|
|
727
|
+
corpus_sha256: str,
|
|
728
|
+
seq_len: int,
|
|
729
|
+
dim_batch: int,
|
|
730
|
+
skip_first: int,
|
|
731
|
+
corpus_hash_kind: str,
|
|
732
|
+
durable: bool,
|
|
733
|
+
raw_corpus_sha256: str | None = None,
|
|
734
|
+
raw_prompt_count: int | None = None,
|
|
735
|
+
usable_prompt_count: int | None = None,
|
|
736
|
+
model_layer_count: int | None = None,
|
|
737
|
+
model_fingerprint: str | None = None,
|
|
738
|
+
model_source_fingerprint: str | None = None,
|
|
739
|
+
reuse_layers: Iterable[int] | None = None,
|
|
740
|
+
verified_reuse_proof: _LensPayloadProof | None = None,
|
|
741
|
+
extra_sidecar: dict[str, Any] | None = None,
|
|
742
|
+
) -> Path:
|
|
743
|
+
with artifact_lock(ts_path):
|
|
744
|
+
return _save_lens_components(
|
|
745
|
+
lens.jacobians, lens.n_prompts, lens.d_model, ts_path, sc_path,
|
|
746
|
+
backward_rules=backward_rules,
|
|
747
|
+
corpus_spec=corpus_spec,
|
|
748
|
+
corpus_sha256=corpus_sha256,
|
|
749
|
+
seq_len=seq_len,
|
|
750
|
+
dim_batch=dim_batch,
|
|
751
|
+
skip_first=skip_first,
|
|
752
|
+
corpus_hash_kind=corpus_hash_kind,
|
|
753
|
+
durable=durable,
|
|
754
|
+
raw_corpus_sha256=raw_corpus_sha256,
|
|
755
|
+
raw_prompt_count=raw_prompt_count,
|
|
756
|
+
usable_prompt_count=usable_prompt_count,
|
|
757
|
+
model_layer_count=model_layer_count,
|
|
758
|
+
model_fingerprint=model_fingerprint,
|
|
759
|
+
model_source_fingerprint=model_source_fingerprint,
|
|
760
|
+
reuse_layers=reuse_layers,
|
|
761
|
+
verified_reuse_proof=verified_reuse_proof,
|
|
762
|
+
extra_sidecar=extra_sidecar,
|
|
763
|
+
)
|
|
764
|
+
|
|
765
|
+
|
|
766
|
+
def _save_lens_components(
|
|
767
|
+
jacobians: Mapping[int, torch.Tensor],
|
|
768
|
+
n_prompts: int,
|
|
769
|
+
d_model: int,
|
|
770
|
+
ts_path: Path,
|
|
771
|
+
sc_path: Path,
|
|
772
|
+
*,
|
|
773
|
+
backward_rules: str,
|
|
774
|
+
corpus_spec: str,
|
|
775
|
+
corpus_sha256: str,
|
|
776
|
+
seq_len: int,
|
|
777
|
+
dim_batch: int,
|
|
778
|
+
skip_first: int,
|
|
779
|
+
corpus_hash_kind: str,
|
|
780
|
+
durable: bool,
|
|
781
|
+
raw_corpus_sha256: str | None = None,
|
|
782
|
+
raw_prompt_count: int | None = None,
|
|
783
|
+
usable_prompt_count: int | None = None,
|
|
784
|
+
model_layer_count: int | None = None,
|
|
785
|
+
model_fingerprint: str | None = None,
|
|
786
|
+
model_source_fingerprint: str | None = None,
|
|
787
|
+
raw_sum_count: int | None = None,
|
|
788
|
+
average_base: JacobianLens | None = None,
|
|
789
|
+
reuse_layers: Iterable[int] | None = None,
|
|
790
|
+
verified_reuse_proof: _LensPayloadProof | None = None,
|
|
791
|
+
extra_sidecar: dict[str, Any] | None = None,
|
|
792
|
+
proof_out: list[_LensPayloadProof] | None = None,
|
|
793
|
+
) -> Path:
|
|
794
|
+
ts_path.parent.mkdir(parents=True, exist_ok=True)
|
|
795
|
+
layer_ids = sorted(int(idx) for idx in jacobians)
|
|
796
|
+
|
|
797
|
+
def _rows(idx: int, start: int, end: int) -> torch.Tensor:
|
|
798
|
+
value = jacobians[idx][start:end].to(device="cpu", dtype=torch.float32)
|
|
799
|
+
if raw_sum_count is not None:
|
|
800
|
+
# Stripe-local arithmetic: checkpointing never clones a complete
|
|
801
|
+
# fp32 layer or keeps a complete artifact mapping alive.
|
|
802
|
+
value = value.clone()
|
|
803
|
+
if average_base is not None:
|
|
804
|
+
value.add_(
|
|
805
|
+
average_base.jacobians[idx][start:end],
|
|
806
|
+
alpha=average_base.n_prompts,
|
|
807
|
+
)
|
|
808
|
+
value.mul_(1.0 / max(int(n_prompts), 1))
|
|
809
|
+
return value.contiguous()
|
|
810
|
+
|
|
811
|
+
reuse_set = {int(layer) for layer in reuse_layers or ()}
|
|
812
|
+
tensor_files: dict[str, str] = {}
|
|
813
|
+
tensor_sha256: dict[str, str] = {}
|
|
814
|
+
created: list[Path] = []
|
|
815
|
+
if reuse_set:
|
|
816
|
+
current = _load_sidecar_at(
|
|
817
|
+
"current", ts_path, sc_path, label="jlens reuse source",
|
|
818
|
+
)
|
|
819
|
+
if (
|
|
820
|
+
current is not None
|
|
821
|
+
and int(current.get("format_version", 0)) == LENS_FORMAT_VERSION
|
|
822
|
+
and int(current.get("d_model", -1)) == int(d_model)
|
|
823
|
+
and int(current.get("n_prompts", -1)) == int(n_prompts)
|
|
824
|
+
and current.get("corpus_sha256") == corpus_sha256
|
|
825
|
+
and current.get("corpus_hash_kind") == corpus_hash_kind
|
|
826
|
+
and int(current.get("seq_len", -1)) == int(seq_len)
|
|
827
|
+
and current.get("model_fingerprint") == model_fingerprint
|
|
828
|
+
and isinstance(current.get("tensor_sha256"), Mapping)
|
|
829
|
+
):
|
|
830
|
+
current_layers = [int(layer) for layer in current["source_layers"]]
|
|
831
|
+
current_paths = _sidecar_tensor_paths(
|
|
832
|
+
ts_path, current, current_layers,
|
|
833
|
+
)
|
|
834
|
+
current_digests = current["tensor_sha256"]
|
|
835
|
+
from drowse.io.integrity import hash_file
|
|
836
|
+
pointer_verified = _proof_matches(
|
|
837
|
+
verified_reuse_proof, ts_path, current,
|
|
838
|
+
)
|
|
839
|
+
|
|
840
|
+
for layer in sorted(reuse_set & set(layer_ids) & set(current_layers)):
|
|
841
|
+
digest = current_digests.get(str(layer))
|
|
842
|
+
path = current_paths[layer]
|
|
843
|
+
try:
|
|
844
|
+
payload_matches = (
|
|
845
|
+
isinstance(digest, str) and len(digest) == 64
|
|
846
|
+
and path.exists()
|
|
847
|
+
and (pointer_verified or hash_file(path) == digest)
|
|
848
|
+
)
|
|
849
|
+
except OSError:
|
|
850
|
+
payload_matches = False
|
|
851
|
+
if (
|
|
852
|
+
payload_matches and isinstance(digest, str)
|
|
853
|
+
):
|
|
854
|
+
tensor_files[str(layer)] = path.name
|
|
855
|
+
tensor_sha256[str(layer)] = digest
|
|
856
|
+
try:
|
|
857
|
+
for layer in layer_ids:
|
|
858
|
+
if str(layer) in tensor_files:
|
|
859
|
+
continue
|
|
860
|
+
generation_path = _new_layer_generation(ts_path, layer)
|
|
861
|
+
digest = _save_fp32_square_safetensors_atomic(
|
|
862
|
+
generation_path, [layer], d_model, _rows, durable=durable,
|
|
863
|
+
)
|
|
864
|
+
created.append(generation_path)
|
|
865
|
+
tensor_files[str(layer)] = generation_path.name
|
|
866
|
+
tensor_sha256[str(layer)] = digest
|
|
867
|
+
except BaseException:
|
|
868
|
+
for path in created:
|
|
869
|
+
path.unlink(missing_ok=True)
|
|
870
|
+
raise
|
|
871
|
+
sidecar: dict[str, Any] = {
|
|
872
|
+
"format_version": LENS_FORMAT_VERSION,
|
|
873
|
+
"method": (
|
|
874
|
+
_RELP_METHOD if backward_rules == "relp" else _LENS_METHOD
|
|
875
|
+
),
|
|
876
|
+
"n_prompts": int(n_prompts),
|
|
877
|
+
"d_model": int(d_model),
|
|
878
|
+
"source_layers": sorted(int(layer) for layer in jacobians),
|
|
879
|
+
"dtype": "float32",
|
|
880
|
+
"corpus_spec": corpus_spec,
|
|
881
|
+
"corpus_sha256": corpus_sha256,
|
|
882
|
+
"corpus_hash_kind": corpus_hash_kind,
|
|
883
|
+
"seq_len": seq_len,
|
|
884
|
+
"dim_batch": dim_batch,
|
|
885
|
+
"skip_first_positions": skip_first,
|
|
886
|
+
"estimator_policy": lens_estimator_policy(
|
|
887
|
+
skip_first=skip_first, backward_rules=backward_rules,
|
|
888
|
+
),
|
|
889
|
+
"tensor_sha256": tensor_sha256,
|
|
890
|
+
"tensor_files": tensor_files,
|
|
891
|
+
"raw_corpus_sha256": raw_corpus_sha256,
|
|
892
|
+
"raw_prompt_count": None if raw_prompt_count is None else int(raw_prompt_count),
|
|
893
|
+
"usable_prompt_count": (
|
|
894
|
+
None if usable_prompt_count is None else int(usable_prompt_count)
|
|
895
|
+
),
|
|
896
|
+
"model_layer_count": (
|
|
897
|
+
None if model_layer_count is None else int(model_layer_count)
|
|
898
|
+
),
|
|
899
|
+
"model_fingerprint": model_fingerprint,
|
|
900
|
+
"model_source_fingerprint": model_source_fingerprint,
|
|
901
|
+
"checkpoint": False,
|
|
902
|
+
"base_n_prompts": None,
|
|
903
|
+
"partial_n_prompts": None,
|
|
904
|
+
"consumed_prefix_sha256": None,
|
|
905
|
+
}
|
|
906
|
+
if extra_sidecar:
|
|
907
|
+
sidecar.update(extra_sidecar)
|
|
908
|
+
if set(sidecar) != _LENS_SIDECAR_FIELDS:
|
|
909
|
+
raise ValueError("lens writer produced a non-canonical sidecar")
|
|
910
|
+
try:
|
|
911
|
+
# Every immutable layer generation is complete before this one atomic
|
|
912
|
+
# pointer switch. A sidecar failure leaves the prior pointer and tensor
|
|
913
|
+
# untouched, and the failed new generations are simply discarded.
|
|
914
|
+
fsync_directory(sc_path.parent)
|
|
915
|
+
write_json_atomic(sc_path, sidecar)
|
|
916
|
+
except BaseException:
|
|
917
|
+
# A signal may unwind just after the atomic replace. Never delete
|
|
918
|
+
# immutable generations the live pointer already names.
|
|
919
|
+
if not _json_pointer_matches(sc_path, sidecar):
|
|
920
|
+
for path in created:
|
|
921
|
+
path.unlink(missing_ok=True)
|
|
922
|
+
raise
|
|
923
|
+
# Make the new pointer rename durable before deleting any generation the
|
|
924
|
+
# previous pointer named. Otherwise power loss can roll the directory back
|
|
925
|
+
# to an old pointer whose shards GC already removed.
|
|
926
|
+
fsync_directory(sc_path.parent)
|
|
927
|
+
if proof_out is not None:
|
|
928
|
+
proof_out[:] = [_lens_payload_proof(ts_path, sidecar)]
|
|
929
|
+
_cleanup_unreferenced_generations(ts_path.parent)
|
|
930
|
+
fsync_directory(sc_path.parent)
|
|
931
|
+
return ts_path.parent / tensor_files[str(layer_ids[0])]
|
|
932
|
+
|
|
933
|
+
|
|
934
|
+
def _save_fp32_square_safetensors_atomic(
|
|
935
|
+
path: Path,
|
|
936
|
+
layers: list[int],
|
|
937
|
+
d_model: int,
|
|
938
|
+
rows: Callable[[int, int, int], torch.Tensor],
|
|
939
|
+
*,
|
|
940
|
+
durable: bool = True,
|
|
941
|
+
) -> str:
|
|
942
|
+
"""Stream square fp32 layer tensors into one atomic safetensors file.
|
|
943
|
+
|
|
944
|
+
``safetensors.torch.save_file`` requires a complete tensor mapping, which
|
|
945
|
+
would make checkpoint RSS include another full lens beside the fp32 estimator.
|
|
946
|
+
The wire format is deliberately simple: an 8-byte little-endian JSON-header
|
|
947
|
+
length, a space-padded JSON header, then contiguous tensor payloads. Writing
|
|
948
|
+
256-row fp32 stripes avoids a complete in-memory snapshot. Current writers
|
|
949
|
+
call this once per layer.
|
|
950
|
+
"""
|
|
951
|
+
path.parent.mkdir(parents=True, exist_ok=True)
|
|
952
|
+
tmp = path.with_suffix(path.suffix + ".tmp") if path.suffix else path.with_name(
|
|
953
|
+
path.name + ".tmp"
|
|
954
|
+
)
|
|
955
|
+
prefix, raw_header = _lens_safetensors_header(layers, d_model)
|
|
956
|
+
digest = hashlib.sha256()
|
|
957
|
+
try:
|
|
958
|
+
with open(tmp, "wb", buffering=0) as f:
|
|
959
|
+
f.write(prefix)
|
|
960
|
+
digest.update(prefix)
|
|
961
|
+
f.write(raw_header)
|
|
962
|
+
digest.update(raw_header)
|
|
963
|
+
for layer in sorted(layers):
|
|
964
|
+
for start in range(0, d_model, 256):
|
|
965
|
+
block = rows(layer, start, min(start + 256, d_model))
|
|
966
|
+
expected = (min(start + 256, d_model) - start, d_model)
|
|
967
|
+
if block.dtype != torch.float32 or tuple(block.shape) != expected:
|
|
968
|
+
raise ValueError(
|
|
969
|
+
f"streamed layer {layer} rows have "
|
|
970
|
+
f"{tuple(block.shape)} {block.dtype}; expected "
|
|
971
|
+
f"{expected} float32"
|
|
972
|
+
)
|
|
973
|
+
# Both file.write and hashlib accept the buffer protocol;
|
|
974
|
+
# keep the stripe tensor alive and avoid allocating a
|
|
975
|
+
# second payload-sized ``bytes`` copy.
|
|
976
|
+
payload = memoryview(cast(Any, block.numpy())).cast("B")
|
|
977
|
+
f.write(payload)
|
|
978
|
+
digest.update(payload)
|
|
979
|
+
if durable:
|
|
980
|
+
os.fsync(f.fileno())
|
|
981
|
+
except BaseException:
|
|
982
|
+
with suppress(FileNotFoundError):
|
|
983
|
+
tmp.unlink()
|
|
984
|
+
raise
|
|
985
|
+
os.replace(tmp, path)
|
|
986
|
+
return digest.hexdigest()
|
|
987
|
+
|
|
988
|
+
|
|
989
|
+
def _lens_safetensors_header(
|
|
990
|
+
layers: list[int], d_model: int,
|
|
991
|
+
) -> tuple[bytes, bytes]:
|
|
992
|
+
"""Canonical writer header bytes, shared by save and load-time digest."""
|
|
993
|
+
bytes_per_layer = int(d_model) * int(d_model) * 4
|
|
994
|
+
offset = 0
|
|
995
|
+
header: dict[str, dict[str, object]] = {}
|
|
996
|
+
for layer in sorted(layers):
|
|
997
|
+
header[f"layer_{layer}"] = {
|
|
998
|
+
"dtype": "F32",
|
|
999
|
+
"shape": [int(d_model), int(d_model)],
|
|
1000
|
+
"data_offsets": [offset, offset + bytes_per_layer],
|
|
1001
|
+
}
|
|
1002
|
+
offset += bytes_per_layer
|
|
1003
|
+
raw_header = json.dumps(
|
|
1004
|
+
header, separators=(",", ":"), ensure_ascii=False,
|
|
1005
|
+
).encode("utf-8")
|
|
1006
|
+
padded_len = (len(raw_header) + 7) // 8 * 8
|
|
1007
|
+
raw_header += b" " * (padded_len - len(raw_header))
|
|
1008
|
+
return struct.pack("<Q", padded_len), raw_header
|
|
1009
|
+
|
|
1010
|
+
|
|
1011
|
+
def load_local_lens(
|
|
1012
|
+
model_id: str, name: str = "default",
|
|
1013
|
+
) -> tuple[JacobianLens, dict[str, Any]] | None:
|
|
1014
|
+
"""Load the Drowse-owned local/default lens when usable.
|
|
1015
|
+
|
|
1016
|
+
Self-healing like the neutral-activation cache: a wrong format version,
|
|
1017
|
+
non-finite tensors, or any parse failure logs a warning and reads as
|
|
1018
|
+
"no lens" (the caller decides whether to error or re-fit) rather than
|
|
1019
|
+
crashing the session.
|
|
1020
|
+
"""
|
|
1021
|
+
loaded = _load_lens_verified(model_id, name=name)
|
|
1022
|
+
return None if loaded is None else (loaded[0], loaded[1])
|
|
1023
|
+
|
|
1024
|
+
|
|
1025
|
+
def load_lens(model_id: str) -> tuple[JacobianLens, dict[str, Any]] | None:
|
|
1026
|
+
"""Load the active local or externally managed lens source."""
|
|
1027
|
+
from drowse.io.lens_sources import (
|
|
1028
|
+
load_active_lens_source,
|
|
1029
|
+
load_external_lens,
|
|
1030
|
+
)
|
|
1031
|
+
|
|
1032
|
+
active = load_active_lens_source(model_id)
|
|
1033
|
+
if active is None:
|
|
1034
|
+
return None
|
|
1035
|
+
if active["kind"] == "huggingface":
|
|
1036
|
+
return load_external_lens(model_id, active["name"])
|
|
1037
|
+
return load_local_lens(model_id, active["name"])
|
|
1038
|
+
|
|
1039
|
+
|
|
1040
|
+
def _load_lens_verified(
|
|
1041
|
+
model_id: str,
|
|
1042
|
+
*,
|
|
1043
|
+
name: str = "default",
|
|
1044
|
+
requested_layers: set[int] | None = None,
|
|
1045
|
+
) -> tuple[
|
|
1046
|
+
JacobianLens, dict[str, Any], _LensPayloadProof | None,
|
|
1047
|
+
] | None:
|
|
1048
|
+
"""Load a durable lens plus a proof reusable under the fit transaction."""
|
|
1049
|
+
anchor, sc_path = _lens_anchor_paths(model_id, name)
|
|
1050
|
+
with lens_fit_lock(model_id, name), artifact_lock(anchor):
|
|
1051
|
+
sidecar = _load_sidecar_at(
|
|
1052
|
+
model_id, anchor, sc_path, label="jlens cache",
|
|
1053
|
+
)
|
|
1054
|
+
loaded = _load_lens_at(
|
|
1055
|
+
model_id, anchor, sc_path, sidecar, label="jlens cache",
|
|
1056
|
+
requested_layers=requested_layers,
|
|
1057
|
+
)
|
|
1058
|
+
if loaded is None:
|
|
1059
|
+
return None
|
|
1060
|
+
lens, verified_sidecar = loaded
|
|
1061
|
+
_cleanup_unreferenced_generations(anchor.parent)
|
|
1062
|
+
durable_layers = {
|
|
1063
|
+
int(layer) for layer in verified_sidecar["source_layers"]
|
|
1064
|
+
}
|
|
1065
|
+
fully_verified = (
|
|
1066
|
+
requested_layers is None or requested_layers >= durable_layers
|
|
1067
|
+
)
|
|
1068
|
+
return lens, verified_sidecar, (
|
|
1069
|
+
_lens_payload_proof(anchor, verified_sidecar)
|
|
1070
|
+
if fully_verified else None
|
|
1071
|
+
)
|
|
1072
|
+
|
|
1073
|
+
|
|
1074
|
+
def load_lens_checkpoint(
|
|
1075
|
+
model_id: str, name: str = "default",
|
|
1076
|
+
) -> tuple[JacobianLens, dict[str, Any]] | None:
|
|
1077
|
+
"""Load a resumable partial lens shard, or ``None`` when absent/unusable."""
|
|
1078
|
+
anchor, sc_path = _checkpoint_anchor_paths(model_id, name)
|
|
1079
|
+
with lens_fit_lock(model_id, name), artifact_lock(anchor):
|
|
1080
|
+
sidecar = _load_sidecar_at(
|
|
1081
|
+
model_id, anchor, sc_path, label="jlens checkpoint",
|
|
1082
|
+
)
|
|
1083
|
+
loaded = _load_lens_at(
|
|
1084
|
+
model_id, anchor, sc_path, sidecar, label="jlens checkpoint",
|
|
1085
|
+
)
|
|
1086
|
+
if loaded is not None:
|
|
1087
|
+
_cleanup_unreferenced_generations(anchor.parent)
|
|
1088
|
+
return loaded
|
|
1089
|
+
|
|
1090
|
+
|
|
1091
|
+
def promote_lens_checkpoint(
|
|
1092
|
+
model_id: str,
|
|
1093
|
+
*,
|
|
1094
|
+
name: str = "default",
|
|
1095
|
+
n_prompts: int,
|
|
1096
|
+
source_layers: list[int],
|
|
1097
|
+
corpus_sha256: str,
|
|
1098
|
+
corpus_hash_kind: str,
|
|
1099
|
+
seq_len: int,
|
|
1100
|
+
d_model: int,
|
|
1101
|
+
model_fingerprint: str,
|
|
1102
|
+
_verified_proof: _LensPayloadProof | None = None,
|
|
1103
|
+
) -> bool:
|
|
1104
|
+
"""Promote a complete checkpoint to the durable lens without rewriting it.
|
|
1105
|
+
|
|
1106
|
+
Terminal checkpoint cadence can coincide with successful fit completion.
|
|
1107
|
+
That shard is already the complete fp32 artifact, including any resumed
|
|
1108
|
+
base, so serializing the fp32 in-memory lens again would duplicate a
|
|
1109
|
+
potentially multi-GiB write. Promote only after cheap exact
|
|
1110
|
+
identity checks; callers fall back to :func:`save_lens` on ``False``.
|
|
1111
|
+
"""
|
|
1112
|
+
checkpoint_anchor, checkpoint_sc = _checkpoint_anchor_paths(model_id, name)
|
|
1113
|
+
final_anchor, final_sc = _lens_anchor_paths(model_id, name)
|
|
1114
|
+
with lens_fit_lock(model_id, name), artifact_lock(checkpoint_anchor), artifact_lock(final_anchor):
|
|
1115
|
+
sidecar = _load_sidecar_at(
|
|
1116
|
+
model_id, checkpoint_anchor, checkpoint_sc, label="jlens checkpoint",
|
|
1117
|
+
)
|
|
1118
|
+
if (
|
|
1119
|
+
sidecar is None
|
|
1120
|
+
or int(sidecar.get("format_version", 0)) != LENS_FORMAT_VERSION
|
|
1121
|
+
or int(sidecar.get("n_prompts", -1)) != int(n_prompts)
|
|
1122
|
+
or [int(layer) for layer in sidecar.get("source_layers", [])]
|
|
1123
|
+
!= sorted(int(layer) for layer in source_layers)
|
|
1124
|
+
or sidecar.get("corpus_sha256") != corpus_sha256
|
|
1125
|
+
or sidecar.get("corpus_hash_kind") != corpus_hash_kind
|
|
1126
|
+
or int(sidecar.get("seq_len", -1)) != int(seq_len)
|
|
1127
|
+
or int(sidecar.get("d_model", -1)) != int(d_model)
|
|
1128
|
+
or sidecar.get("model_fingerprint") != model_fingerprint
|
|
1129
|
+
or int(sidecar.get("base_n_prompts", -1)) != 0
|
|
1130
|
+
):
|
|
1131
|
+
return False
|
|
1132
|
+
if not _proof_matches(
|
|
1133
|
+
_verified_proof, checkpoint_anchor, sidecar,
|
|
1134
|
+
) and not lens_payloads_match(model_id, sidecar, checkpoint=True):
|
|
1135
|
+
return False
|
|
1136
|
+
checkpoint_tensors = set(_sidecar_tensor_paths(
|
|
1137
|
+
checkpoint_anchor, sidecar,
|
|
1138
|
+
[int(layer) for layer in sidecar["source_layers"]],
|
|
1139
|
+
).values())
|
|
1140
|
+
# Re-fsync the checkpoint payloads before publishing the final pointer.
|
|
1141
|
+
for checkpoint_ts in checkpoint_tensors:
|
|
1142
|
+
with open(checkpoint_ts, "rb") as handle:
|
|
1143
|
+
os.fsync(handle.fileno())
|
|
1144
|
+
# The final pointer must follow both file and directory durability.
|
|
1145
|
+
fsync_directory(final_sc.parent)
|
|
1146
|
+
durable_sidecar = dict(sidecar)
|
|
1147
|
+
durable_sidecar.update({
|
|
1148
|
+
"checkpoint": False,
|
|
1149
|
+
"base_n_prompts": None,
|
|
1150
|
+
"partial_n_prompts": None,
|
|
1151
|
+
"consumed_prefix_sha256": None,
|
|
1152
|
+
})
|
|
1153
|
+
# Publish only the pointer. The immutable tensor stays referenced by the
|
|
1154
|
+
# checkpoint until this succeeds, so any sidecar failure preserves both
|
|
1155
|
+
# the prior durable lens and the complete resumable checkpoint.
|
|
1156
|
+
write_json_atomic(final_sc, durable_sidecar)
|
|
1157
|
+
fsync_directory(final_sc.parent)
|
|
1158
|
+
checkpoint_sc.unlink(missing_ok=True)
|
|
1159
|
+
fsync_directory(final_sc.parent)
|
|
1160
|
+
_cleanup_unreferenced_generations(final_anchor.parent)
|
|
1161
|
+
fsync_directory(final_sc.parent)
|
|
1162
|
+
from drowse.io.lens_sources import set_active_local_lens
|
|
1163
|
+
|
|
1164
|
+
set_active_local_lens(model_id, name)
|
|
1165
|
+
return True
|
|
1166
|
+
|
|
1167
|
+
|
|
1168
|
+
def _load_lens_at(
|
|
1169
|
+
model_id: str,
|
|
1170
|
+
tensor_anchor: Path,
|
|
1171
|
+
_sc_path: Path,
|
|
1172
|
+
sidecar: dict[str, Any] | None,
|
|
1173
|
+
*,
|
|
1174
|
+
label: str,
|
|
1175
|
+
requested_layers: set[int] | None = None,
|
|
1176
|
+
) -> tuple[JacobianLens, dict[str, Any]] | None:
|
|
1177
|
+
if sidecar is None:
|
|
1178
|
+
return None
|
|
1179
|
+
try:
|
|
1180
|
+
d_model = int(sidecar["d_model"])
|
|
1181
|
+
durable_layers = [int(layer) for layer in sidecar["source_layers"]]
|
|
1182
|
+
if (
|
|
1183
|
+
requested_layers is not None
|
|
1184
|
+
and requested_layers - set(durable_layers)
|
|
1185
|
+
):
|
|
1186
|
+
raise ValueError("requested layers are absent from lens")
|
|
1187
|
+
source_layers = (
|
|
1188
|
+
durable_layers if requested_layers is None
|
|
1189
|
+
else [layer for layer in durable_layers if layer in requested_layers]
|
|
1190
|
+
)
|
|
1191
|
+
if not source_layers:
|
|
1192
|
+
raise ValueError("requested layers are absent from lens")
|
|
1193
|
+
jacobians: dict[int, torch.Tensor] = {}
|
|
1194
|
+
tensor_paths = _sidecar_tensor_paths(
|
|
1195
|
+
tensor_anchor, sidecar, source_layers,
|
|
1196
|
+
require_exact_keys=(source_layers == durable_layers),
|
|
1197
|
+
)
|
|
1198
|
+
expected_digests = sidecar.get("tensor_sha256")
|
|
1199
|
+
if not isinstance(expected_digests, Mapping):
|
|
1200
|
+
log.warning(
|
|
1201
|
+
"%s for %s has no tensor digest map; ignoring — re-fit with "
|
|
1202
|
+
"`drowse lens fit`", label, model_id,
|
|
1203
|
+
)
|
|
1204
|
+
return None
|
|
1205
|
+
|
|
1206
|
+
groups: list[tuple[Path, list[int], str]] = []
|
|
1207
|
+
for layer in source_layers:
|
|
1208
|
+
expected = expected_digests.get(str(layer))
|
|
1209
|
+
if not isinstance(expected, str) or len(expected) != 64:
|
|
1210
|
+
raise ValueError(f"layer {layer} has no valid tensor digest")
|
|
1211
|
+
groups.append((tensor_paths[layer], [layer], expected))
|
|
1212
|
+
|
|
1213
|
+
for ts_path, tensor_layers, expected_digest in groups:
|
|
1214
|
+
prefix, raw_header = _lens_safetensors_header(
|
|
1215
|
+
tensor_layers, d_model,
|
|
1216
|
+
)
|
|
1217
|
+
digest = hashlib.sha256(prefix)
|
|
1218
|
+
digest.update(raw_header)
|
|
1219
|
+
with safe_open(str(ts_path), framework="pt", device="cpu") as tensors:
|
|
1220
|
+
actual_layers = sorted(
|
|
1221
|
+
int(k.split("_", 1)[1]) for k in tensors.keys()
|
|
1222
|
+
)
|
|
1223
|
+
if actual_layers != tensor_layers:
|
|
1224
|
+
log.warning(
|
|
1225
|
+
"%s for %s has tensor layers %s but sidecar declares %s; "
|
|
1226
|
+
"ignoring — re-fit with `drowse lens fit`",
|
|
1227
|
+
label, model_id, actual_layers, tensor_layers,
|
|
1228
|
+
)
|
|
1229
|
+
return None
|
|
1230
|
+
for layer in tensor_layers:
|
|
1231
|
+
raw = tensors.get_tensor(f"layer_{layer}")
|
|
1232
|
+
if (
|
|
1233
|
+
raw.dtype != torch.float32 or raw.ndim != 2
|
|
1234
|
+
or tuple(raw.shape) != (d_model, d_model)
|
|
1235
|
+
):
|
|
1236
|
+
log.warning(
|
|
1237
|
+
"%s for %s layer %d has shape %s (need %dx%d); "
|
|
1238
|
+
"ignoring — re-fit with `drowse lens fit`",
|
|
1239
|
+
label, model_id, layer, tuple(raw.shape),
|
|
1240
|
+
d_model, d_model,
|
|
1241
|
+
)
|
|
1242
|
+
return None
|
|
1243
|
+
for start in range(0, d_model, 256):
|
|
1244
|
+
block = raw[start:start + 256].contiguous()
|
|
1245
|
+
digest.update(
|
|
1246
|
+
memoryview(cast(Any, block.numpy())).cast("B"),
|
|
1247
|
+
)
|
|
1248
|
+
J = raw.to(torch.float32)
|
|
1249
|
+
if not bool(torch.isfinite(J).all()):
|
|
1250
|
+
log.warning(
|
|
1251
|
+
"%s for %s contains non-finite values; ignoring — "
|
|
1252
|
+
"re-fit with `drowse lens fit`", label, model_id,
|
|
1253
|
+
)
|
|
1254
|
+
return None
|
|
1255
|
+
jacobians[layer] = J
|
|
1256
|
+
if digest.hexdigest() != expected_digest:
|
|
1257
|
+
log.warning(
|
|
1258
|
+
"%s for %s failed tensor digest validation; ignoring — "
|
|
1259
|
+
"re-fit with `drowse lens fit`", label, model_id,
|
|
1260
|
+
)
|
|
1261
|
+
return None
|
|
1262
|
+
lens = JacobianLens(
|
|
1263
|
+
jacobians,
|
|
1264
|
+
n_prompts=int(sidecar.get("n_prompts", 0)),
|
|
1265
|
+
d_model=d_model,
|
|
1266
|
+
)
|
|
1267
|
+
return lens, sidecar
|
|
1268
|
+
except Exception as exc:
|
|
1269
|
+
log.warning("Corrupt %s for %s; ignoring: %s", label, model_id, exc)
|
|
1270
|
+
return None
|
|
1271
|
+
|
|
1272
|
+
|
|
1273
|
+
def _final_lens_subsumes_checkpoint(
|
|
1274
|
+
final: Mapping[str, Any], checkpoint: Mapping[str, Any],
|
|
1275
|
+
) -> bool:
|
|
1276
|
+
"""Whether the durable pointer contains every result in ``checkpoint``."""
|
|
1277
|
+
if checkpoint.get("checkpoint") is not True:
|
|
1278
|
+
return False
|
|
1279
|
+
semantic_keys = (
|
|
1280
|
+
"corpus_sha256",
|
|
1281
|
+
"corpus_hash_kind",
|
|
1282
|
+
"seq_len",
|
|
1283
|
+
"d_model",
|
|
1284
|
+
"model_fingerprint",
|
|
1285
|
+
"estimator_policy",
|
|
1286
|
+
)
|
|
1287
|
+
if any(final.get(key) != checkpoint.get(key) for key in semantic_keys):
|
|
1288
|
+
return False
|
|
1289
|
+
try:
|
|
1290
|
+
final_layers = {int(layer) for layer in final.get("source_layers", [])}
|
|
1291
|
+
checkpoint_layers = {
|
|
1292
|
+
int(layer) for layer in checkpoint.get("source_layers", [])
|
|
1293
|
+
}
|
|
1294
|
+
final_progress = int(final.get("n_prompts", -1))
|
|
1295
|
+
checkpoint_progress = int(checkpoint.get("base_n_prompts", 0)) + int(
|
|
1296
|
+
checkpoint.get("n_prompts", -1),
|
|
1297
|
+
)
|
|
1298
|
+
except (TypeError, ValueError):
|
|
1299
|
+
return False
|
|
1300
|
+
return bool(
|
|
1301
|
+
checkpoint_layers
|
|
1302
|
+
and final_layers >= checkpoint_layers
|
|
1303
|
+
and final_progress >= checkpoint_progress > 0
|
|
1304
|
+
)
|
|
1305
|
+
|
|
1306
|
+
|
|
1307
|
+
def remove_subsumed_lens_checkpoint(
|
|
1308
|
+
model_id: str,
|
|
1309
|
+
*,
|
|
1310
|
+
name: str = "default",
|
|
1311
|
+
verified_final_sidecar: Mapping[str, Any] | None = None,
|
|
1312
|
+
) -> bool:
|
|
1313
|
+
"""Reap a crash-left checkpoint only when the durable lens proves it redundant.
|
|
1314
|
+
|
|
1315
|
+
Final publication and checkpoint unlink are necessarily two filesystem
|
|
1316
|
+
operations. A process death between them leaves two complete shard sets.
|
|
1317
|
+
This recovery path preserves a farther-ahead or semantically different
|
|
1318
|
+
checkpoint and validates the final payload before discarding the recovery
|
|
1319
|
+
point. Callers that just validated the exact current final sidecar may pass it
|
|
1320
|
+
to avoid hashing a multi-GiB lens twice.
|
|
1321
|
+
"""
|
|
1322
|
+
final_anchor, final_sc = _lens_anchor_paths(model_id, name)
|
|
1323
|
+
checkpoint_anchor, checkpoint_sc = _checkpoint_anchor_paths(model_id, name)
|
|
1324
|
+
with (
|
|
1325
|
+
lens_fit_lock(model_id, name),
|
|
1326
|
+
artifact_lock(final_anchor),
|
|
1327
|
+
artifact_lock(checkpoint_anchor),
|
|
1328
|
+
):
|
|
1329
|
+
checkpoint = _load_sidecar_at(
|
|
1330
|
+
model_id, checkpoint_anchor, checkpoint_sc,
|
|
1331
|
+
label="jlens checkpoint",
|
|
1332
|
+
)
|
|
1333
|
+
if checkpoint is None:
|
|
1334
|
+
return False
|
|
1335
|
+
final = _load_sidecar_at(
|
|
1336
|
+
model_id, final_anchor, final_sc, label="jlens cache",
|
|
1337
|
+
)
|
|
1338
|
+
if final is None or not _final_lens_subsumes_checkpoint(final, checkpoint):
|
|
1339
|
+
return False
|
|
1340
|
+
caller_verified_current = bool(
|
|
1341
|
+
verified_final_sidecar is not None
|
|
1342
|
+
and dict(verified_final_sidecar) == final
|
|
1343
|
+
)
|
|
1344
|
+
if not caller_verified_current and not lens_payloads_match(model_id, final):
|
|
1345
|
+
return False
|
|
1346
|
+
checkpoint_sc.unlink(missing_ok=True)
|
|
1347
|
+
# The sidecar is the atomic pointer. Make its removal durable before
|
|
1348
|
+
# deleting any shard it could name, otherwise a crash can resurrect a
|
|
1349
|
+
# checkpoint pointer whose payload has already been collected.
|
|
1350
|
+
fsync_directory(final_anchor.parent)
|
|
1351
|
+
_cleanup_unreferenced_generations(final_anchor.parent)
|
|
1352
|
+
fsync_directory(final_anchor.parent)
|
|
1353
|
+
return True
|
|
1354
|
+
|
|
1355
|
+
|
|
1356
|
+
def remove_lens_checkpoint(model_id: str, name: str = "default") -> bool:
|
|
1357
|
+
"""Delete a resumable checkpoint shard. Returns True when anything was removed."""
|
|
1358
|
+
anchor, sc_path = _checkpoint_anchor_paths(model_id, name)
|
|
1359
|
+
with lens_fit_lock(model_id, name), artifact_lock(anchor):
|
|
1360
|
+
before = set(anchor.parent.glob("jlens*.safetensors"))
|
|
1361
|
+
removed = sc_path.exists()
|
|
1362
|
+
sc_path.unlink(missing_ok=True)
|
|
1363
|
+
fsync_directory(anchor.parent)
|
|
1364
|
+
_cleanup_unreferenced_generations(anchor.parent)
|
|
1365
|
+
fsync_directory(anchor.parent)
|
|
1366
|
+
after = set(anchor.parent.glob("jlens*.safetensors"))
|
|
1367
|
+
return removed or before != after
|
|
1368
|
+
|
|
1369
|
+
|
|
1370
|
+
def remove_lens(model_id: str, name: str = "default") -> bool:
|
|
1371
|
+
"""Delete a model's lens artifact. Returns True when anything was removed."""
|
|
1372
|
+
final_anchor, final_sc = _lens_anchor_paths(model_id, name)
|
|
1373
|
+
checkpoint_anchor, checkpoint_sc = _checkpoint_anchor_paths(model_id, name)
|
|
1374
|
+
with (
|
|
1375
|
+
lens_fit_lock(model_id, name),
|
|
1376
|
+
artifact_lock(final_anchor),
|
|
1377
|
+
artifact_lock(checkpoint_anchor),
|
|
1378
|
+
):
|
|
1379
|
+
tensor_candidates = (
|
|
1380
|
+
list(final_anchor.parent.glob("jlens*.gen-*.safetensors"))
|
|
1381
|
+
+ list(final_anchor.parent.glob("jlens*.gen-*.safetensors.tmp"))
|
|
1382
|
+
+ [
|
|
1383
|
+
final_anchor,
|
|
1384
|
+
checkpoint_anchor,
|
|
1385
|
+
final_anchor.with_suffix(final_anchor.suffix + ".tmp"),
|
|
1386
|
+
checkpoint_anchor.with_suffix(checkpoint_anchor.suffix + ".tmp"),
|
|
1387
|
+
]
|
|
1388
|
+
)
|
|
1389
|
+
candidates = [*tensor_candidates, final_sc, checkpoint_sc]
|
|
1390
|
+
removed = any(path.exists() for path in candidates)
|
|
1391
|
+
# Remove the atomic pointers first: after this logical deletion, a
|
|
1392
|
+
# best-effort tensor GC failure cannot expose a partially deleted lens.
|
|
1393
|
+
final_sc.unlink(missing_ok=True)
|
|
1394
|
+
checkpoint_sc.unlink(missing_ok=True)
|
|
1395
|
+
fsync_directory(final_anchor.parent)
|
|
1396
|
+
for path in tensor_candidates:
|
|
1397
|
+
try:
|
|
1398
|
+
path.unlink(missing_ok=True)
|
|
1399
|
+
except OSError as exc:
|
|
1400
|
+
log.warning("could not remove J-lens tensor %s: %s", path, exc)
|
|
1401
|
+
fsync_directory(final_anchor.parent)
|
|
1402
|
+
# Unpublish the selection when it named the lens just deleted, so it
|
|
1403
|
+
# can never outlive what it points at. The registry owns the payload
|
|
1404
|
+
# shape.
|
|
1405
|
+
from drowse.io.lens_sources import (
|
|
1406
|
+
LENS_SOURCES, lens_root, load_active_lens_source,
|
|
1407
|
+
)
|
|
1408
|
+
|
|
1409
|
+
active = load_active_lens_source(model_id)
|
|
1410
|
+
if active is not None and active["kind"] == "local":
|
|
1411
|
+
LENS_SOURCES.clear_if_active(
|
|
1412
|
+
lens_root(model_id), model_id, "local", active["name"],
|
|
1413
|
+
)
|
|
1414
|
+
return removed
|
|
1415
|
+
|
|
1416
|
+
|
|
1417
|
+
#: Documents are sliced to this many characters before tokenization — the fit
|
|
1418
|
+
#: truncates to ``seq_len`` tokens anyway, so tokenizing a full web page is
|
|
1419
|
+
#: waste.
|
|
1420
|
+
LENS_DOC_CHARS = 4000
|
|
1421
|
+
_COMMIT_SHA = re.compile(r"[0-9a-f]{40}")
|
|
1422
|
+
_DATASETS_MISSING = (
|
|
1423
|
+
"Hugging Face lens corpora stream via the optional `datasets` "
|
|
1424
|
+
"dependency — `pip install 'drowse.ai[hf]'`, or supply a corpus "
|
|
1425
|
+
"file (one document per line)"
|
|
1426
|
+
)
|
|
1427
|
+
_SOURCE_OPTIONS = ("text_field", "files", "seed", "weight")
|
|
1428
|
+
#: Streams an interleave reads at once. Opening a Hub data file costs one
|
|
1429
|
+
#: round trip plus its first row group (seconds each), so a read spread over
|
|
1430
|
+
#: dozens of files is latency-bound; every stream's documents are fixed by
|
|
1431
|
+
#: its own position in the data, so the concurrency never changes the result.
|
|
1432
|
+
_CORPUS_READ_THREADS = 8
|
|
1433
|
+
|
|
1434
|
+
|
|
1435
|
+
@dataclass(frozen=True)
|
|
1436
|
+
class HfLensCorpus:
|
|
1437
|
+
"""A Hugging Face dataset read as a lens-fit corpus.
|
|
1438
|
+
|
|
1439
|
+
The corpus is the first N non-empty ``text_field`` values of the train
|
|
1440
|
+
split, each stripped and sliced to :data:`LENS_DOC_CHARS`. With
|
|
1441
|
+
``files=K`` they come round-robin from K of the split's data files
|
|
1442
|
+
instead, ordered by a ``seed``-keyed hash of their paths, which spreads a
|
|
1443
|
+
sample over a dataset whose rows are not shuffled. Either way the first
|
|
1444
|
+
N documents of a longer read are exactly those of a shorter one, so a fit
|
|
1445
|
+
grows or resumes by token-id prefix; on a globally shuffled dataset the
|
|
1446
|
+
head is a random sample and growing a fit adds a nested one. ``revision``
|
|
1447
|
+
is any branch, tag, or commit until :func:`pin_lens_corpus` fixes it to a
|
|
1448
|
+
commit and names the config, which makes :attr:`spec` the recorded
|
|
1449
|
+
provenance.
|
|
1450
|
+
"""
|
|
1451
|
+
|
|
1452
|
+
repo: str
|
|
1453
|
+
config: str | None = None
|
|
1454
|
+
revision: str | None = None
|
|
1455
|
+
text_field: str = "text"
|
|
1456
|
+
files: int | None = None
|
|
1457
|
+
seed: int = 0
|
|
1458
|
+
|
|
1459
|
+
def __post_init__(self) -> None:
|
|
1460
|
+
if not self.text_field:
|
|
1461
|
+
raise ValueError("the corpus text field must not be empty")
|
|
1462
|
+
if self.files is not None and self.files < 1:
|
|
1463
|
+
raise ValueError("files must be at least 1")
|
|
1464
|
+
if self.seed < 0:
|
|
1465
|
+
raise ValueError("seed must not be negative")
|
|
1466
|
+
if self.seed and self.files is None:
|
|
1467
|
+
raise ValueError("seed applies only with files=K")
|
|
1468
|
+
|
|
1469
|
+
@property
|
|
1470
|
+
def pinned(self) -> bool:
|
|
1471
|
+
return self.config is not None and bool(
|
|
1472
|
+
_COMMIT_SHA.fullmatch(self.revision or "")
|
|
1473
|
+
)
|
|
1474
|
+
|
|
1475
|
+
@property
|
|
1476
|
+
def spec(self) -> str:
|
|
1477
|
+
"""Provenance recorded as the fit's ``corpus_spec``.
|
|
1478
|
+
|
|
1479
|
+
``hf:REPO/CONFIG@COMMIT;preprocess=…;doc_chars=…``, plus
|
|
1480
|
+
``;text_field=…`` when the text is not in ``text`` and
|
|
1481
|
+
``;files=…;seed=…`` for a read spread over files, so the default
|
|
1482
|
+
corpus keeps the spec its existing fits recorded.
|
|
1483
|
+
"""
|
|
1484
|
+
if not self.pinned:
|
|
1485
|
+
raise ValueError(f"{self} is not pinned to a config and commit")
|
|
1486
|
+
spec = (
|
|
1487
|
+
f"hf:{self.repo}/{self.config}@{self.revision};preprocess="
|
|
1488
|
+
f"{LENS_CORPUS_PREPROCESS_VERSION};doc_chars={LENS_DOC_CHARS}"
|
|
1489
|
+
)
|
|
1490
|
+
if self.text_field != "text":
|
|
1491
|
+
spec += f";text_field={self.text_field}"
|
|
1492
|
+
if self.files is not None:
|
|
1493
|
+
spec += f";files={self.files};seed={self.seed}"
|
|
1494
|
+
return spec
|
|
1495
|
+
|
|
1496
|
+
def __str__(self) -> str:
|
|
1497
|
+
text = self.repo
|
|
1498
|
+
if self.config is not None:
|
|
1499
|
+
text += f":{self.config}"
|
|
1500
|
+
if self.revision is not None:
|
|
1501
|
+
text += f"@{self.revision}"
|
|
1502
|
+
if self.text_field != "text":
|
|
1503
|
+
text += f",text_field={self.text_field}"
|
|
1504
|
+
if self.files is not None:
|
|
1505
|
+
text += f",files={self.files},seed={self.seed}"
|
|
1506
|
+
return text
|
|
1507
|
+
|
|
1508
|
+
|
|
1509
|
+
@dataclass(frozen=True)
|
|
1510
|
+
class LensCorpusMix:
|
|
1511
|
+
"""Several Hub corpora interleaved by integer weight.
|
|
1512
|
+
|
|
1513
|
+
Documents are drawn by smooth weighted round-robin, ties going to the
|
|
1514
|
+
earlier corpus, so weights 3,1 read A A B A A A B A …; a corpus that runs
|
|
1515
|
+
out leaves the schedule. The schedule never depends on N, so the mix
|
|
1516
|
+
keeps the prefix property of its parts and a fit on it resumes and grows
|
|
1517
|
+
the same way.
|
|
1518
|
+
"""
|
|
1519
|
+
|
|
1520
|
+
parts: tuple[HfLensCorpus, ...]
|
|
1521
|
+
weights: tuple[int, ...]
|
|
1522
|
+
|
|
1523
|
+
def __post_init__(self) -> None:
|
|
1524
|
+
if len(self.parts) < 2 or len(self.weights) != len(self.parts):
|
|
1525
|
+
raise ValueError("a corpus mix needs one weight per corpus, ≥ 2")
|
|
1526
|
+
if any(weight < 1 for weight in self.weights):
|
|
1527
|
+
raise ValueError("corpus weights must be at least 1")
|
|
1528
|
+
|
|
1529
|
+
@property
|
|
1530
|
+
def pinned(self) -> bool:
|
|
1531
|
+
return all(part.pinned for part in self.parts)
|
|
1532
|
+
|
|
1533
|
+
@property
|
|
1534
|
+
def spec(self) -> str:
|
|
1535
|
+
"""``mix:W*SPEC|W*SPEC…``, each part's own spec in schedule order."""
|
|
1536
|
+
return "mix:" + "|".join(
|
|
1537
|
+
f"{weight}*{part.spec}"
|
|
1538
|
+
for part, weight in zip(self.parts, self.weights)
|
|
1539
|
+
)
|
|
1540
|
+
|
|
1541
|
+
def __str__(self) -> str:
|
|
1542
|
+
return " + ".join(
|
|
1543
|
+
f"{part},weight={weight}"
|
|
1544
|
+
for part, weight in zip(self.parts, self.weights)
|
|
1545
|
+
)
|
|
1546
|
+
|
|
1547
|
+
|
|
1548
|
+
LensCorpus = HfLensCorpus | LensCorpusMix
|
|
1549
|
+
|
|
1550
|
+
#: Default web-text corpus for a lens fit — the paper-parity pretraining-like
|
|
1551
|
+
#: sample. Shared by CLI ``lens fit`` / ``sae train`` and the server's fit and
|
|
1552
|
+
#: train routes.
|
|
1553
|
+
DEFAULT_LENS_CORPUS = HfLensCorpus("HuggingFaceFW/fineweb-edu", "sample-10BT")
|
|
1554
|
+
|
|
1555
|
+
|
|
1556
|
+
def parse_lens_corpus(sources: Sequence[str] | None) -> LensCorpus:
|
|
1557
|
+
"""The corpus named by CLI ``--hf-corpus`` values or the fit route's list.
|
|
1558
|
+
|
|
1559
|
+
Each source is ``REPO[:CONFIG][@REV][,KEY=VALUE…]`` with keys
|
|
1560
|
+
``text_field`` (default ``text``), ``files`` (spread the read over that
|
|
1561
|
+
many data files), ``seed`` (their order, default 0), and ``weight`` (a mix
|
|
1562
|
+
member's share, default 1). Several sources make a
|
|
1563
|
+
:class:`LensCorpusMix`; none is the default corpus. Raises
|
|
1564
|
+
``ValueError`` for a malformed source.
|
|
1565
|
+
"""
|
|
1566
|
+
if not sources:
|
|
1567
|
+
return DEFAULT_LENS_CORPUS
|
|
1568
|
+
parsed = [_parse_source(raw) for raw in sources]
|
|
1569
|
+
if len(parsed) == 1:
|
|
1570
|
+
corpus, weight = parsed[0]
|
|
1571
|
+
if weight is not None:
|
|
1572
|
+
raise ValueError("weight applies only to a mix of several corpora")
|
|
1573
|
+
return corpus
|
|
1574
|
+
return LensCorpusMix(
|
|
1575
|
+
tuple(corpus for corpus, _weight in parsed),
|
|
1576
|
+
tuple(1 if weight is None else weight for _corpus, weight in parsed),
|
|
1577
|
+
)
|
|
1578
|
+
|
|
1579
|
+
|
|
1580
|
+
def _parse_source(raw: str) -> tuple[HfLensCorpus, int | None]:
|
|
1581
|
+
source, *options = raw.strip().split(",")
|
|
1582
|
+
head, at, revision = source.partition("@")
|
|
1583
|
+
repo, colon, config = head.partition(":")
|
|
1584
|
+
if (
|
|
1585
|
+
not repo or any(ch.isspace() for ch in source)
|
|
1586
|
+
or (colon and not config) or (at and not revision)
|
|
1587
|
+
or ":" in revision
|
|
1588
|
+
):
|
|
1589
|
+
raise ValueError(
|
|
1590
|
+
f"bad Hugging Face corpus {raw!r} (want "
|
|
1591
|
+
"REPO[:CONFIG][@REV][,KEY=VALUE…], e.g. "
|
|
1592
|
+
"HuggingFaceFW/dclm_100BT-shuffled)"
|
|
1593
|
+
)
|
|
1594
|
+
values: dict[str, str] = {}
|
|
1595
|
+
for option in options:
|
|
1596
|
+
key, eq, value = option.partition("=")
|
|
1597
|
+
if key not in _SOURCE_OPTIONS or not eq or not value or key in values:
|
|
1598
|
+
raise ValueError(
|
|
1599
|
+
f"bad corpus option {option!r} in {raw!r} (want KEY=VALUE, "
|
|
1600
|
+
f"KEY one of {', '.join(_SOURCE_OPTIONS)}, each at most once)"
|
|
1601
|
+
)
|
|
1602
|
+
values[key] = value
|
|
1603
|
+
try:
|
|
1604
|
+
ints = {
|
|
1605
|
+
key: int(values[key])
|
|
1606
|
+
for key in ("files", "seed", "weight") if key in values
|
|
1607
|
+
}
|
|
1608
|
+
except ValueError:
|
|
1609
|
+
raise ValueError(
|
|
1610
|
+
f"files, seed, and weight take integers, in {raw!r}"
|
|
1611
|
+
) from None
|
|
1612
|
+
weight = ints.get("weight")
|
|
1613
|
+
if weight is not None and weight < 1:
|
|
1614
|
+
raise ValueError("corpus weights must be at least 1")
|
|
1615
|
+
corpus = HfLensCorpus(
|
|
1616
|
+
repo, config or None, revision or None,
|
|
1617
|
+
values.get("text_field", "text"), ints.get("files"),
|
|
1618
|
+
ints.get("seed", 0),
|
|
1619
|
+
)
|
|
1620
|
+
if "seed" in ints and corpus.files is None:
|
|
1621
|
+
raise ValueError("seed applies only with files=K")
|
|
1622
|
+
return corpus, weight
|
|
1623
|
+
|
|
1624
|
+
|
|
1625
|
+
@overload
|
|
1626
|
+
def pin_lens_corpus(corpus: HfLensCorpus = ...) -> HfLensCorpus: ...
|
|
1627
|
+
|
|
1628
|
+
|
|
1629
|
+
@overload
|
|
1630
|
+
def pin_lens_corpus(corpus: LensCorpusMix) -> LensCorpusMix: ...
|
|
1631
|
+
|
|
1632
|
+
|
|
1633
|
+
def pin_lens_corpus(corpus: LensCorpus = DEFAULT_LENS_CORPUS) -> LensCorpus:
|
|
1634
|
+
"""Fix ``corpus`` (each part of a mix) to a Hub commit and named config.
|
|
1635
|
+
|
|
1636
|
+
An already pinned source is returned as is, without a Hub call. An
|
|
1637
|
+
omitted config resolves to the dataset's default at that commit, which
|
|
1638
|
+
needs the optional ``datasets`` dependency.
|
|
1639
|
+
"""
|
|
1640
|
+
if isinstance(corpus, LensCorpusMix):
|
|
1641
|
+
return replace(
|
|
1642
|
+
corpus, parts=tuple(_pin_source(part) for part in corpus.parts),
|
|
1643
|
+
)
|
|
1644
|
+
return _pin_source(corpus)
|
|
1645
|
+
|
|
1646
|
+
|
|
1647
|
+
def _pin_source(corpus: HfLensCorpus) -> HfLensCorpus:
|
|
1648
|
+
from drowse.core.jlens import JacobianLensError
|
|
1649
|
+
|
|
1650
|
+
if corpus.pinned:
|
|
1651
|
+
return corpus
|
|
1652
|
+
try:
|
|
1653
|
+
from huggingface_hub import HfApi
|
|
1654
|
+
|
|
1655
|
+
revision = HfApi().dataset_info(
|
|
1656
|
+
corpus.repo, revision=corpus.revision,
|
|
1657
|
+
).sha
|
|
1658
|
+
except Exception as exc:
|
|
1659
|
+
raise JacobianLensError(
|
|
1660
|
+
f"could not resolve an immutable revision for {corpus}: {exc}"
|
|
1661
|
+
) from exc
|
|
1662
|
+
if not revision:
|
|
1663
|
+
raise JacobianLensError(
|
|
1664
|
+
f"Hugging Face returned no immutable dataset revision for {corpus}"
|
|
1665
|
+
)
|
|
1666
|
+
config = corpus.config
|
|
1667
|
+
if config is None:
|
|
1668
|
+
try:
|
|
1669
|
+
from datasets import load_dataset_builder
|
|
1670
|
+
except ImportError as e:
|
|
1671
|
+
raise JacobianLensError(_DATASETS_MISSING) from e
|
|
1672
|
+
try:
|
|
1673
|
+
config = load_dataset_builder(
|
|
1674
|
+
corpus.repo, revision=revision,
|
|
1675
|
+
).config.name
|
|
1676
|
+
except Exception as exc:
|
|
1677
|
+
raise JacobianLensError(
|
|
1678
|
+
f"could not resolve the default config of {corpus}; name one "
|
|
1679
|
+
f"as REPO:CONFIG ({exc})"
|
|
1680
|
+
) from exc
|
|
1681
|
+
return replace(corpus, config=str(config), revision=str(revision))
|
|
1682
|
+
|
|
1683
|
+
|
|
1684
|
+
def stream_lens_corpus(
|
|
1685
|
+
n: int,
|
|
1686
|
+
corpus: LensCorpus = DEFAULT_LENS_CORPUS,
|
|
1687
|
+
*,
|
|
1688
|
+
cancel_event: threading.Event | None = None,
|
|
1689
|
+
) -> tuple[list[str], str]:
|
|
1690
|
+
"""Stream the first ``n`` documents of a Hub corpus (default web text).
|
|
1691
|
+
|
|
1692
|
+
Returns ``(documents, corpus_spec)``. Needs the optional ``datasets``
|
|
1693
|
+
dependency (``pip install 'drowse.ai[hf]'``); raises
|
|
1694
|
+
:class:`~drowse.core.jlens.JacobianLensError` without it so both the CLI
|
|
1695
|
+
and the fit route surface the same actionable message. Hub resolution and
|
|
1696
|
+
streaming always run in an isolated spawned process, which is terminated
|
|
1697
|
+
once it has sent its result. A cancellation event can therefore abandon a
|
|
1698
|
+
blocked provider read without trapping the server in ``cancelling…``, and
|
|
1699
|
+
no caller inherits the provider's threads: after a stream stops early,
|
|
1700
|
+
pyarrow's I/O pool can block interpreter exit forever (every time on
|
|
1701
|
+
``HuggingFaceFW/dclm_100BT-shuffled``), even though the read returned.
|
|
1702
|
+
"""
|
|
1703
|
+
from drowse.core.jlens import JacobianLensCancelled, JacobianLensError
|
|
1704
|
+
|
|
1705
|
+
def cancelled() -> bool:
|
|
1706
|
+
return cancel_event is not None and cancel_event.is_set()
|
|
1707
|
+
|
|
1708
|
+
if cancelled():
|
|
1709
|
+
raise JacobianLensCancelled(
|
|
1710
|
+
"Jacobian-lens fit cancelled while preparing its corpus"
|
|
1711
|
+
)
|
|
1712
|
+
|
|
1713
|
+
process, receiver = _start_lens_corpus_process(n, corpus)
|
|
1714
|
+
try:
|
|
1715
|
+
while True:
|
|
1716
|
+
if cancelled():
|
|
1717
|
+
raise JacobianLensCancelled(
|
|
1718
|
+
"Jacobian-lens fit cancelled while streaming its corpus"
|
|
1719
|
+
)
|
|
1720
|
+
ready = receiver.poll(0.1)
|
|
1721
|
+
# A click that lands while ``poll`` is waiting must win over a
|
|
1722
|
+
# simultaneously-ready result; once the user asks to cancel, do
|
|
1723
|
+
# not unexpectedly advance into the hours-long estimator phase.
|
|
1724
|
+
if cancelled():
|
|
1725
|
+
raise JacobianLensCancelled(
|
|
1726
|
+
"Jacobian-lens fit cancelled while streaming its corpus"
|
|
1727
|
+
)
|
|
1728
|
+
if ready:
|
|
1729
|
+
payload = receiver.recv()
|
|
1730
|
+
kind = payload[0]
|
|
1731
|
+
if kind == "ok":
|
|
1732
|
+
return cast(tuple[list[str], str], payload[1])
|
|
1733
|
+
if kind == "typed_error":
|
|
1734
|
+
raise JacobianLensError(str(payload[1]))
|
|
1735
|
+
raise RuntimeError(
|
|
1736
|
+
f"lens corpus worker failed ({payload[1]})"
|
|
1737
|
+
)
|
|
1738
|
+
if not process.is_alive():
|
|
1739
|
+
raise RuntimeError(
|
|
1740
|
+
"lens corpus worker exited without a result"
|
|
1741
|
+
)
|
|
1742
|
+
finally:
|
|
1743
|
+
receiver.close()
|
|
1744
|
+
if process.is_alive():
|
|
1745
|
+
process.terminate()
|
|
1746
|
+
process.join(timeout=5)
|
|
1747
|
+
if process.is_alive():
|
|
1748
|
+
process.kill()
|
|
1749
|
+
process.join(timeout=5)
|
|
1750
|
+
else:
|
|
1751
|
+
process.join(timeout=0)
|
|
1752
|
+
|
|
1753
|
+
|
|
1754
|
+
def _collect_lens_corpus(
|
|
1755
|
+
n: int, corpus: LensCorpus,
|
|
1756
|
+
) -> tuple[list[str], str]:
|
|
1757
|
+
"""Direct provider read; runs inside the isolated corpus worker."""
|
|
1758
|
+
from drowse.core.jlens import JacobianLensError
|
|
1759
|
+
|
|
1760
|
+
try:
|
|
1761
|
+
import datasets # noqa: F401 — fail early with the install hint
|
|
1762
|
+
except ImportError as e:
|
|
1763
|
+
raise JacobianLensError(_DATASETS_MISSING) from e
|
|
1764
|
+
|
|
1765
|
+
pinned = pin_lens_corpus(corpus)
|
|
1766
|
+
return _document_stream(pinned).prefix(n), pinned.spec
|
|
1767
|
+
|
|
1768
|
+
|
|
1769
|
+
class _DocumentStream(Protocol):
|
|
1770
|
+
def prefix(self, n: int) -> list[str]:
|
|
1771
|
+
"""The stream's first ``n`` documents, fewer once it runs dry."""
|
|
1772
|
+
...
|
|
1773
|
+
|
|
1774
|
+
|
|
1775
|
+
def _document_stream(corpus: LensCorpus) -> _DocumentStream:
|
|
1776
|
+
if isinstance(corpus, LensCorpusMix):
|
|
1777
|
+
return _Interleave(
|
|
1778
|
+
[_document_stream(part) for part in corpus.parts], corpus.weights,
|
|
1779
|
+
)
|
|
1780
|
+
if corpus.files is None:
|
|
1781
|
+
return _Documents(corpus)
|
|
1782
|
+
files = _spread_files(corpus)
|
|
1783
|
+
return _Interleave(
|
|
1784
|
+
[_Documents(corpus, data_file) for data_file in files], [1] * len(files),
|
|
1785
|
+
)
|
|
1786
|
+
|
|
1787
|
+
|
|
1788
|
+
def _spread_files(corpus: HfLensCorpus) -> list[str]:
|
|
1789
|
+
"""The first ``files`` train data files of a pinned source, in the order
|
|
1790
|
+
of a ``seed``-keyed hash of their repository paths."""
|
|
1791
|
+
from datasets import load_dataset_builder
|
|
1792
|
+
|
|
1793
|
+
from drowse.core.jlens import JacobianLensError
|
|
1794
|
+
|
|
1795
|
+
try:
|
|
1796
|
+
data_files = load_dataset_builder(
|
|
1797
|
+
corpus.repo, name=corpus.config, revision=corpus.revision,
|
|
1798
|
+
).config.data_files
|
|
1799
|
+
urls = [str(url) for url in (data_files or {}).get("train", [])]
|
|
1800
|
+
except Exception as exc:
|
|
1801
|
+
raise JacobianLensError(
|
|
1802
|
+
f"could not list the train files of {corpus}: {exc}"
|
|
1803
|
+
) from exc
|
|
1804
|
+
if not urls:
|
|
1805
|
+
raise JacobianLensError(f"{corpus} has no train data files to spread over")
|
|
1806
|
+
marker = f"@{corpus.revision}/"
|
|
1807
|
+
paths = [url.split(marker, 1)[1] if marker in url else url for url in urls]
|
|
1808
|
+
paths.sort(
|
|
1809
|
+
key=lambda path: hashlib.sha256(
|
|
1810
|
+
f"{corpus.seed}:{path}".encode("utf-8")
|
|
1811
|
+
).digest()
|
|
1812
|
+
)
|
|
1813
|
+
assert corpus.files is not None
|
|
1814
|
+
return paths[: corpus.files]
|
|
1815
|
+
|
|
1816
|
+
|
|
1817
|
+
class _Documents:
|
|
1818
|
+
"""A pinned source's non-empty documents, from its whole train split or
|
|
1819
|
+
one of its data files; a longer request rereads from the start."""
|
|
1820
|
+
|
|
1821
|
+
def __init__(self, corpus: HfLensCorpus, data_file: str | None = None) -> None:
|
|
1822
|
+
self._corpus = corpus
|
|
1823
|
+
self._data_file = data_file
|
|
1824
|
+
self._docs: list[str] = []
|
|
1825
|
+
self._exhausted = False
|
|
1826
|
+
|
|
1827
|
+
def prefix(self, n: int) -> list[str]:
|
|
1828
|
+
if len(self._docs) < n and not self._exhausted:
|
|
1829
|
+
self._docs = _read_lens_documents(
|
|
1830
|
+
self._rows(), n, self._corpus.text_field,
|
|
1831
|
+
)
|
|
1832
|
+
self._exhausted = len(self._docs) < n
|
|
1833
|
+
return self._docs[:n]
|
|
1834
|
+
|
|
1835
|
+
def _rows(self) -> Iterable[Mapping[str, Any]]:
|
|
1836
|
+
from datasets import load_dataset
|
|
1837
|
+
|
|
1838
|
+
from drowse.core.jlens import JacobianLensError
|
|
1839
|
+
|
|
1840
|
+
corpus = self._corpus
|
|
1841
|
+
extra: dict[str, Any] = {}
|
|
1842
|
+
where = str(corpus)
|
|
1843
|
+
if self._data_file is not None:
|
|
1844
|
+
extra["data_files"] = {"train": [self._data_file]}
|
|
1845
|
+
where = f"{self._data_file} of {corpus}"
|
|
1846
|
+
try:
|
|
1847
|
+
return load_dataset(
|
|
1848
|
+
corpus.repo, name=corpus.config, split="train", streaming=True,
|
|
1849
|
+
revision=corpus.revision, **extra,
|
|
1850
|
+
)
|
|
1851
|
+
except Exception as exc:
|
|
1852
|
+
raise JacobianLensError(f"could not open {where}: {exc}") from exc
|
|
1853
|
+
|
|
1854
|
+
|
|
1855
|
+
class _Interleave:
|
|
1856
|
+
"""Document streams merged by :func:`_weighted_schedule`."""
|
|
1857
|
+
|
|
1858
|
+
def __init__(
|
|
1859
|
+
self, streams: Sequence[_DocumentStream], weights: Sequence[int],
|
|
1860
|
+
) -> None:
|
|
1861
|
+
self._streams = list(streams)
|
|
1862
|
+
self._weights = list(weights)
|
|
1863
|
+
|
|
1864
|
+
def prefix(self, n: int) -> list[str]:
|
|
1865
|
+
# Schedule assuming every stream is long enough; a stream that comes
|
|
1866
|
+
# up short is capped at what it has and the schedule is redrawn, which
|
|
1867
|
+
# equals drawing lazily and dropping a stream when it runs dry.
|
|
1868
|
+
from concurrent.futures import ThreadPoolExecutor
|
|
1869
|
+
|
|
1870
|
+
caps: dict[int, int] = {}
|
|
1871
|
+
while True:
|
|
1872
|
+
order = _weighted_schedule(self._weights, n, caps)
|
|
1873
|
+
counts = Counter(order)
|
|
1874
|
+
with ThreadPoolExecutor(
|
|
1875
|
+
max_workers=max(1, min(_CORPUS_READ_THREADS, len(counts))),
|
|
1876
|
+
thread_name_prefix="drowse-lens-corpus",
|
|
1877
|
+
) as pool:
|
|
1878
|
+
docs = dict(zip(counts, pool.map(
|
|
1879
|
+
lambda item: self._streams[item[0]].prefix(item[1]),
|
|
1880
|
+
counts.items(),
|
|
1881
|
+
)))
|
|
1882
|
+
short = {k: len(docs[k]) for k, c in counts.items() if len(docs[k]) < c}
|
|
1883
|
+
if not short:
|
|
1884
|
+
break
|
|
1885
|
+
caps.update(short)
|
|
1886
|
+
taken = Counter[int]()
|
|
1887
|
+
merged: list[str] = []
|
|
1888
|
+
for k in order:
|
|
1889
|
+
merged.append(docs[k][taken[k]])
|
|
1890
|
+
taken[k] += 1
|
|
1891
|
+
return merged
|
|
1892
|
+
|
|
1893
|
+
|
|
1894
|
+
def _weighted_schedule(
|
|
1895
|
+
weights: Sequence[int], n: int, caps: Mapping[int, int],
|
|
1896
|
+
) -> list[int]:
|
|
1897
|
+
"""The stream index of each of the first ``n`` merged documents.
|
|
1898
|
+
|
|
1899
|
+
Smooth weighted round-robin: each pick credits every live stream with its
|
|
1900
|
+
weight, takes the stream with the most credit (the earlier on a tie), and
|
|
1901
|
+
charges it the live total. A stream that has given ``caps[k]`` documents
|
|
1902
|
+
is dry: it leaves the schedule and the pick is retaken among the rest.
|
|
1903
|
+
"""
|
|
1904
|
+
credit = [0] * len(weights)
|
|
1905
|
+
taken = [0] * len(weights)
|
|
1906
|
+
live = list(range(len(weights)))
|
|
1907
|
+
order: list[int] = []
|
|
1908
|
+
while len(order) < n and live:
|
|
1909
|
+
for k in live:
|
|
1910
|
+
credit[k] += weights[k]
|
|
1911
|
+
while live:
|
|
1912
|
+
best = max(live, key=lambda k: (credit[k], -k))
|
|
1913
|
+
if best in caps and taken[best] >= caps[best]:
|
|
1914
|
+
live.remove(best)
|
|
1915
|
+
continue
|
|
1916
|
+
credit[best] -= sum(weights[k] for k in live)
|
|
1917
|
+
taken[best] += 1
|
|
1918
|
+
order.append(best)
|
|
1919
|
+
break
|
|
1920
|
+
return order
|
|
1921
|
+
|
|
1922
|
+
|
|
1923
|
+
def _read_lens_documents(
|
|
1924
|
+
rows: Iterable[Mapping[str, Any]], n: int, text_field: str = "text",
|
|
1925
|
+
) -> list[str]:
|
|
1926
|
+
"""The first ``n`` non-empty ``text_field`` values of ``rows``.
|
|
1927
|
+
|
|
1928
|
+
Each is stripped and sliced to :data:`LENS_DOC_CHARS`; empty, blank, and
|
|
1929
|
+
null values are skipped and do not count toward ``n``.
|
|
1930
|
+
"""
|
|
1931
|
+
from drowse.core.jlens import JacobianLensError
|
|
1932
|
+
|
|
1933
|
+
docs: list[str] = []
|
|
1934
|
+
for row in rows:
|
|
1935
|
+
if text_field not in row:
|
|
1936
|
+
raise JacobianLensError(
|
|
1937
|
+
f"corpus rows have no {text_field!r} field "
|
|
1938
|
+
f"(fields: {', '.join(map(str, row))})"
|
|
1939
|
+
)
|
|
1940
|
+
value = row[text_field]
|
|
1941
|
+
if value is None:
|
|
1942
|
+
continue
|
|
1943
|
+
if not isinstance(value, str):
|
|
1944
|
+
raise JacobianLensError(
|
|
1945
|
+
f"corpus field {text_field!r} holds "
|
|
1946
|
+
f"{type(value).__name__}, not text"
|
|
1947
|
+
)
|
|
1948
|
+
text = value.strip()
|
|
1949
|
+
if text:
|
|
1950
|
+
docs.append(text[:LENS_DOC_CHARS])
|
|
1951
|
+
if len(docs) >= n:
|
|
1952
|
+
break
|
|
1953
|
+
return docs
|
|
1954
|
+
|
|
1955
|
+
|
|
1956
|
+
def _lens_corpus_process(n: int, corpus: LensCorpus, sender: Any) -> None:
|
|
1957
|
+
"""Spawn target that transports only JSON/pickle-safe result payloads."""
|
|
1958
|
+
from drowse.core.jlens import JacobianLensError
|
|
1959
|
+
|
|
1960
|
+
try:
|
|
1961
|
+
payload: tuple[str, object] = ("ok", _collect_lens_corpus(n, corpus))
|
|
1962
|
+
except JacobianLensError as exc:
|
|
1963
|
+
payload = ("typed_error", str(exc))
|
|
1964
|
+
except BaseException as exc: # noqa: BLE001 — preserve worker liveness
|
|
1965
|
+
log.exception("lens corpus worker failed")
|
|
1966
|
+
payload = ("error", type(exc).__name__)
|
|
1967
|
+
try:
|
|
1968
|
+
sender.send(payload)
|
|
1969
|
+
except (BrokenPipeError, EOFError, OSError):
|
|
1970
|
+
# Parent cancellation closes the receive end before terminating us.
|
|
1971
|
+
# Do not turn that expected race into a second worker traceback.
|
|
1972
|
+
pass
|
|
1973
|
+
finally:
|
|
1974
|
+
sender.close()
|
|
1975
|
+
|
|
1976
|
+
|
|
1977
|
+
def _start_lens_corpus_process(
|
|
1978
|
+
n: int, corpus: LensCorpus,
|
|
1979
|
+
) -> tuple[Any, Any]:
|
|
1980
|
+
"""Start a spawn-only provider process, safe beside initialized MPS."""
|
|
1981
|
+
import multiprocessing
|
|
1982
|
+
|
|
1983
|
+
context = multiprocessing.get_context("spawn")
|
|
1984
|
+
receiver, sender = context.Pipe(duplex=False)
|
|
1985
|
+
process = context.Process(
|
|
1986
|
+
target=_lens_corpus_process,
|
|
1987
|
+
args=(n, corpus, sender),
|
|
1988
|
+
name="drowse-jlens-corpus",
|
|
1989
|
+
)
|
|
1990
|
+
process.start()
|
|
1991
|
+
sender.close()
|
|
1992
|
+
return process, receiver
|