perfspec-learning/html/model_perfspec.html

83 lines
374 KiB
HTML
Raw Permalink Normal View History

2025-01-28 14:18:51 +00:00
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" crossorigin="anonymous" href="https://cdn.jsdelivr.net/npm/@marimo-team/frontend@0.10.17/dist/favicon.ico" />
<!-- Preload is necessary because we show these images when we disconnect from the server,
but at that point we cannot load these images from the server -->
<link rel="preload" crossorigin="anonymous" href="https://cdn.jsdelivr.net/npm/@marimo-team/frontend@0.10.17/dist/assets/gradient-yHQUC_QB.png" as="image" />
<link rel="preload" crossorigin="anonymous" href="https://cdn.jsdelivr.net/npm/@marimo-team/frontend@0.10.17/dist/assets/noise-60BoTA8O.png" as="image" />
<!-- Preload the fonts -->
<link rel="preload" crossorigin="anonymous" href="https://cdn.jsdelivr.net/npm/@marimo-team/frontend@0.10.17/dist/assets/Lora-VariableFont_wght-B2ootaw-.ttf" as="font" crossorigin="anonymous" />
<link rel="preload" crossorigin="anonymous" href="https://cdn.jsdelivr.net/npm/@marimo-team/frontend@0.10.17/dist/assets/PTSans-Regular-CxL0S8W7.ttf" as="font" crossorigin="anonymous" />
<link rel="preload" crossorigin="anonymous" href="https://cdn.jsdelivr.net/npm/@marimo-team/frontend@0.10.17/dist/assets/PTSans-Bold-D9fedIX3.ttf" as="font" crossorigin="anonymous" />
<link rel="preload" crossorigin="anonymous" href="https://cdn.jsdelivr.net/npm/@marimo-team/frontend@0.10.17/dist/assets/FiraMono-Regular-BTCkDNvf.ttf" as="font" crossorigin="anonymous" />
<link rel="preload" crossorigin="anonymous" href="https://cdn.jsdelivr.net/npm/@marimo-team/frontend@0.10.17/dist/assets/FiraMono-Medium-DU3aDxX5.ttf" as="font" crossorigin="anonymous" />
<link rel="preload" crossorigin="anonymous" href="https://cdn.jsdelivr.net/npm/@marimo-team/frontend@0.10.17/dist/assets/FiraMono-Bold-CLVRCuM9.ttf" as="font" crossorigin="anonymous" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta name="description" content="a marimo app" />
<link rel="apple-touch-icon" crossorigin="anonymous" href="https://cdn.jsdelivr.net/npm/@marimo-team/frontend@0.10.17/dist/apple-touch-icon.png" />
<link rel="manifest" crossorigin="anonymous" href="https://cdn.jsdelivr.net/npm/@marimo-team/frontend@0.10.17/dist/manifest.json" />
<script data-marimo="true">
function __resizeIframe(obj) {
var scrollbarHeight = 20; // Max between windows, mac, and linux
function setHeight() {
var element = obj.contentWindow.document.documentElement;
// If there is no vertical scrollbar, we don't need to resize the iframe
if (element.scrollHeight === element.clientHeight) {
return;
}
// Create a new height that includes the scrollbar height if it's visible
var hasHorizontalScrollbar = element.scrollWidth > element.clientWidth;
var newHeight = element.scrollHeight + (hasHorizontalScrollbar ? scrollbarHeight : 0);
// Only update the height if it's different from the current height
if (obj.style.height !== `${newHeight}px`) {
obj.style.height = `${newHeight}px`;
}
}
// Resize the iframe to the height of the content and bottom scrollbar height
setHeight();
// Resize the iframe when the content changes
const resizeObserver = new ResizeObserver((entries) => {
setHeight();
});
resizeObserver.observe(obj.contentWindow.document.body);
}
</script>
<marimo-filename hidden>model_perfspec.py</marimo-filename>
<marimo-mode data-mode='read' hidden></marimo-mode>
<marimo-version data-version='0.10.17' hidden></marimo-version>
<marimo-user-config data-config='{"completion": {"activate_on_typing": true, "copilot": false}, "display": {"cell_output": "above", "code_editor_font_size": 14, "dataframes": "rich", "default_width": "medium", "theme": "light"}, "formatting": {"line_length": 79}, "keymap": {"overrides": {}, "preset": "default"}, "package_management": {"manager": "pip"}, "runtime": {"auto_instantiate": true, "auto_reload": "off", "on_cell_change": "autorun"}, "save": {"autosave": "after_delay", "autosave_delay": 1000, "format_on_save": false}, "server": {"browser": "default", "follow_symlink": false}, "snippets": {"custom_paths": [], "include_default_snippets": true}}' data-overrides='{}' hidden></marimo-user-config>
<marimo-app-config data-config='{"width": "medium"}' hidden></marimo-app-config>
<marimo-server-token data-token='static' hidden></marimo-server-token>
<title>model perfspec</title>
<script type="module" crossorigin crossorigin="anonymous" src="https://cdn.jsdelivr.net/npm/@marimo-team/frontend@0.10.17/dist/assets/index-UhR0gcZS.js"></script>
<link rel="stylesheet" crossorigin crossorigin="anonymous" href="https://cdn.jsdelivr.net/npm/@marimo-team/frontend@0.10.17/dist/assets/index-CRGfAcwh.css">
<script data-marimo="true">
window.__MARIMO_STATIC__ = {};
window.__MARIMO_STATIC__.version = "0.10.17";
window.__MARIMO_STATIC__.notebookState = {"cellIds": ["Hbol", "MJUe", "vblA", "bkHC", "lEQa", "PKri", "Xref", "SFPL", "BYtC", "RGSE", "Kclp", "emfo", "Hstk", "nWHF", "iLit", "ZHCJ", "ROlb", "qnkX", "TqIu", "Vxnm"], "cellNames": ["dGl0bGU=", "aW1wb3J0cw==", "aW50cm9fbG9hZA==", "cGVyZnNwZWNfcmVuZGVyX21vZGVsX2Jyb3dzZXI=", "Xw==", "c2V0dGluZ3M=", "Y29tbWFuZF9saW5lX29wdGlvbnM=", "bG9hZF90cmFpbmRlZF9tb2RlbA==", "bW9kZWxfc3VtbWFyeQ==", "ZXZhbHVhdGVfbW9kZQ==", "aGlzdG9yeV9pbmZv", "bW9kZWxfcGxvdF9hY2N1cmFjeQ==", "bW9kZWxfcGxvdF9sb3Nz", "bW9kZWxfcGxvdF9wcmVjaXNpb24=", "Y29uZnVzaW9uX21hdHJpeA==", "Xw==", "dGl0bGVfc2hvd192YWx1ZXNfcHJlZGljdGlvbg==", "c2hvd192YWx1ZXNfcHJlZGljdGlvbg==", "dGl0bGVfcnVuX3ByZWRpY3Rpb24=", "Xw=="], "cellCodes": ["aW1wb3J0JTIwbWFyaW1vJTIwYXMlMjBtbyUwQW5vdGVib29rX25hbWUlMjAlM0QlMjAnbW9kZWxfcGVyZnNwZWMucHknJTBBJTBBZnJvbSUyMGxpYl9wZXJmc3BlYyUyMGltcG9ydCUyMHBlcmZzcGVjX3ZhcnMlMEEoXyUyQ19kZWZzKSUyMCUzRCUyMHBlcmZzcG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.__MARIMO_STATIC__.assetUrl = "https://cdn.jsdelivr.net/npm/@marimo-team/frontend@0.10.17/dist";
window.__MARIMO_STATIC__.files = {};
</script>
</head>
<body>
<div id="root"></div>
<marimo-code hidden="">
import%20marimo%0A%0A__generated_with%20%3D%20%220.10.17%22%0Aapp%20%3D%20marimo.App(width%3D%22medium%22)%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20title()%3A%0A%20%20%20%20import%20marimo%20as%20mo%0A%20%20%20%20notebook_name%20%3D%20'model_perfspec.py'%0A%0A%20%20%20%20from%20lib_perfspec%20import%20perfspec_vars%0A%20%20%20%20(_%2C_defs)%20%3D%20perfspec_vars.run()%0A%20%20%20%20perfspec%20%3D%20_defs%5B'perfspec'%5D%0A%0A%20%20%20%20from%20lib_perfspec%20import%20perfspec_header%0A%20%20%20%20(_%2C_defs)%20%3D%20perfspec_header.run()%0A%20%20%20%20lib_header%20%3D%20_defs%5B'header'%5D%0A%20%20%20%20lib_intro%20%3D%20_defs%5B'intro'%5D%0A%0A%20%20%20%20mo.md(%0A%20%20%20%20%20%20%20%20f%22%22%22%0A%20%20%20%20%20%20%20%20%7Blib_header(notebook_name)%7D%0A%0A%20%20%20%20%20%20%20%20%23%23%20Info%20about%20**%7Bperfspec%5B'app'%5D%5B'train_mode'%5D%7D**%20trained%20model%0A%20%20%20%20%20%20%20%20%22%22%22%0A%20%20%20%20)%0A%20%20%20%20return%20(%0A%20%20%20%20%20%20%20%20lib_header%2C%0A%20%20%20%20%20%20%20%20lib_intro%2C%0A%20%20%20%20%20%20%20%20mo%2C%0A%20%20%20%20%20%20%20%20notebook_name%2C%0A%20%20%20%20%20%20%20%20perfspec%2C%0A%20%20%20%20%20%20%20%20perfspec_header%2C%0A%20%20%20%20%20%20%20%20perfspec_vars%2C%0A%20%20%20%20)%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20imports()%3A%0A%20%20%20%20from%20pathlib%20import%20Path%0A%20%20%20%20import%20numpy%20as%20np%0A%20%20%20%20return%20Path%2C%20np%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20intro_load(Path%2C%20lib_intro%2C%20mo%2C%20notebook_name%2C%20perfspec)%3A%0A%20%20%20%20verbose%20%3D%20perfspec%5B'settings'%5D%5B'verbose'%5D%0A%20%20%20%20perfspec%5B'vars'%5D%20%3D%20%7B%7D%0A%0A%20%20%20%20from%20lib_perfspec%20import%20perfspec_args%0A%20%20%20%20(_%2C_defs)%20%3D%20perfspec_args.run()%0A%0A%20%20%20%20if%20not%20Path(perfspec%5B'defaults'%5D%5B'models_dirpath'%5D).exists()%3A%20%0A%20%20%20%20%20%20%20exit(f%22Trained%20models%20dir%20path%20not%20found%3A%20%7Bperfspec%5B'defaults'%5D%5B'models_dirpath'%5D%7D%22)%20%20%0A%0A%20%20%20%20if%20not%20Path(perfspec%5B'defaults'%5D%5B'checkpoints_dirpath'%5D).exists()%3A%20%0A%20%20%20%20%20%20%20exit(f%22Trained%20checkpoints%20models%20dir%20path%20not%20found%3A%20%7Bperfspec%5B'defaults'%5D%5B'checkpoints_dirpath'%5D%7D%22)%20%20%0A%0A%20%20%20%20if%20not%20Path(perfspec%5B'defaults'%5D%5B'data_dirpath'%5D).exists()%3A%20%0A%20%20%20%20%20%20%20exit(f%22data%20dir%20path%20not%20found%3A%20%7Bperfspec%5B'defaults'%5D%5B'data_dirpath'%5D%7D%22)%20%20%0A%0A%20%20%20%20verbose%3Dperfspec%5B'settings'%5D.get('verbose')%0A%0A%20%20%20%20from%20lib_perfspec%20import%20perfspec_load_actions%0A%20%20%20%20(_%2C_defs)%20%3D%20perfspec_load_actions.run()%0A%20%20%20%20lib_load_actions%20%3D%20_defs%5B'load_actions'%5D%0A%0A%20%20%20%20from%20lib_perfspec%20import%20perfspec_input_sequence%0A%20%20%20%20(_%2C_defs)%20%3D%20perfspec_input_sequence.run()%0A%20%20%20%20lib_get_input_sequence%20%3D%20_defs%5B'get_input_sequence'%5D%0A%0A%20%20%20%20from%20lib_perfspec%20import%20perfspec_predict%0A%20%20%20%20_%2C%20_defs%20%3D%20perfspec_predict.run()%0A%20%20%20%20lib_predict_action%20%3D%20_defs%5B'predict_action'%5D%0A%0A%20%20%20%20perfspec%5B'vars'%5D%5B'model'%5D%20%3D%20None%0A%20%20%20%20perfspec%5B'vars'%5D%5B'history'%5D%20%3D%20None%0A%0A%20%20%20%20(perfspec%5B'vars'%5D%5B'actions'%5D%2C%20%0A%20%20%20%20perfspec%5B'vars'%5D%5B'unique_actions'%5D%2C%20%0A%20%20%20%20perfspec%5B'vars'%5D%5B'label_encoder'%5D%2C%20%0A%20%20%20%20perfspec%5B'vars'%5D%5B'encoded_actions'%5D%0A%20%20%20%20)%20%3D%20lib_load_actions(%0A%20%20%20%20%20%20%20%20actions_path%3Dperfspec%5B'settings'%5D.get('actions_filepath')%2C%0A%20%20%20%20%20%20%20%20verbose%3DNone%0A%20%20%20%20)%0A%0A%20%20%20%20perfspec%5B'vars'%5D%5B'input_sequence'%5D%20%3D%20lib_get_input_sequence(%0A%20%20%20%20%20%20%20%20input_str%3Dperfspec%5B'settings'%5D%5B'input_str'%5D%2C%20%0A%20%20%20%20%20%20%20%20unique_actions%3Dperfspec%5B'vars'%5D%5B'unique_actions'%5D%0A%20%20%20%20)%0A%0A%20%20%20%20from%20train_perfspec%20import%20p
</marimo-code>
<marimo-code-hash hidden="">c5d7c6b886c0bb6929370c9fe5ecc731059b28f4be29c11f8be7581ebf225a63</marimo-code-hash>
</body>
</html>