From faff84dd4cd0c0d7c06a96676b76d1d884795f04 Mon Sep 17 00:00:00 2001 From: "Ishan S. Patel" Date: Fri, 11 Jul 2025 16:30:54 -0400 Subject: [PATCH] YACWC --- ' | 1361 ++++++++++++++++++++++ __pycache__/model_runner.cpython-310.pyc | Bin 0 -> 8331 bytes js.json | 736 ++++++++++++ ml_run.py | 338 +----- model_runner.py | 310 +++++ 5 files changed, 2413 insertions(+), 332 deletions(-) create mode 100644 ' create mode 100644 __pycache__/model_runner.cpython-310.pyc create mode 100644 js.json create mode 100644 model_runner.py diff --git a/' b/' new file mode 100644 index 0000000..fe5a8af --- /dev/null +++ b/' @@ -0,0 +1,1361 @@ +# Configuration file for ipython. + +c = get_config() #noqa +import os +if len(os.getenv("DISPLAY",'')) == 0: + os.putenv("DISPLAY","192.168.1.1:0") + + +buse = 'qt6jdwq' +c.InteractiveShellApp.exec_lines = ['%load_ext autoreload','%autoreload 2'] +c.InteractiveShellApp.gui = buse +c.InteractiveShellApp.matplotlib = buse +c.InteractiveShellApp.pylab = buse +c.TerminalIPythonApp.gui = buse + + + + +#------------------------------------------------------------------------------ +# InteractiveShellApp(Configurable) configuration +#------------------------------------------------------------------------------ +## A Mixin for applications that start InteractiveShell instances. +# +# Provides configurables for loading extensions and executing files +# as part of configuring a Shell environment. +# +# The following methods should be called by the :meth:`initialize` method +# of the subclass: +# +# - :meth:`init_path` +# - :meth:`init_shell` (to be implemented by the subclass) +# - :meth:`init_gui_pylab` +# - :meth:`init_extensions` +# - :meth:`init_code` + +## Execute the given command string. +# Default: '' +# c.InteractiveShellApp.code_to_run = '' + +## Run the file referenced by the PYTHONSTARTUP environment +# variable at IPython startup. +# Default: True +# c.InteractiveShellApp.exec_PYTHONSTARTUP = True + +## List of files to run at IPython startup. +# Default: [] +# c.InteractiveShellApp.exec_files = [] + +## lines of code to run at IPython startup. +# Default: [] +# c.InteractiveShellApp.exec_lines = [] + +## A list of dotted module names of IPython extensions to load. +# Default: [] +# c.InteractiveShellApp.extensions = [] + +## Dotted module name(s) of one or more IPython extensions to load. +# +# For specifying extra extensions to load on the command-line. +# +# .. versionadded:: 7.10 +# Default: [] +# c.InteractiveShellApp.extra_extensions = [] + +## A file to be run +# Default: '' +# c.InteractiveShellApp.file_to_run = '' + +## Enable GUI event loop integration with any of ('asyncio', 'glut', 'gtk', +# 'gtk2', 'gtk3', 'gtk4', 'osx', 'pyglet', 'qt', 'qt5', 'qt6', 'tk', 'wx', +# 'gtk2', 'qt4'). +# Choices: any of ['asyncio', 'glut', 'gtk', 'gtk2', 'gtk3', 'gtk4', 'osx', 'pyglet', 'qt', 'qt5', 'qt6', 'tk', 'wx', 'gtk2', 'qt4'] (case-insensitive) or None +# Default: None +# c.InteractiveShellApp.gui = None + +## Should variables loaded at startup (by startup files, exec_lines, etc.) +# be hidden from tools like %who? +# Default: True +# c.InteractiveShellApp.hide_initial_ns = True + +## If True, IPython will not add the current working directory to sys.path. +# When False, the current working directory is added to sys.path, allowing imports +# of modules defined in the current directory. +# Default: False +# c.InteractiveShellApp.ignore_cwd = False + +## Configure matplotlib for interactive use with +# the default matplotlib backend. The exact options available +# depend on what Matplotlib provides at runtime. +# Choices: any of ['agg', 'auto', 'gtk', 'gtk3', 'gtk4', 'inline', 'ipympl', 'nbagg', 'notebook', 'osx', 'pdf', 'ps', 'qt', 'qt4', 'qt5', 'qt6', 'svg', 'tk', 'webagg', 'widget', 'wx'] (case-insensitive) or None +# Default: None +# c.InteractiveShellApp.matplotlib = None + +## Run the module as a script. +# Default: '' +# c.InteractiveShellApp.module_to_run = '' + +## Pre-load matplotlib and numpy for interactive use, +# selecting a particular matplotlib backend and loop integration. +# The exact options available depend on what Matplotlib provides at runtime. +# Choices: any of ['agg', 'auto', 'gtk', 'gtk3', 'gtk4', 'inline', 'ipympl', 'nbagg', 'notebook', 'osx', 'pdf', 'ps', 'qt', 'qt4', 'qt5', 'qt6', 'svg', 'tk', 'webagg', 'widget', 'wx'] (case-insensitive) or None +# Default: None +# c.InteractiveShellApp.pylab = None + +## If true, IPython will populate the user namespace with numpy, pylab, etc. +# and an ``import *`` is done from numpy and pylab, when using pylab mode. +# +# When False, pylab mode should not import any names into the user +# namespace. +# Default: True +# c.InteractiveShellApp.pylab_import_all = True + +## Reraise exceptions encountered loading IPython extensions? +# Default: False +# c.InteractiveShellApp.reraise_ipython_extension_failures = False + +#------------------------------------------------------------------------------ +# Application(SingletonConfigurable) configuration +#------------------------------------------------------------------------------ +## This is an application. + +## The date format used by logging formatters for %(asctime)s +# Default: '%Y-%m-%d %H:%M:%S' +# c.Application.log_datefmt = '%Y-%m-%d %H:%M:%S' + +## The Logging format template +# Default: '[%(name)s]%(highlevel)s %(message)s' +# c.Application.log_format = '[%(name)s]%(highlevel)s %(message)s' + +## Set the log level by value or name. +# Choices: any of [0, 10, 20, 30, 40, 50, 'DEBUG', 'INFO', 'WARN', 'ERROR', 'CRITICAL'] +# Default: 30 +# c.Application.log_level = 30 + +## Configure additional log handlers. +# +# The default stderr logs handler is configured by the log_level, log_datefmt +# and log_format settings. +# +# This configuration can be used to configure additional handlers (e.g. to +# output the log to a file) or for finer control over the default handlers. +# +# If provided this should be a logging configuration dictionary, for more +# information see: +# https://docs.python.org/3/library/logging.config.html#logging-config- +# dictschema +# +# This dictionary is merged with the base logging configuration which defines +# the following: +# +# * A logging formatter intended for interactive use called +# ``console``. +# * A logging handler that writes to stderr called +# ``console`` which uses the formatter ``console``. +# * A logger with the name of this application set to ``DEBUG`` +# level. +# +# This example adds a new handler that writes to a file: +# +# .. code-block:: python +# +# c.Application.logging_config = { +# "handlers": { +# "file": { +# "class": "logging.FileHandler", +# "level": "DEBUG", +# "filename": "", +# } +# }, +# "loggers": { +# "": { +# "level": "DEBUG", +# # NOTE: if you don't list the default "console" +# # handler here then it will be disabled +# "handlers": ["console", "file"], +# }, +# }, +# } +# Default: {} +# c.Application.logging_config = {} + +## Instead of starting the Application, dump configuration to stdout +# Default: False +# c.Application.show_config = False + +## Instead of starting the Application, dump configuration to stdout (as JSON) +# Default: False +# c.Application.show_config_json = False + +#------------------------------------------------------------------------------ +# BaseIPythonApplication(Application) configuration +#------------------------------------------------------------------------------ +# Default: False +# c.BaseIPythonApplication.add_ipython_dir_to_sys_path = False + +## Whether to create profile dir if it doesn't exist +# Default: False +# c.BaseIPythonApplication.auto_create = False + +## Whether to install the default config files into the profile dir. +# If a new profile is being created, and IPython contains config files for that +# profile, then they will be staged into the new directory. Otherwise, +# default config files will be automatically generated. +# Default: False +# c.BaseIPythonApplication.copy_config_files = False + +## Path to an extra config file to load. +# +# If specified, load this config file in addition to any other IPython +# config. +# Default: '' +# c.BaseIPythonApplication.extra_config_file = '' + +## The name of the IPython directory. This directory is used for logging +# configuration (through profiles), history storage, etc. The default is usually +# $HOME/.ipython. This option can also be specified through the environment +# variable IPYTHONDIR. +# Default: '' +# c.BaseIPythonApplication.ipython_dir = '' + +## The date format used by logging formatters for %(asctime)s +# See also: Application.log_datefmt +# c.BaseIPythonApplication.log_datefmt = '%Y-%m-%d %H:%M:%S' + +## The Logging format template +# See also: Application.log_format +# c.BaseIPythonApplication.log_format = '[%(name)s]%(highlevel)s %(message)s' + +## Set the log level by value or name. +# See also: Application.log_level +# c.BaseIPythonApplication.log_level = 30 + +## +# See also: Application.logging_config +# c.BaseIPythonApplication.logging_config = {} + +## Whether to overwrite existing config files when copying +# Default: False +# c.BaseIPythonApplication.overwrite = False + +## The IPython profile to use. +# Default: 'default' +# c.BaseIPythonApplication.profile = 'default' + +## Instead of starting the Application, dump configuration to stdout +# See also: Application.show_config +# c.BaseIPythonApplication.show_config = False + +## Instead of starting the Application, dump configuration to stdout (as JSON) +# See also: Application.show_config_json +# c.BaseIPythonApplication.show_config_json = False + +## Create a massive crash report when IPython encounters what may be an +# internal error. The default is to append a short message to the +# usual traceback +# Default: False +# c.BaseIPythonApplication.verbose_crash = False + +#------------------------------------------------------------------------------ +# TerminalIPythonApp(BaseIPythonApplication, InteractiveShellApp) configuration +#------------------------------------------------------------------------------ +# See also: BaseIPythonApplication.add_ipython_dir_to_sys_path +# c.TerminalIPythonApp.add_ipython_dir_to_sys_path = False + +# Default: True +# c.TerminalIPythonApp.auto_create = True + +## Execute the given command string. +# See also: InteractiveShellApp.code_to_run +# c.TerminalIPythonApp.code_to_run = '' + +## Whether to install the default config files into the profile dir. +# See also: BaseIPythonApplication.copy_config_files +# c.TerminalIPythonApp.copy_config_files = False + +## Whether to display a banner upon starting IPython. +# Default: True +# c.TerminalIPythonApp.display_banner = True + +## Run the file referenced by the PYTHONSTARTUP environment +# See also: InteractiveShellApp.exec_PYTHONSTARTUP +# c.TerminalIPythonApp.exec_PYTHONSTARTUP = True + +## List of files to run at IPython startup. +# See also: InteractiveShellApp.exec_files +# c.TerminalIPythonApp.exec_files = [] + +## lines of code to run at IPython startup. +# See also: InteractiveShellApp.exec_lines +# c.TerminalIPythonApp.exec_lines = [] + +## A list of dotted module names of IPython extensions to load. +# See also: InteractiveShellApp.extensions +# c.TerminalIPythonApp.extensions = [] + +## Path to an extra config file to load. +# See also: BaseIPythonApplication.extra_config_file +# c.TerminalIPythonApp.extra_config_file = '' + +## +# See also: InteractiveShellApp.extra_extensions +# c.TerminalIPythonApp.extra_extensions = [] + +## A file to be run +# See also: InteractiveShellApp.file_to_run +# c.TerminalIPythonApp.file_to_run = '' + +## If a command or file is given via the command-line, +# e.g. 'ipython foo.py', start an interactive shell after executing the +# file or command. +# Default: False +# c.TerminalIPythonApp.force_interact = False + +## Enable GUI event loop integration with any of ('asyncio', 'glut', 'gtk', +# 'gtk2', 'gtk3', 'gtk4', 'osx', 'pyglet', 'qt', 'qt5', 'qt6', 'tk', 'wx', +# 'gtk2', 'qt4'). +# See also: InteractiveShellApp.gui +# c.TerminalIPythonApp.gui = None + +## Should variables loaded at startup (by startup files, exec_lines, etc.) +# See also: InteractiveShellApp.hide_initial_ns +# c.TerminalIPythonApp.hide_initial_ns = True + +## If True, IPython will not add the current working directory to sys.path. +# See also: InteractiveShellApp.ignore_cwd +# c.TerminalIPythonApp.ignore_cwd = False + +## Class to use to instantiate the TerminalInteractiveShell object. Useful for +# custom Frontends +# Default: 'IPython.terminal.interactiveshell.TerminalInteractiveShell' +# c.TerminalIPythonApp.interactive_shell_class = 'IPython.terminal.interactiveshell.TerminalInteractiveShell' + +## +# See also: BaseIPythonApplication.ipython_dir +# c.TerminalIPythonApp.ipython_dir = '' + +## The date format used by logging formatters for %(asctime)s +# See also: Application.log_datefmt +# c.TerminalIPythonApp.log_datefmt = '%Y-%m-%d %H:%M:%S' + +## The Logging format template +# See also: Application.log_format +# c.TerminalIPythonApp.log_format = '[%(name)s]%(highlevel)s %(message)s' + +## Set the log level by value or name. +# See also: Application.log_level +# c.TerminalIPythonApp.log_level = 30 + +## +# See also: Application.logging_config +# c.TerminalIPythonApp.logging_config = {} + +## Configure matplotlib for interactive use with +# See also: InteractiveShellApp.matplotlib +# c.TerminalIPythonApp.matplotlib = None + +## Run the module as a script. +# See also: InteractiveShellApp.module_to_run +# c.TerminalIPythonApp.module_to_run = '' + +## Whether to overwrite existing config files when copying +# See also: BaseIPythonApplication.overwrite +# c.TerminalIPythonApp.overwrite = False + +## The IPython profile to use. +# See also: BaseIPythonApplication.profile +# c.TerminalIPythonApp.profile = 'default' + +## Pre-load matplotlib and numpy for interactive use, +# See also: InteractiveShellApp.pylab +# c.TerminalIPythonApp.pylab = None + +## If true, IPython will populate the user namespace with numpy, pylab, etc. +# See also: InteractiveShellApp.pylab_import_all +# c.TerminalIPythonApp.pylab_import_all = True + +## Start IPython quickly by skipping the loading of config files. +# Default: False +# c.TerminalIPythonApp.quick = False + +## Reraise exceptions encountered loading IPython extensions? +# See also: InteractiveShellApp.reraise_ipython_extension_failures +# c.TerminalIPythonApp.reraise_ipython_extension_failures = False + +## Instead of starting the Application, dump configuration to stdout +# See also: Application.show_config +# c.TerminalIPythonApp.show_config = False + +## Instead of starting the Application, dump configuration to stdout (as JSON) +# See also: Application.show_config_json +# c.TerminalIPythonApp.show_config_json = False + +## Create a massive crash report when IPython encounters what may be an +# See also: BaseIPythonApplication.verbose_crash +# c.TerminalIPythonApp.verbose_crash = False + +#------------------------------------------------------------------------------ +# InteractiveShell(SingletonConfigurable) configuration +#------------------------------------------------------------------------------ +## An enhanced, interactive shell for Python. + +## 'all', 'last', 'last_expr' or 'none', 'last_expr_or_assign' specifying which +# nodes should be run interactively (displaying output from expressions). +# Choices: any of ['all', 'last', 'last_expr', 'none', 'last_expr_or_assign'] +# Default: 'last_expr' +# c.InteractiveShell.ast_node_interactivity = 'last_expr' + +## A list of ast.NodeTransformer subclass instances, which will be applied to +# user input before code is run. +# Default: [] +# c.InteractiveShell.ast_transformers = [] + +## Automatically run await statement in the top level repl. +# Default: True +# c.InteractiveShell.autoawait = True + +## Make IPython automatically call any callable object even if you didn't type +# explicit parentheses. For example, 'str 43' becomes 'str(43)' automatically. +# The value can be '0' to disable the feature, '1' for 'smart' autocall, where +# it is not applied if there are no more arguments on the line, and '2' for +# 'full' autocall, where all callable objects are automatically called (even if +# no arguments are present). +# Choices: any of [0, 1, 2] +# Default: 0 +# c.InteractiveShell.autocall = 0 + +## Autoindent IPython code entered interactively. +# Default: True +# c.InteractiveShell.autoindent = True + +## Enable magic commands to be called without the leading %. +# Default: True +# c.InteractiveShell.automagic = True + +## The part of the banner to be printed before the profile +# Default: "Python 3.10.12 (main, Jan 17 2025, 14:35:34) [GCC 11.4.0]\nType 'copyright', 'credits' or 'license' for more information\nIPython 8.32.0 -- An enhanced Interactive Python. Type '?' for help.\n" +# c.InteractiveShell.banner1 = "Python 3.10.12 (main, Jan 17 2025, 14:35:34) [GCC 11.4.0]\nType 'copyright', 'credits' or 'license' for more information\nIPython 8.32.0 -- An enhanced Interactive Python. Type '?' for help.\n" + +## The part of the banner to be printed after the profile +# Default: '' +# c.InteractiveShell.banner2 = '' + +## Set the size of the output cache. The default is 1000, you can change it +# permanently in your config file. Setting it to 0 completely disables the +# caching system, and the minimum value accepted is 3 (if you provide a value +# less than 3, it is reset to 0 and a warning is issued). This limit is defined +# because otherwise you'll spend more time re-flushing a too small cache than +# working +# Default: 1000 +# c.InteractiveShell.cache_size = 1000 + +## Use colors for displaying information about objects. Because this information +# is passed through a pager (like 'less'), and some pagers get confused with +# color codes, this capability can be turned off. +# Default: True +# c.InteractiveShell.color_info = True + +## Set the color scheme (NoColor, Neutral, Linux, or LightBG). +# Choices: any of ['Neutral', 'NoColor', 'LightBG', 'Linux'] (case-insensitive) +# Default: 'Neutral' +# c.InteractiveShell.colors = 'Neutral' + +# Default: False +# c.InteractiveShell.debug = False + +## Don't call post-execute functions that have failed in the past. +# Default: False +# c.InteractiveShell.disable_failing_post_execute = False + +## If True, anything that would be passed to the pager +# will be displayed as regular output instead. +# Default: False +# c.InteractiveShell.display_page = False + +## (Provisional API) enables html representation in mime bundles sent to pagers. +# Default: False +# c.InteractiveShell.enable_html_pager = False + +## Total length of command history +# Default: 10000 +# c.InteractiveShell.history_length = 10000 + +## The number of saved history entries to be loaded into the history buffer at +# startup. +# Default: 1000 +# c.InteractiveShell.history_load_length = 1000 + +## Class to use to instantiate the shell inspector +# Default: 'IPython.core.oinspect.Inspector' +# c.InteractiveShell.inspector_class = 'IPython.core.oinspect.Inspector' + +# Default: '' +# c.InteractiveShell.ipython_dir = '' + +## Start logging to the given file in append mode. Use `logfile` to specify a log +# file to **overwrite** logs to. +# Default: '' +# c.InteractiveShell.logappend = '' + +## The name of the logfile to use. +# Default: '' +# c.InteractiveShell.logfile = '' + +## Start logging to the default log file in overwrite mode. Use `logappend` to +# specify a log file to **append** logs to. +# Default: False +# c.InteractiveShell.logstart = False + +## Select the loop runner that will be used to execute top-level asynchronous +# code +# Default: 'IPython.core.interactiveshell._asyncio_runner' +# c.InteractiveShell.loop_runner = 'IPython.core.interactiveshell._asyncio_runner' + +# Choices: any of [0, 1, 2] +# Default: 0 +# c.InteractiveShell.object_info_string_level = 0 + +## Automatically call the pdb debugger after every exception. +# Default: False +# c.InteractiveShell.pdb = False + +# Default: False +# c.InteractiveShell.quiet = False + +# Default: '\n' +# c.InteractiveShell.separate_in = '\n' + +# Default: '' +# c.InteractiveShell.separate_out = '' + +# Default: '' +# c.InteractiveShell.separate_out2 = '' + +## Show rewritten input, e.g. for autocall. +# Default: True +# c.InteractiveShell.show_rewritten_input = True + +## Enables rich html representation of docstrings. (This requires the docrepr +# module). +# Default: False +# c.InteractiveShell.sphinxify_docstring = False + +## Warn if running in a virtual environment with no IPython installed (so IPython +# from the global environment is used). +# Default: True +# c.InteractiveShell.warn_venv = True + +# Default: True +# c.InteractiveShell.wildcards_case_sensitive = True + +## Switch modes for the IPython exception handlers. +# Choices: any of ['Context', 'Plain', 'Verbose', 'Minimal'] (case-insensitive) +# Default: 'Context' +# c.InteractiveShell.xmode = 'Context' + +#------------------------------------------------------------------------------ +# TerminalInteractiveShell(InteractiveShell) configuration +#------------------------------------------------------------------------------ +## +# See also: InteractiveShell.ast_node_interactivity +# c.TerminalInteractiveShell.ast_node_interactivity = 'last_expr' + +## +# See also: InteractiveShell.ast_transformers +# c.TerminalInteractiveShell.ast_transformers = [] + +## Automatically add/delete closing bracket or quote when opening bracket or +# quote is entered/deleted. Brackets: (), [], {} Quotes: '', "" +# Default: False +# c.TerminalInteractiveShell.auto_match = False + +## +# See also: InteractiveShell.autoawait +# c.TerminalInteractiveShell.autoawait = True + +## +# See also: InteractiveShell.autocall +# c.TerminalInteractiveShell.autocall = 0 + +## Autoformatter to reformat Terminal code. Can be `'black'`, `'yapf'` or `None` +# Default: None +# c.TerminalInteractiveShell.autoformatter = None + +## +# See also: InteractiveShell.autoindent +# c.TerminalInteractiveShell.autoindent = True + +## +# See also: InteractiveShell.automagic +# c.TerminalInteractiveShell.automagic = True + +## Specifies from which source automatic suggestions are provided. Can be set to +# ``'NavigableAutoSuggestFromHistory'`` (:kbd:`up` and :kbd:`down` swap +# suggestions), ``'AutoSuggestFromHistory'``, or ``None`` to disable automatic +# suggestions. Default is `'NavigableAutoSuggestFromHistory`'. +# Default: 'NavigableAutoSuggestFromHistory' +# c.TerminalInteractiveShell.autosuggestions_provider = 'NavigableAutoSuggestFromHistory' + +## The part of the banner to be printed before the profile +# See also: InteractiveShell.banner1 +# c.TerminalInteractiveShell.banner1 = "Python 3.10.12 (main, Jan 17 2025, 14:35:34) [GCC 11.4.0]\nType 'copyright', 'credits' or 'license' for more information\nIPython 8.32.0 -- An enhanced Interactive Python. Type '?' for help.\n" + +## The part of the banner to be printed after the profile +# See also: InteractiveShell.banner2 +# c.TerminalInteractiveShell.banner2 = '' + +## +# See also: InteractiveShell.cache_size +# c.TerminalInteractiveShell.cache_size = 1000 + +## +# See also: InteractiveShell.color_info +# c.TerminalInteractiveShell.color_info = True + +## Set the color scheme (NoColor, Neutral, Linux, or LightBG). +# See also: InteractiveShell.colors +# c.TerminalInteractiveShell.colors = 'Neutral' + +## Set to confirm when you try to exit IPython with an EOF (Control-D in Unix, +# Control-Z/Enter in Windows). By typing 'exit' or 'quit', you can force a +# direct exit without any confirmation. +# Default: True +# c.TerminalInteractiveShell.confirm_exit = True + +# See also: InteractiveShell.debug +# c.TerminalInteractiveShell.debug = False + +## File in which to store and read history +# Default: '~/.pdbhistory' +# c.TerminalInteractiveShell.debugger_history_file = '~/.pdbhistory' + +## Don't call post-execute functions that have failed in the past. +# See also: InteractiveShell.disable_failing_post_execute +# c.TerminalInteractiveShell.disable_failing_post_execute = False + +## Options for displaying tab completions, 'column', 'multicolumn', and +# 'readlinelike'. These options are for `prompt_toolkit`, see `prompt_toolkit` +# documentation for more information. +# Choices: any of ['column', 'multicolumn', 'readlinelike'] +# Default: 'multicolumn' +# c.TerminalInteractiveShell.display_completions = 'multicolumn' + +## If True, anything that would be passed to the pager +# See also: InteractiveShell.display_page +# c.TerminalInteractiveShell.display_page = False + +## Shortcut style to use at the prompt. 'vi' or 'emacs'. +# Default: 'emacs' +# c.TerminalInteractiveShell.editing_mode = 'emacs' + +## Set the editor used by IPython (default to $EDITOR/vi/notepad). +# Default: 'vi' +# c.TerminalInteractiveShell.editor = 'vi' + +## Add shortcuts from 'emacs' insert mode to 'vi' insert mode. +# Default: True +# c.TerminalInteractiveShell.emacs_bindings_in_vi_insert_mode = True + +## Allows to enable/disable the prompt toolkit history search +# Default: True +# c.TerminalInteractiveShell.enable_history_search = True + +## +# See also: InteractiveShell.enable_html_pager +# c.TerminalInteractiveShell.enable_html_pager = False + +## Enable vi (v) or Emacs (C-X C-E) shortcuts to open an external editor. This is +# in addition to the F2 binding, which is always enabled. +# Default: False +# c.TerminalInteractiveShell.extra_open_editor_shortcuts = False + +## Provide an alternative handler to be called when the user presses Return. This +# is an advanced option intended for debugging, which may be changed or removed +# in later releases. +# Default: None +# c.TerminalInteractiveShell.handle_return = None + +## Highlight matching brackets. +# Default: True +# c.TerminalInteractiveShell.highlight_matching_brackets = True + +## The name or class of a Pygments style to use for syntax +# highlighting. To see available styles, run `pygmentize -L styles`. +# Default: traitlets.Undefined +# c.TerminalInteractiveShell.highlighting_style = traitlets.Undefined + +## Override highlighting format for specific tokens +# Default: {} +# c.TerminalInteractiveShell.highlighting_style_overrides = {} + +## Total length of command history +# See also: InteractiveShell.history_length +# c.TerminalInteractiveShell.history_length = 10000 + +## +# See also: InteractiveShell.history_load_length +# c.TerminalInteractiveShell.history_load_length = 1000 + +## Class to use to instantiate the shell inspector +# See also: InteractiveShell.inspector_class +# c.TerminalInteractiveShell.inspector_class = 'IPython.core.oinspect.Inspector' + +# See also: InteractiveShell.ipython_dir +# c.TerminalInteractiveShell.ipython_dir = '' + +## Provisional: +# This is a provisinal API in IPython 8.32, before stabilisation +# in 9.0, it may change without warnings. +# +# class to use for the `NavigableAutoSuggestFromHistory` to request completions +# from a LLM, this should inherit from `jupyter_ai_magics:BaseProvider` and +# implement `stream_inline_completions` +# Default: None +# c.TerminalInteractiveShell.llm_provider_class = None + +## +# See also: InteractiveShell.logappend +# c.TerminalInteractiveShell.logappend = '' + +## +# See also: InteractiveShell.logfile +# c.TerminalInteractiveShell.logfile = '' + +## +# See also: InteractiveShell.logstart +# c.TerminalInteractiveShell.logstart = False + +## Select the loop runner that will be used to execute top-level asynchronous +# code +# See also: InteractiveShell.loop_runner +# c.TerminalInteractiveShell.loop_runner = 'IPython.core.interactiveshell._asyncio_runner' + +# Default: {} +# c.TerminalInteractiveShell.mime_renderers = {} + +## Cursor shape changes depending on vi mode: beam in vi insert mode, block in +# nav mode, underscore in replace mode. +# Default: True +# c.TerminalInteractiveShell.modal_cursor = True + +## Enable mouse support in the prompt (Note: prevents selecting text with the +# mouse) +# Default: False +# c.TerminalInteractiveShell.mouse_support = False + +# See also: InteractiveShell.object_info_string_level +# c.TerminalInteractiveShell.object_info_string_level = 0 + +## +# See also: InteractiveShell.pdb +# c.TerminalInteractiveShell.pdb = False + +## Display the current vi mode (when using vi editing mode). +# Default: True +# c.TerminalInteractiveShell.prompt_includes_vi_mode = True + +## The format for line numbering, will be passed `line` (int, 1 based) the +# current line number and `rel_line` the relative line number. for example to +# display both you can use the following template string : +# c.TerminalInteractiveShell.prompt_line_number_format='{line: +# 4d}/{rel_line:+03d} | ' This will display the current line number, with +# leading space and a width of at least 4 character, as well as the relative +# line number 0 padded and always with a + or - sign. Note that when using Emacs +# mode the prompt of the first line may not update. +# Default: '' +# c.TerminalInteractiveShell.prompt_line_number_format = '' + +## Class used to generate Prompt token for prompt_toolkit +# Default: 'IPython.terminal.prompts.Prompts' +# c.TerminalInteractiveShell.prompts_class = 'IPython.terminal.prompts.Prompts' + +# See also: InteractiveShell.quiet +# c.TerminalInteractiveShell.quiet = False + +# See also: InteractiveShell.separate_in +# c.TerminalInteractiveShell.separate_in = '\n' + +# See also: InteractiveShell.separate_out +# c.TerminalInteractiveShell.separate_out = '' + +# See also: InteractiveShell.separate_out2 +# c.TerminalInteractiveShell.separate_out2 = '' + +## Add, disable or modifying shortcuts. +# +# Each entry on the list should be a dictionary with ``command`` key +# identifying the target function executed by the shortcut and at least +# one of the following: +# +# - ``match_keys``: list of keys used to match an existing shortcut, +# - ``match_filter``: shortcut filter used to match an existing shortcut, +# - ``new_keys``: list of keys to set, +# - ``new_filter``: a new shortcut filter to set +# +# The filters have to be composed of pre-defined verbs and joined by one +# of the following conjunctions: ``&`` (and), ``|`` (or), ``~`` (not). +# The pre-defined verbs are: +# +# - `always` +# - `never` +# - `has_line_below` +# - `has_line_above` +# - `is_cursor_at_the_end_of_line` +# - `has_selection` +# - `has_suggestion` +# - `vi_mode` +# - `vi_insert_mode` +# - `emacs_insert_mode` +# - `emacs_like_insert_mode` +# - `has_completions` +# - `insert_mode` +# - `default_buffer_focused` +# - `search_buffer_focused` +# - `ebivim` +# - `supports_suspend` +# - `is_windows_os` +# - `auto_match` +# - `focused_insert` +# - `not_inside_unclosed_string` +# - `readline_like_completions` +# - `preceded_by_paired_double_quotes` +# - `preceded_by_paired_single_quotes` +# - `preceded_by_raw_str_prefix` +# - `preceded_by_two_double_quotes` +# - `preceded_by_two_single_quotes` +# - `followed_by_closing_paren_or_end` +# - `preceded_by_opening_round_paren` +# - `preceded_by_opening_bracket` +# - `preceded_by_opening_brace` +# - `preceded_by_double_quote` +# - `preceded_by_single_quote` +# - `followed_by_closing_round_paren` +# - `followed_by_closing_bracket` +# - `followed_by_closing_brace` +# - `followed_by_double_quote` +# - `followed_by_single_quote` +# - `navigable_suggestions` +# - `cursor_in_leading_ws` +# - `pass_through` +# +# To disable a shortcut set ``new_keys`` to an empty list. +# To add a shortcut add key ``create`` with value ``True``. +# +# When modifying/disabling shortcuts, ``match_keys``/``match_filter`` can +# be omitted if the provided specification uniquely identifies a shortcut +# to be modified/disabled. When modifying a shortcut ``new_filter`` or +# ``new_keys`` can be omitted which will result in reuse of the existing +# filter/keys. +# +# Only shortcuts defined in IPython (and not default prompt-toolkit +# shortcuts) can be modified or disabled. The full list of shortcuts, +# command identifiers and filters is available under +# :ref:`terminal-shortcuts-list`. +# Default: [] +# c.TerminalInteractiveShell.shortcuts = [] + +## Show rewritten input, e.g. for autocall. +# See also: InteractiveShell.show_rewritten_input +# c.TerminalInteractiveShell.show_rewritten_input = True + +## Use `raw_input` for the REPL, without completion and prompt colors. +# +# Useful when controlling IPython as a subprocess, and piping +# STDIN/OUT/ERR. Known usage are: IPython's own testing machinery, +# and emacs' inferior-python subprocess (assuming you have set +# `python-shell-interpreter` to "ipython") available through the +# built-in `M-x run-python` and third party packages such as elpy. +# +# This mode default to `True` if the `IPY_TEST_SIMPLE_PROMPT` +# environment variable is set, or the current terminal is not a tty. +# Thus the Default value reported in --help-all, or config will often +# be incorrectly reported. +# Default: False +# c.TerminalInteractiveShell.simple_prompt = False + +## Number of line at the bottom of the screen to reserve for the tab completion +# menu, search history, ...etc, the height of these menus will at most this +# value. Increase it is you prefer long and skinny menus, decrease for short and +# wide. +# Default: 6 +# c.TerminalInteractiveShell.space_for_menu = 6 + +## +# See also: InteractiveShell.sphinxify_docstring +# c.TerminalInteractiveShell.sphinxify_docstring = False + +## Automatically set the terminal title +# Default: True +# c.TerminalInteractiveShell.term_title = True + +## Customize the terminal title format. This is a python format string. +# Available substitutions are: {cwd}. +# Default: 'IPython: {cwd}' +# c.TerminalInteractiveShell.term_title_format = 'IPython: {cwd}' + +## The time in milliseconds that is waited for a mapped key +# sequence to complete. +# Default: 0.5 +# c.TerminalInteractiveShell.timeoutlen = 0.5 + +## Use 24bit colors instead of 256 colors in prompt highlighting. +# If your terminal supports true color, the following command should +# print ``TRUECOLOR`` in orange:: +# +# printf "\x1b[38;2;255;100;0mTRUECOLOR\x1b[0m\n" +# Default: False +# c.TerminalInteractiveShell.true_color = False + +## The time in milliseconds that is waited for a key code +# to complete. +# Default: 0.01 +# c.TerminalInteractiveShell.ttimeoutlen = 0.01 + +## Warn if running in a virtual environment with no IPython installed (so IPython +# from the global environment is used). +# See also: InteractiveShell.warn_venv +# c.TerminalInteractiveShell.warn_venv = True + +# See also: InteractiveShell.wildcards_case_sensitive +# c.TerminalInteractiveShell.wildcards_case_sensitive = True + +## Switch modes for the IPython exception handlers. +# See also: InteractiveShell.xmode +# c.TerminalInteractiveShell.xmode = 'Context' + +#------------------------------------------------------------------------------ +# HistoryAccessor(HistoryAccessorBase) configuration +#------------------------------------------------------------------------------ +## Access the history database without adding to it. +# +# This is intended for use by standalone history tools. IPython shells use +# HistoryManager, below, which is a subclass of this. + +## Options for configuring the SQLite connection +# +# These options are passed as keyword args to sqlite3.connect +# when establishing database connections. +# Default: {} +# c.HistoryAccessor.connection_options = {} + +## enable the SQLite history +# +# set enabled=False to disable the SQLite history, +# in which case there will be no stored history, no SQLite connection, +# and no background saving thread. This may be necessary in some +# threaded environments where IPython is embedded. +# Default: True +# c.HistoryAccessor.enabled = True + +## Path to file to use for SQLite history database. +# +# By default, IPython will put the history database in the IPython +# profile directory. If you would rather share one history among +# profiles, you can set this value in each, so that they are consistent. +# +# Due to an issue with fcntl, SQLite is known to misbehave on some NFS +# mounts. If you see IPython hanging, try setting this to something on a +# local disk, e.g:: +# +# ipython --HistoryManager.hist_file=/tmp/ipython_hist.sqlite +# +# you can also use the specific value `:memory:` (including the colon +# at both end but not the back ticks), to avoid creating an history file. +# Default: traitlets.Undefined +# c.HistoryAccessor.hist_file = traitlets.Undefined + +#------------------------------------------------------------------------------ +# HistoryManager(HistoryAccessor) configuration +#------------------------------------------------------------------------------ +## A class to organize all history-related functionality in one place. + +## Options for configuring the SQLite connection +# See also: HistoryAccessor.connection_options +# c.HistoryManager.connection_options = {} + +## Write to database every x commands (higher values save disk access & power). +# Values of 1 or less effectively disable caching. +# Default: 0 +# c.HistoryManager.db_cache_size = 0 + +## Should the history database include output? (default: no) +# Default: False +# c.HistoryManager.db_log_output = False + +## enable the SQLite history +# See also: HistoryAccessor.enabled +# c.HistoryManager.enabled = True + +## Path to file to use for SQLite history database. +# See also: HistoryAccessor.hist_file +# c.HistoryManager.hist_file = traitlets.Undefined + +#------------------------------------------------------------------------------ +# MagicsManager(Configurable) configuration +#------------------------------------------------------------------------------ +## Object that handles all magic-related functionality for IPython. + +## Automatically call line magics without requiring explicit % prefix +# Default: True +# c.MagicsManager.auto_magic = True + +## Mapping from magic names to modules to load. +# +# This can be used in IPython/IPykernel configuration to declare lazy magics +# that will only be imported/registered on first use. +# +# For example:: +# +# c.MagicsManager.lazy_magics = { +# "my_magic": "slow.to.import", +# "my_other_magic": "also.slow", +# } +# +# On first invocation of `%my_magic`, `%%my_magic`, `%%my_other_magic` or +# `%%my_other_magic`, the corresponding module will be loaded as an ipython +# extensions as if you had previously done `%load_ext ipython`. +# +# Magics names should be without percent(s) as magics can be both cell and line +# magics. +# +# Lazy loading happen relatively late in execution process, and complex +# extensions that manipulate Python/IPython internal state or global state might +# not support lazy loading. +# Default: {} +# c.MagicsManager.lazy_magics = {} + +#------------------------------------------------------------------------------ +# ProfileDir(LoggingConfigurable) configuration +#------------------------------------------------------------------------------ +## An object to manage the profile directory and its resources. +# +# The profile directory is used by all IPython applications, to manage +# configuration, logging and security. +# +# This object knows how to find, create and manage these directories. This +# should be used by any code that wants to handle profiles. + +## Set the profile location directly. This overrides the logic used by the +# `profile` option. +# Default: '' +# c.ProfileDir.location = '' + +#------------------------------------------------------------------------------ +# BaseFormatter(Configurable) configuration +#------------------------------------------------------------------------------ +## A base formatter class that is configurable. +# +# This formatter should usually be used as the base class of all formatters. +# It is a traited :class:`Configurable` class and includes an extensible +# API for users to determine how their objects are formatted. The following +# logic is used to find a function to format an given object. +# +# 1. The object is introspected to see if it has a method with the name +# :attr:`print_method`. If is does, that object is passed to that method +# for formatting. +# 2. If no print method is found, three internal dictionaries are consulted +# to find print method: :attr:`singleton_printers`, :attr:`type_printers` +# and :attr:`deferred_printers`. +# +# Users should use these dictionaries to register functions that will be +# used to compute the format data for their objects (if those objects don't +# have the special print methods). The easiest way of using these +# dictionaries is through the :meth:`for_type` and :meth:`for_type_by_name` +# methods. +# +# If no function/callable is found to compute the format data, ``None`` is +# returned and this format type is not used. + +# Default: {} +# c.BaseFormatter.deferred_printers = {} + +# Default: True +# c.BaseFormatter.enabled = True + +# Default: {} +# c.BaseFormatter.singleton_printers = {} + +# Default: {} +# c.BaseFormatter.type_printers = {} + +#------------------------------------------------------------------------------ +# PlainTextFormatter(BaseFormatter) configuration +#------------------------------------------------------------------------------ +## The default pretty-printer. +# +# This uses :mod:`IPython.lib.pretty` to compute the format data of +# the object. If the object cannot be pretty printed, :func:`repr` is used. +# See the documentation of :mod:`IPython.lib.pretty` for details on +# how to write pretty printers. Here is a simple example:: +# +# def dtype_pprinter(obj, p, cycle): +# if cycle: +# return p.text('dtype(...)') +# if hasattr(obj, 'fields'): +# if obj.fields is None: +# p.text(repr(obj)) +# else: +# p.begin_group(7, 'dtype([') +# for i, field in enumerate(obj.descr): +# if i > 0: +# p.text(',') +# p.breakable() +# p.pretty(field) +# p.end_group(7, '])') + +# See also: BaseFormatter.deferred_printers +# c.PlainTextFormatter.deferred_printers = {} + +# Default: '' +# c.PlainTextFormatter.float_precision = '' + +## Truncate large collections (lists, dicts, tuples, sets) to this size. +# +# Set to 0 to disable truncation. +# Default: 1000 +# c.PlainTextFormatter.max_seq_length = 1000 + +# Default: 79 +# c.PlainTextFormatter.max_width = 79 + +# Default: '\n' +# c.PlainTextFormatter.newline = '\n' + +# Default: True +# c.PlainTextFormatter.pprint = True + +# See also: BaseFormatter.singleton_printers +# c.PlainTextFormatter.singleton_printers = {} + +# See also: BaseFormatter.type_printers +# c.PlainTextFormatter.type_printers = {} + +# Default: False +# c.PlainTextFormatter.verbose = False + +#------------------------------------------------------------------------------ +# Completer(Configurable) configuration +#------------------------------------------------------------------------------ +## Enable auto-closing dictionary keys. +# +# When enabled string keys will be suffixed with a final quote (matching the +# opening quote), tuple keys will also receive a separating comma if needed, and +# keys which are final will receive a closing bracket (``]``). +# Default: False +# c.Completer.auto_close_dict_keys = False + +## Enable unicode completions, e.g. \alpha . Includes completion of latex +# commands, unicode names, and expanding unicode characters back to latex +# commands. +# Default: True +# c.Completer.backslash_combining_completions = True + +## Enable debug for the Completer. Mostly print extra information for +# experimental jedi integration. +# Default: False +# c.Completer.debug = False + +## Policy for code evaluation under completion. +# +# Successive options allow to enable more eager evaluation for better +# completion suggestions, including for nested dictionaries, nested lists, +# or even results of function calls. +# Setting ``unsafe`` or higher can lead to evaluation of arbitrary user +# code on :kbd:`Tab` with potentially unwanted or dangerous side effects. +# +# Allowed values are: +# +# - ``forbidden``: no evaluation of code is permitted, +# - ``minimal``: evaluation of literals and access to built-in namespace; +# no item/attribute evaluationm no access to locals/globals, +# no evaluation of any operations or comparisons. +# - ``limited``: access to all namespaces, evaluation of hard-coded methods +# (for example: :any:`dict.keys`, :any:`object.__getattr__`, +# :any:`object.__getitem__`) on allow-listed objects (for example: +# :any:`dict`, :any:`list`, :any:`tuple`, ``pandas.Series``), +# - ``unsafe``: evaluation of all methods and function calls but not of +# syntax with side-effects like `del x`, +# - ``dangerous``: completely arbitrary evaluation. +# Choices: any of ['forbidden', 'minimal', 'limited', 'unsafe', 'dangerous'] +# Default: 'limited' +# c.Completer.evaluation = 'limited' + +## Activate greedy completion. +# +# .. deprecated:: 8.8 +# Use :std:configtrait:`Completer.evaluation` and :std:configtrait:`Completer.auto_close_dict_keys` instead. +# +# When enabled in IPython 8.8 or newer, changes configuration as +# follows: +# +# - ``Completer.evaluation = 'unsafe'`` +# - ``Completer.auto_close_dict_keys = True`` +# Default: False +# c.Completer.greedy = False + +## Experimental: restrict time (in milliseconds) during which Jedi can compute types. +# Set to 0 to stop computing types. Non-zero value lower than 100ms may hurt +# performance by preventing jedi to build its cache. +# Default: 400 +# c.Completer.jedi_compute_type_timeout = 400 + +## Experimental: Use Jedi to generate autocompletions. Default to True if jedi is +# installed. +# Default: True +# c.Completer.use_jedi = True + +#------------------------------------------------------------------------------ +# IPCompleter(Completer) configuration +#------------------------------------------------------------------------------ +## Extension of the completer class with IPython-specific features + +## +# See also: Completer.auto_close_dict_keys +# c.IPCompleter.auto_close_dict_keys = False + +## Enable unicode completions, e.g. \alpha . Includes completion of latex +# commands, unicode names, and expanding unicode characters back to latex +# commands. +# See also: Completer.backslash_combining_completions +# c.IPCompleter.backslash_combining_completions = True + +## Enable debug for the Completer. Mostly print extra information for +# experimental jedi integration. +# See also: Completer.debug +# c.IPCompleter.debug = False + +## List of matchers to disable. +# +# The list should contain matcher identifiers (see +# :any:`completion_matcher`). +# Default: [] +# c.IPCompleter.disable_matchers = [] + +## Policy for code evaluation under completion. +# See also: Completer.evaluation +# c.IPCompleter.evaluation = 'limited' + +## Activate greedy completion. +# See also: Completer.greedy +# c.IPCompleter.greedy = False + +## Experimental: restrict time (in milliseconds) during which Jedi can compute +# types. +# See also: Completer.jedi_compute_type_timeout +# c.IPCompleter.jedi_compute_type_timeout = 400 + +## DEPRECATED as of version 5.0. +# +# Instruct the completer to use __all__ for the completion +# +# Specifically, when completing on ``object.``. +# +# When True: only those names in obj.__all__ will be included. +# +# When False [default]: the __all__ attribute is ignored +# Default: False +# c.IPCompleter.limit_to__all__ = False + +## Whether to merge completion results into a single list +# +# If False, only the completion results from the first non-empty +# completer will be returned. +# +# As of version 8.6.0, setting the value to ``False`` is an alias for: +# ``IPCompleter.suppress_competing_matchers = True.``. +# Default: True +# c.IPCompleter.merge_completions = True + +## Instruct the completer to omit private method names +# +# Specifically, when completing on ``object.``. +# +# When 2 [default]: all names that start with '_' will be excluded. +# +# When 1: all 'magic' names (``__foo__``) will be excluded. +# +# When 0: nothing will be excluded. +# Choices: any of [0, 1, 2] +# Default: 2 +# c.IPCompleter.omit__names = 2 + +## If True, emit profiling data for completion subsystem using cProfile. +# Default: False +# c.IPCompleter.profile_completions = False + +## Template for path at which to output profile data for completions. +# Default: '.completion_profiles' +# c.IPCompleter.profiler_output_dir = '.completion_profiles' + +## Whether to suppress completions from other *Matchers*. +# +# When set to ``None`` (default) the matchers will attempt to auto-detect +# whether suppression of other matchers is desirable. For example, at the +# beginning of a line followed by `%` we expect a magic completion to be the +# only applicable option, and after ``my_dict['`` we usually expect a completion +# with an existing dictionary key. +# +# If you want to disable this heuristic and see completions from all matchers, +# set ``IPCompleter.suppress_competing_matchers = False``. To disable the +# heuristic for specific matchers provide a dictionary mapping: +# ``IPCompleter.suppress_competing_matchers = {'IPCompleter.dict_key_matcher': +# False}``. +# +# Set ``IPCompleter.suppress_competing_matchers = True`` to limit completions to +# the set of matchers with the highest priority; this is equivalent to +# ``IPCompleter.merge_completions`` and can be beneficial for performance, but +# will sometimes omit relevant candidates from matchers further down the +# priority list. +# Default: None +# c.IPCompleter.suppress_competing_matchers = None + +## Experimental: Use Jedi to generate autocompletions. Default to True if jedi is +# installed. +# See also: Completer.use_jedi +# c.IPCompleter.use_jedi = True + +#------------------------------------------------------------------------------ +# ScriptMagics(Magics) configuration +#------------------------------------------------------------------------------ +## Magics for talking to scripts +# +# This defines a base `%%script` cell magic for running a cell +# with a program in a subprocess, and registers a few top-level +# magics that call %%script with common interpreters. + +## Extra script cell magics to define +# +# This generates simple wrappers of `%%script foo` as `%%foo`. +# +# If you want to add script magics that aren't on your path, +# specify them in script_paths +# Default: [] +# c.ScriptMagics.script_magics = [] + +## Dict mapping short 'ruby' names to full paths, such as '/opt/secret/bin/ruby' +# +# Only necessary for items in script_magics where the default path will not +# find the right interpreter. +# Default: {} +# c.ScriptMagics.script_paths = {} + +#------------------------------------------------------------------------------ +# LoggingMagics(Magics) configuration +#------------------------------------------------------------------------------ +## Magics related to all logging machinery. + +## Suppress output of log state when logging is enabled +# Default: False +# c.LoggingMagics.quiet = False + +#------------------------------------------------------------------------------ +# StoreMagics(Magics) configuration +#------------------------------------------------------------------------------ +## Lightweight persistence for python variables. +# +# Provides the %store magic. + +## If True, any %store-d variables will be automatically restored +# when IPython starts. +# Default: False +# c.StoreMagics.autorestore = False diff --git a/__pycache__/model_runner.cpython-310.pyc b/__pycache__/model_runner.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..12a450852a53ae59064d0109a2add1b5f6ba5818 GIT binary patch literal 8331 zcmd1j<>g{vU|`VjNX=NN#lY|w#6iX^3=9ko3=9m#cNiELQW#Pga~Pr+QW>%s7ciwT zq%bXHVuXk?M=^tCS)y1|7*d#X*mBvT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fN@yWR0u+u#pcWRWLs1MegoA;Dk%N^(nnRAujzfY&fR76- zuPJ|vxwx_zTnOG`%gifIEh;J642m|kq{QM>Gm|1vtFH*uVJlh-vIx`~hh!y|tm6E< zTigYexu6MUa3d1jJY~WHa^HWN5Qtd#sL$MZkV2TekBnBN20}Yaa ThQuHk)U)LQ#W5onqYw)K%L7T& literal 0 HcmV?d00001 diff --git a/js.json b/js.json new file mode 100644 index 0000000..a7f07ba --- /dev/null +++ b/js.json @@ -0,0 +1,736 @@ +{ + "start_score_time": 1751390831.5091646, + "num_frames": 26, + "end_score_time": 1751390833.4907234, + "video": { + "w": 3840, + "h": 2160, + "path": "/home/thebears/source/ml_code/short.mp4", + "target_w": 1280, + "target_h": 720, + "pad_amt": [ + 0, + 24, + 0, + 24 + ] + }, + "scoring_fps": 13.120983340672774, + "scores": [ + { + "frame": 0, + "detections": [ + { + "coords": [ + 702.0, + 249.375, + 913.0, + 382.0 + ], + "score": 0.84033203125, + "idx": 2, + "name": "Agelaius phoeniceus" + }, + { + "coords": [ + 952.5, + 301.0, + 1198.0, + 461.0 + ], + "score": 0.82275390625, + "idx": 69, + "name": "Passer domesticus" + } + ] + }, + { + "frame": 1, + "detections": [ + { + "coords": [ + 702.0, + 249.5, + 913.0, + 381.5 + ], + "score": 0.84375, + "idx": 2, + "name": "Agelaius phoeniceus" + }, + { + "coords": [ + 951.5, + 300.75, + 1197.0, + 461.25 + ], + "score": 0.82275390625, + "idx": 69, + "name": "Passer domesticus" + } + ] + }, + { + "frame": 2, + "detections": [ + { + "coords": [ + 701.0, + 249.5, + 914.0, + 381.0 + ], + "score": 0.84228515625, + "idx": 2, + "name": "Agelaius phoeniceus" + }, + { + "coords": [ + 952.0, + 300.75, + 1196.0, + 461.75 + ], + "score": 0.822265625, + "idx": 69, + "name": "Passer domesticus" + } + ] + }, + { + "frame": 3, + "detections": [ + { + "coords": [ + 700.5, + 249.25, + 913.5, + 380.75 + ], + "score": 0.84228515625, + "idx": 2, + "name": "Agelaius phoeniceus" + }, + { + "coords": [ + 952.0, + 300.75, + 1196.0, + 461.25 + ], + "score": 0.833984375, + "idx": 69, + "name": "Passer domesticus" + } + ] + }, + { + "frame": 4, + "detections": [ + { + "coords": [ + 699.5, + 249.0, + 913.5, + 380.0 + ], + "score": 0.84326171875, + "idx": 2, + "name": "Agelaius phoeniceus" + }, + { + "coords": [ + 952.0, + 300.5, + 1196.0, + 461.5 + ], + "score": 0.84228515625, + "idx": 69, + "name": "Passer domesticus" + } + ] + }, + { + "frame": 5, + "detections": [ + { + "coords": [ + 699.5, + 248.875, + 913.5, + 379.0 + ], + "score": 0.8505859375, + "idx": 2, + "name": "Agelaius phoeniceus" + }, + { + "coords": [ + 952.0, + 300.5, + 1196.0, + 461.5 + ], + "score": 0.828125, + "idx": 69, + "name": "Passer domesticus" + } + ] + }, + { + "frame": 6, + "detections": [ + { + "coords": [ + 699.5, + 248.875, + 913.5, + 379.0 + ], + "score": 0.85205078125, + "idx": 2, + "name": "Agelaius phoeniceus" + }, + { + "coords": [ + 952.0, + 300.5, + 1196.0, + 461.5 + ], + "score": 0.82373046875, + "idx": 69, + "name": "Passer domesticus" + } + ] + }, + { + "frame": 7, + "detections": [ + { + "coords": [ + 698.5, + 248.875, + 914.5, + 379.0 + ], + "score": 0.84814453125, + "idx": 2, + "name": "Agelaius phoeniceus" + }, + { + "coords": [ + 952.5, + 300.5, + 1196.0, + 462.0 + ], + "score": 0.82421875, + "idx": 69, + "name": "Passer domesticus" + } + ] + }, + { + "frame": 8, + "detections": [ + { + "coords": [ + 698.0, + 248.875, + 915.0, + 379.0 + ], + "score": 0.845703125, + "idx": 2, + "name": "Agelaius phoeniceus" + }, + { + "coords": [ + 952.0, + 300.75, + 1196.0, + 461.75 + ], + "score": 0.83837890625, + "idx": 69, + "name": "Passer domesticus" + } + ] + }, + { + "frame": 9, + "detections": [ + { + "coords": [ + 697.5, + 248.375, + 919.5, + 379.0 + ], + "score": 0.84912109375, + "idx": 2, + "name": "Agelaius phoeniceus" + }, + { + "coords": [ + 951.0, + 301.0, + 1195.0, + 462.0 + ], + "score": 0.83251953125, + "idx": 69, + "name": "Passer domesticus" + } + ] + }, + { + "frame": 10, + "detections": [ + { + "coords": [ + 697.5, + 247.0, + 921.5, + 380.0 + ], + "score": 0.84521484375, + "idx": 2, + "name": "Agelaius phoeniceus" + }, + { + "coords": [ + 952.5, + 301.0, + 1195.0, + 461.5 + ], + "score": 0.84033203125, + "idx": 69, + "name": "Passer domesticus" + } + ] + }, + { + "frame": 11, + "detections": [ + { + "coords": [ + 696.5, + 246.875, + 922.5, + 380.5 + ], + "score": 0.845703125, + "idx": 2, + "name": "Agelaius phoeniceus" + }, + { + "coords": [ + 951.0, + 301.25, + 1195.0, + 461.75 + ], + "score": 0.83447265625, + "idx": 69, + "name": "Passer domesticus" + } + ] + }, + { + "frame": 12, + "detections": [ + { + "coords": [ + 697.5, + 246.75, + 922.5, + 380.75 + ], + "score": 0.85205078125, + "idx": 2, + "name": "Agelaius phoeniceus" + }, + { + "coords": [ + 953.0, + 301.75, + 1195.0, + 461.25 + ], + "score": 0.818359375, + "idx": 69, + "name": "Passer domesticus" + } + ] + }, + { + "frame": 13, + "detections": [ + { + "coords": [ + 696.5, + 246.75, + 922.5, + 379.75 + ], + "score": 0.8525390625, + "idx": 2, + "name": "Agelaius phoeniceus" + }, + { + "coords": [ + 953.0, + 302.0, + 1195.0, + 461.5 + ], + "score": 0.81982421875, + "idx": 69, + "name": "Passer domesticus" + } + ] + }, + { + "frame": 14, + "detections": [ + { + "coords": [ + 696.5, + 246.5, + 922.5, + 380.5 + ], + "score": 0.85205078125, + "idx": 2, + "name": "Agelaius phoeniceus" + }, + { + "coords": [ + 953.5, + 302.5, + 1195.0, + 461.5 + ], + "score": 0.8203125, + "idx": 69, + "name": "Passer domesticus" + } + ] + }, + { + "frame": 15, + "detections": [ + { + "coords": [ + 697.0, + 246.5, + 923.0, + 380.5 + ], + "score": 0.85205078125, + "idx": 2, + "name": "Agelaius phoeniceus" + }, + { + "coords": [ + 953.0, + 302.25, + 1195.0, + 461.25 + ], + "score": 0.8212890625, + "idx": 69, + "name": "Passer domesticus" + } + ] + }, + { + "frame": 16, + "detections": [ + { + "coords": [ + 697.0, + 246.25, + 924.0, + 381.75 + ], + "score": 0.8447265625, + "idx": 2, + "name": "Agelaius phoeniceus" + }, + { + "coords": [ + 953.0, + 302.5, + 1195.0, + 461.5 + ], + "score": 0.83447265625, + "idx": 69, + "name": "Passer domesticus" + } + ] + }, + { + "frame": 17, + "detections": [ + { + "coords": [ + 697.0, + 246.25, + 924.0, + 379.25 + ], + "score": 0.8642578125, + "idx": 2, + "name": "Agelaius phoeniceus" + }, + { + "coords": [ + 970.5, + 303.0, + 1195.0, + 461.5 + ], + "score": 0.7041015625, + "idx": 69, + "name": "Passer domesticus" + } + ] + }, + { + "frame": 18, + "detections": [ + { + "coords": [ + 697.0, + 246.125, + 924.0, + 375.5 + ], + "score": 0.87548828125, + "idx": 2, + "name": "Agelaius phoeniceus" + }, + { + "coords": [ + 975.5, + 303.25, + 1194.0, + 461.75 + ], + "score": 0.7158203125, + "idx": 69, + "name": "Passer domesticus" + } + ] + }, + { + "frame": 19, + "detections": [ + { + "coords": [ + 697.0, + 246.0, + 924.0, + 374.5 + ], + "score": 0.880859375, + "idx": 2, + "name": "Agelaius phoeniceus" + }, + { + "coords": [ + 976.0, + 303.0, + 1194.0, + 462.0 + ], + "score": 0.68310546875, + "idx": 69, + "name": "Passer domesticus" + } + ] + }, + { + "frame": 20, + "detections": [ + { + "coords": [ + 697.0, + 246.0, + 924.0, + 374.5 + ], + "score": 0.88427734375, + "idx": 2, + "name": "Agelaius phoeniceus" + }, + { + "coords": [ + 977.0, + 303.0, + 1193.0, + 462.5 + ], + "score": 0.56591796875, + "idx": 69, + "name": "Passer domesticus" + } + ] + }, + { + "frame": 21, + "detections": [ + { + "coords": [ + 697.5, + 246.0, + 924.5, + 376.5 + ], + "score": 0.875, + "idx": 2, + "name": "Agelaius phoeniceus" + }, + { + "coords": [ + 977.0, + 303.0, + 1193.0, + 462.0 + ], + "score": 0.60205078125, + "idx": 69, + "name": "Passer domesticus" + } + ] + }, + { + "frame": 22, + "detections": [ + { + "coords": [ + 696.5, + 246.0, + 924.5, + 377.0 + ], + "score": 0.87109375, + "idx": 2, + "name": "Agelaius phoeniceus" + }, + { + "coords": [ + 977.0, + 302.75, + 1193.0, + 461.75 + ], + "score": 0.6416015625, + "idx": 69, + "name": "Passer domesticus" + } + ] + }, + { + "frame": 23, + "detections": [ + { + "coords": [ + 697.5, + 246.0, + 924.5, + 378.0 + ], + "score": 0.87158203125, + "idx": 2, + "name": "Agelaius phoeniceus" + }, + { + "coords": [ + 976.5, + 303.0, + 1193.0, + 461.5 + ], + "score": 0.607421875, + "idx": 69, + "name": "Passer domesticus" + } + ] + }, + { + "frame": 24, + "detections": [ + { + "coords": [ + 697.0, + 246.0, + 926.0, + 378.0 + ], + "score": 0.865234375, + "idx": 2, + "name": "Agelaius phoeniceus" + }, + { + "coords": [ + 977.0, + 303.0, + 1193.0, + 461.5 + ], + "score": 0.69580078125, + "idx": 69, + "name": "Passer domesticus" + } + ] + }, + { + "frame": 25, + "detections": [ + { + "coords": [ + 697.0, + 245.125, + 927.0, + 379.0 + ], + "score": 0.85302734375, + "idx": 2, + "name": "Agelaius phoeniceus" + }, + { + "coords": [ + 970.5, + 303.25, + 1193.0, + 461.25 + ], + "score": 0.7900390625, + "idx": 69, + "name": "Passer domesticus" + } + ] + } + ], + "embeds": { + "frame_numbers": [ + 0, + 10, + 20 + ], + "array_size": [ + 3, + 1152 + ], + "array_dtype": "float16", + "array_binary": "sDUQrpSnazeRNZgxYLhALTCgsrwpOZCmhbxetOypLjiSrh259rkuNhg5bMkQOGG0L7VQtYo8LjiUMPSrUrR5MRq4+rIetj22mbkDvBQ7TLgQrgaoIKk0svW+xjTwqbC4jKkwOuOz4TMOupAxH7J4NKW4ijDEsSg1CLxOsAy5LLQYu5g3D610NrC2rjfMuV8uQ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9O1RjaasEG4nDIWMJg1FC3CNQq4oBe9ugCiMDbENK2xhqxkJss0mrRcOFwzszEsuDw6g7RSs/KxljhHsmQrbbNMMQ0zjrAAnOgqijmwrd45oDZeN5E1CrUNOLs4rzUbs101nzfopxIzUziorQipWLM4NUa0R7cIKJczvzm4tOazozUoPH62TihyvOS0UDnUNfQ05DRbuTuxVjaAp9myWDVgNWu2TbCytEazgLivsqAvTK9Nuh4yOLj4Msw3ojg8MMA4SrdMMceyKrb4Mtq0ZbYouaA1/C4ACCM0" + } +} \ No newline at end of file diff --git a/ml_run.py b/ml_run.py index 62e76dc..25d9b55 100644 --- a/ml_run.py +++ b/ml_run.py @@ -1,334 +1,8 @@ -import sys - -sys.path.insert(0, "/home/thebears/source/models/yolov7") -import time -from datetime import datetime -import cv2 -import numpy as np -from pymediainfo import MediaInfo -import inspect -import open_clip -import sys -import torch -import yaml -from models.experimental import attempt_load -from utils.general import check_img_size, non_max_suppression -from torchvision import transforms - -device = torch.device("cuda") - -pretrained_name = "webli" -#model_name = "ViT-SO400M-16-SigLIP2-512" -#model_name = 'ViT-SO400M-14-SigLIP-384' - -clip_model, _, clip_preprocess_og = open_clip.create_model_and_transforms( - model_name, pretrained=pretrained_name -) -tokenizer = open_clip.get_tokenizer('hf-hub:timm/'+model_name) -labels_list = ["A bird with a brown head and black body", "A bird with a black head and black body"] -text = tokenizer(labels_list, context_length=clip_model.context_length) - -import torch.nn.functional as F -with torch.no_grad(): - text_features = clip_model.encode_text(text).detach().cpu() - text_features = F.normalize(text_features, dim=-1).detach().cpu() +from model_runner import ModelRunner +mr = ModelRunner() # %% - -clip_model = clip_model.half().to(device) -clip_dtype = next(clip_model.parameters()).dtype -clip_img_size = clip_preprocess_og.transforms[0].size -_ = clip_model.encode_image( - torch.rand(1, 3, *clip_img_size, dtype=clip_dtype, device=device) -) -clip_preprocess = transforms.Compose([clip_preprocess_og.transforms[x] for x in [0, 3]]) - -det_root_path = "/home/thebears/source/model_weights" -det_model_weights_root = os.path.join(det_root_path, "yolov7") -det_model_weights_path = os.path.join(det_model_weights_root, "best.pt") -det_data_yaml_path = os.path.join(det_model_weights_root, "inaturalist.yaml") -det_model = attempt_load(det_model_weights_path, map_location=device) -det_model = det_model.half().to(device) - -det_dtype = next(det_model.parameters()).dtype -det_imgsz = 1280 -det_stride = int(det_model.stride.max()) -det_imgsz = check_img_size(det_imgsz, s=det_stride) -_ = det_model(torch.zeros(1, 3, det_imgsz, det_imgsz, dtype=det_dtype).to(device)) - -with open(det_data_yaml_path, "r") as ff: - det_model_info = yaml.safe_load(ff) - det_labels = det_model_info["names"] - - - - -array_score = clip_array -frame_numbers = [x[0] for x in array_score] -frame_values = [x[1] for x in array_score] -frame_as_tensor = ( - torch.from_numpy(np.stack(frame_values)[:, :, :, 0:3]) - .to(torch.float16) - .to(device) - .permute([0, 3, 1, 2]) -) -def score_frames_det(array_score): - frame_numbers = [x[0] for x in array_score] - frame_values = [x[1] for x in array_score] - frame_as_tensor = ( - torch.from_numpy(np.stack(frame_values)[:, :, :, 0:3]) - .to(torch.float16) - .to(device) - .permute([0, 3, 1, 2]) - ) - - with torch.no_grad(): - frame_for_model = det_vid_preprocess(frame_as_tensor).div(255)[:,[2,1,0],:,:] - det_preds = det_model(frame_for_model)[0] - det_pred_post_nms = non_max_suppression(det_preds,0.25, 0.5) - det_cpu_pred = [x.detach().cpu().numpy() for x in det_pred_post_nms] - -# frame_for_clip = clip_preprocess(frame_as_tensor[:,[0,1,2],:,:]) -# clip_pred = clip_model.encode_image(frame_for_clip).detach().cpu().numpy() - - return {"det": det_cpu_pred, "fr#": frame_numbers} - -def score_frames_clip(array_score): - frame_numbers = [x[0] for x in array_score] - frame_values = [x[1] for x in array_score] - frame_as_tensor = ( - torch.from_numpy(np.stack(frame_values)[:, :, :, 0:3]) - .to(torch.float16) - .to(device) - .permute([0, 3, 1, 2]) - ) - - with torch.no_grad(): -# frame_for_model = det_vid_preprocess(frame_as_tensor).div(255)[:,[2,1,0],:,:] -# det_preds = det_model(frame_for_model)[0] -# det_pred_post_nms = non_max_suppression(det_preds,0.25, 0.5) -# det_cpu_pred = [x.detach().cpu().numpy() for x in det_pred_post_nms] - - frame_for_clip = clip_preprocess(frame_as_tensor[:,[0,1,2],:,:]) - clip_pred = clip_model.encode_image(frame_for_clip).detach().cpu().numpy() - - - return {"clip": clip_pred, "fr#": frame_numbers} - - - - - -with torch.no_grad(): - frame_for_model = det_vid_preprocess(frame_as_tensor).div(255)[:,[2,1,0],:,:] - det_preds = det_model(frame_for_model)[0] - det_pred_post_nms = non_max_suppression(det_preds,0.25, 0.5) - det_cpu_pred = [x.detach().cpu().numpy() for x in det_pred_post_nms] - frame_for_clip = frame_as_tensor.div(255) - - frame_for_clip = clip_preprocess(frame_for_clip[:,(2,1,0),:,:]) - clip_pred = clip_model.encode_image(frame_for_clip).detach().cpu().numpy() - -score_result = {"det": det_cpu_pred, "clip": clip_pred, "fr#": frame_numbers} - - -clip_orin = F.normalize(torch.from_numpy(score_result['clip'])) -clip_tree = F.normalize(torch.from_numpy(saved_emb)) -print(np.dot(clip_tree, clip_orin.T)) - - -mvo = mean_vec_out[0] -ooo = frame_for_clip[0].cpu().numpy() - -plt.close('all') -fig = plt.figure() - -ax1 = fig.add_subplot(3,2,1) -ax1.imshow(mvo[0]) -ax2 = fig.add_subplot(3,2,2) -ax2.imshow(ooo[0]) -ax3 = fig.add_subplot(3,2,3) -ax3.imshow(mvo[1]) -ax4 = fig.add_subplot(3,2,4) -ax4.imshow(ooo[1]) -ax5 = fig.add_subplot(3,2,5) -ax5.imshow(mvo[2]) -ax6 = fig.add_subplot(3,2,6) -ax6.imshow(ooo[2]) -fig.show() - +mr.init_model_det() +mr.init_model_clip() # %% - - -raw_vec_out -mean_vec_out - -# %% -file_to_score = "/home/thebears/source/ml_code/short.mp4" -vec_file = '/home/thebears/source/ml_code/short.npz' -out = np.load(vec_file) - -mean_vec_path = '/home/thebears/source/ml_code/as_np_mean.npy' -mean_vec_out = np.load(mean_vec_path) - -raw_vec_path = '/home/thebears/source/ml_code/as_np_raw.npy' -raw_vec_out = np.load(raw_vec_path) - -saved_fr = list(out['frame_numbers']) -saved_emb = out['embeds'] -import numpy as np - - - -def get_video_info(file_path): - file_info = MediaInfo.parse(file_path) - video_info = None - frame_count = 0 - if len(file_info.video_tracks) > 0: video_info = file_info.video_tracks[0] - - video_info.frame_count = int(video_info.frame_count) - return video_info - - -video_info = get_video_info(file_to_score) -vid_decoder = "h264parse" -if video_info.format.lower() == "HEVC".lower(): - vid_decoder = "h265parse" - - -gst_cmd = "filesrc location={file_to_score} ! qtdemux name=demux demux.video_0 ! queue ! {vid_decoder} ! nvv4l2decoder ! nvvidconv ! videoscale method=1 add-borders=false ! video/x-raw,width=1280,height=1280 ! appsink sync=false".format( - file_to_score=file_to_score, vid_decoder=vid_decoder -) - -# gst_cmd = "filesrc location={file_to_score} ! qtdemux name=demux demux.video_0 ! queue ! {vid_decoder} ! nvv4l2decoder ! nvvidconv ! videoscale method=1 add-borders=false ! appsink sync=false".format(file_to_score=file_to_score, vid_decoder=vid_decoder) - -cap_handle = cv2.VideoCapture(gst_cmd, cv2.CAP_GSTREAMER) - -target_max = det_imgsz -vid_h = video_info.height -vid_w = video_info.width - -if vid_h > vid_w: - target_h = target_max - target_w = target_max * vid_w / vid_h -elif vid_h == vid_w: - target_h = target_max - target_w = target_max -elif vid_h < vid_w: - target_h = target_max * vid_h / vid_w - target_w = target_max - -target_h = int(target_h) -target_w = int(target_w) - -pad_amt = [None, None, None, None] -if target_w % det_stride != 0: - off = det_stride - target_w % det_stride - new_w = target_w + off - pad_diff = new_w - target_w - pad_left = round(pad_diff / 2) - pad_right = pad_diff - pad_left - pad_amt[0] = pad_left - pad_amt[2] = pad_right -else: - pad_amt[0] = 0 - pad_amt[2] = 0 - -if target_h % det_stride != 0: - off = det_stride - target_h % det_stride - new_h = target_h + off - pad_diff = new_h - target_h - pad_up = round(pad_diff / 2) - pad_down = pad_diff - pad_up - pad_amt[1] = pad_up - pad_amt[3] = pad_down -else: - pad_amt[1] = 0 - pad_amt[3] = 0 - - -det_vid_preprocess = transforms.Compose( - [transforms.Resize((target_h, target_w)), transforms.Pad(pad_amt, fill=127)] -) - -batch_size = 6 -clip_interval = 10 -array_score = list() -final_output = dict() -final_output["start_score_time"] = time.time() -final_output["num_frames"] = video_info.frame_count -st = time.time() -frame_numbers = list() -det_results = list() -clip_results = list() - -clip_array = list() - -for i in range(video_info.frame_count): - success, frame_matrix = cap_handle.read() - - clip_array.append((i, frame_matrix)) - - if not success: - break - - - array_score.append((i, frame_matrix)) - - if len(array_score) >= batch_size: - score_result = score_frames(array_score) - - - det_results.extend(score_result["det"]) - clip_results.extend(score_result["clip"]) - frame_numbers.extend(score_result["fr#"]) - array_score = list() - - if not (i % clip_interval): - print('do_clip') - -if len(array_score) > 0: - score_result = score_frames(array_score) - det_results.extend(score_result["det"]) - clip_results.extend(score_result["clip"]) - frame_numbers.extend(score_result["fr#"]) - -cap_handle.release() -et = time.time() - -final_output["end_score_time"] = time.time() -final_output["video"] = { - "w": vid_w, - "h": vid_h, - "path": file_to_score, - "target_w": target_w, - "target_h": target_h, - "pad_amt": pad_amt, -} - -try: - final_output['scoring_fps'] = final_output['num_frames']/ (final_output['end_score_time'] - final_output['start_score_time']) -except Exception as e: - pass - -final_output['scores'] = list() - -for frame_number, frame in zip(frame_numbers, det_results): - cframe_dict = dict() - cframe_dict['frame'] = frame_number - cframe_dict['score_number'] = frame_number - cframe_dict['detections'] = list() - - for det in frame: - data = dict() - data['coords'] = [float(x) for x in list(det[0:4])] - data['score'] = float(det[4]) - data['idx'] = int(det[5]) - - try: - data['name'] = det_labels[data['idx']] - except: - data['name'] = 'Code failed' - - cframe_dict['detections'].append(data) - - final_output['scores'].append(cframe_dict) +scored_results = mr.score_video('/home/thebears/source/ml_code/short.mp4') +print(scored_results) diff --git a/model_runner.py b/model_runner.py new file mode 100644 index 0000000..b441528 --- /dev/null +++ b/model_runner.py @@ -0,0 +1,310 @@ +import sys + +sys.path.insert(0, "/home/thebears/source/models/yolov7") +import time +import base64 as b64 +from datetime import datetime +import cv2 +import numpy as np +import json +from pymediainfo import MediaInfo +import inspect +import open_clip +import sys +import torch +import yaml +from models.experimental import attempt_load +from utils.general import check_img_size, non_max_suppression +from torchvision import transforms +import torch.nn.functional as F +import os +device = torch.device("cuda") + + +# %% +class ModelRunner: + def __init__(self): + self.pretrained_name = "webli" + self.model_name = "ViT-SO400M-16-SigLIP2-512" + self.det_root_path = "/home/thebears/source/model_weights" + + def init_model_clip(self): + if hasattr(self, 'clip_preprocess'): + return + + + model_name = self.model_name + pretrained_name = self.pretrained_name + + clip_model, _, clip_preprocess_og = open_clip.create_model_and_transforms( + model_name, pretrained=pretrained_name + ) + tokenizer = open_clip.get_tokenizer("hf-hub:timm/" + model_name) + clip_model = clip_model.half().to(device) + clip_dtype = next(clip_model.parameters()).dtype + clip_img_size = clip_preprocess_og.transforms[0].size + clip_model.encode_image( + torch.rand(1, 3, *clip_img_size, dtype=clip_dtype, device=device)) + clip_preprocess = transforms.Compose( + [clip_preprocess_og.transforms[x] for x in [0, 3]] + ) + self.clip_model = clip_model + self.clip_preprocess_og = clip_preprocess_og + self.clip_tokenizer = tokenizer + self.clip_dtype = clip_dtype + self.clip_img_size = clip_img_size + self.clip_preprocess = clip_preprocess + + def init_model_det(self): + if hasattr(self, 'det_model'): + return + + det_root_path = self.det_root_path + det_model_weights_root = os.path.join(det_root_path, "yolov7") + det_model_weights_path = os.path.join(det_model_weights_root, "best.pt") + det_data_yaml_path = os.path.join(det_model_weights_root, "inaturalist.yaml") + det_model = attempt_load(det_model_weights_path, map_location=device) + det_model = det_model.half().to(device) + + det_dtype = next(det_model.parameters()).dtype + det_imgsz = 1280 + det_stride = int(det_model.stride.max()) + det_imgsz = check_img_size(det_imgsz, s=det_stride) + _ = det_model( + torch.zeros(1, 3, det_imgsz, det_imgsz, dtype=det_dtype).to(device) + ) + + with open(det_data_yaml_path, "r") as ff: + det_model_info = yaml.safe_load(ff) + det_labels = det_model_info["names"] + + self.det_dtype = det_dtype + self.det_imgsz = det_imgsz + self.det_stride = det_stride + self.det_model_info = det_model_info + self.det_labels = det_labels + self.det_model = det_model + + def get_det_vid_preprocessor(self, vid_h, vid_w): + if not hasattr(self, "_det_vid_preprocessors"): + self._det_vid_preprocessors = dict() + self.curr_det_vid_preprocessor = None + dict_key = (vid_h, vid_w) + det_stride = self.det_stride + if dict_key in self._det_vid_preprocessors: + self.curr_det_vid_preprocessor = self._det_vid_preprocessors[dict_key] + return self.curr_det_vid_preprocessor + + target_max = self.det_imgsz + + if vid_h > vid_w: + target_h = target_max + target_w = target_max * vid_w / vid_h + elif vid_h == vid_w: + target_h = target_max + target_w = target_max + elif vid_h < vid_w: + target_h = target_max * vid_h / vid_w + target_w = target_max + + target_h = int(target_h) + target_w = int(target_w) + + pad_amt = [None, None, None, None] + if target_w % det_stride != 0: + off = det_stride - target_w % det_stride + new_w = target_w + off + pad_diff = new_w - target_w + pad_left = round(pad_diff / 2) + pad_right = pad_diff - pad_left + pad_amt[0] = pad_left + pad_amt[2] = pad_right + else: + pad_amt[0] = 0 + pad_amt[2] = 0 + + if target_h % det_stride != 0: + off = det_stride - target_h % det_stride + new_h = target_h + off + pad_diff = new_h - target_h + pad_up = round(pad_diff / 2) + pad_down = pad_diff - pad_up + pad_amt[1] = pad_up + pad_amt[3] = pad_down + else: + pad_amt[1] = 0 + pad_amt[3] = 0 + + det_vid_preprocess = transforms.Compose( + [transforms.Resize((target_h, target_w)), transforms.Pad(pad_amt, fill=127)] + ) + + self.target_h = target_h + self.target_w = target_w + self.pad_amt = pad_amt + + self._det_vid_preprocessors[dict_key] = det_vid_preprocess + self.curr_det_vid_preprocessor = self._det_vid_preprocessors[dict_key] + return self.curr_det_vid_preprocessor + + def score_frames_det(self, array_score, det_vid_preprocess=None): + det_model = self.det_model + if det_vid_preprocess is None: + det_vid_preprocess = self.curr_det_vid_preprocessor + + frame_numbers = [x[0] for x in array_score] + frame_values = [x[1] for x in array_score] + frame_as_tensor = ( + torch.from_numpy(np.stack(frame_values)[:, :, :, 0:3]) + .to(torch.float16) + .to(device) + .permute([0, 3, 1, 2]) + ) + + with torch.no_grad(): + frame_for_model = det_vid_preprocess(frame_as_tensor).div(255)[ + :, [2, 1, 0], :, : + ] + det_preds = det_model(frame_for_model)[0] + det_pred_post_nms = non_max_suppression(det_preds, 0.25, 0.5) + det_cpu_pred = [x.detach().cpu().numpy() for x in det_pred_post_nms] + + return {"det": det_cpu_pred, "fr#": frame_numbers} + + def score_frames_clip(self, clip_array_score): + frame_numbers = [x[0] for x in clip_array_score] + frame_values = [x[1] for x in clip_array_score] + frame_as_tensor = ( + torch.from_numpy(np.stack(frame_values)[:, :, :, 0:3]) + .to(torch.float16) + .to(device) + .permute([0, 3, 1, 2]) + ) + + with torch.no_grad(): + frame_for_clip = self.clip_preprocess(frame_as_tensor[:, [0, 1, 2], :, :]) + clip_pred = self.clip_model.encode_image(frame_for_clip).detach().cpu().numpy() + + return {"clip": clip_pred, "fr#": frame_numbers} + + def get_video_info(self, file_path): + file_info = MediaInfo.parse(file_path) + video_info = None + frame_count = 0 + if len(file_info.video_tracks) > 0: + video_info = file_info.video_tracks[0] + + video_info.frame_count = int(video_info.frame_count) + return video_info + + def score_video(self, file_to_score, batch_size = 6, clip_interval = 10): + video_info = self.get_video_info(file_to_score) + vid_decoder = "h264parse" + if video_info.format.lower() == "HEVC".lower(): + vid_decoder = "h265parse" + + gst_cmd = "filesrc location={file_to_score} ! qtdemux name=demux demux.video_0 ! queue ! {vid_decoder} ! nvv4l2decoder ! nvvidconv ! videoscale method=1 add-borders=false ! video/x-raw,width=1280,height=1280 ! appsink sync=false".format( + file_to_score=file_to_score, vid_decoder=vid_decoder + ) + cap_handle = cv2.VideoCapture(gst_cmd, cv2.CAP_GSTREAMER) + vid_h = video_info.height + vid_w = video_info.width + + vid_preprocessor = self.get_det_vid_preprocessor(vid_h, vid_w) + target_w = self.target_w + target_h = self.target_h + pad_amt = self.pad_amt + + + array_score = list() + final_output = dict() + final_output["start_score_time"] = time.time() + final_output["num_frames"] = video_info.frame_count + st = time.time() + frame_numbers = list() + det_results = list() + clip_results = list() + clip_frame_numbers = list() + + clip_array = list() + + for i in range(video_info.frame_count): + success, frame_matrix = cap_handle.read() + + if not success: + break + + array_score.append((i, frame_matrix)) + + if len(array_score) >= batch_size: + score_result = self.score_frames_det(array_score, det_vid_preprocess = vid_preprocessor) + det_results.extend(score_result["det"]) + frame_numbers.extend(score_result["fr#"]) + array_score = list() + + if not (i % clip_interval): + clip_score_result = self.score_frames_clip([(i, frame_matrix)]) + clip_results.extend(clip_score_result["clip"]) + clip_frame_numbers.extend(clip_score_result["fr#"]) + + + if len(array_score) > 0: + score_result = self.score_frames_det(array_score, det_vid_preprocess = vid_preprocessor) + det_results.extend(score_result["det"]) + frame_numbers.extend(score_result["fr#"]) + + cap_handle.release() + + + final_output["end_score_time"] = time.time() + final_output["video"] = { + "w": vid_w, + "h": vid_h, + "path": file_to_score, + "target_w": target_w, + "target_h": target_h, + "pad_amt": pad_amt, + } + + try: + final_output["scoring_fps"] = final_output["num_frames"] / ( + final_output["end_score_time"] - final_output["start_score_time"] + ) + except Exception as e: + pass + + final_output["scores"] = list() + + + clip_results_as_np = np.asarray(clip_results) + + for frame_number, frame in zip(frame_numbers, det_results): + cframe_dict = dict() + cframe_dict["frame"] = frame_number + cframe_dict["detections"] = list() + + for det in frame: + data = dict() + data["coords"] = [float(x) for x in list(det[0:4])] + data["score"] = float(det[4]) + data["idx"] = int(det[5]) + + try: + data["name"] = det_labels[data["idx"]] + except: + data["name"] = "Code failed" + + cframe_dict["detections"].append(data) + + final_output["scores"].append(cframe_dict) + + emb_dict = dict() + + emb_dict["frame_numbers"] = clip_frame_numbers + emb_dict["array_size"] = clip_results_as_np.shape + emb_dict["array_dtype"] = str(clip_results_as_np.dtype) + emb_dict["array_binary"] = b64.b64encode(clip_results_as_np).decode() + + final_output["embeds"] = emb_dict + + return final_output