Conversation
|
On @fpjentzsch suggestion moved our frontend to use Pydantic. There are still some bits that need fixing, but it does start normally. We can simply and read from and assign to settings and it gets saved into the environment directly as well. Also simplifies our main |
|
@fpjentzsch I fixed several issues. The PR is ready for merging. I had the thought of making @LinusJungemann I am unsure, but I think the Builder Config Documentation Check might be broken, atleast it doesn't list the undocumented fields (I didn't add any either), and it fails with a syntax error on the match clause (Python version too old?) Edit: Actually providing a settings singleton (and some nicer output along the way) might be possible. Ill see the next weeks if its doable. |
… run as deprecated
…inn check command
…us into finn_settings_rework
…us into finn_settings_rework
|
📋 Docstring Check Report ❌ Docstring check failed! Missing Docstrings Details:📄 src/finn/custom_op/fpgadataflow/hls/elementwise_binary_hls.py:
📄 src/finn/util/basic.py:
Total missing docstrings: 2 How to Fix:Please add docstrings to the missing functions, classes, and modules listed above. Docstring Guidelines:
Raw output from docstring checker |
During the last weeks when I had some time I worked on updating our frontend. @LinusJungemann had mentioned that we probably shouldn't hardcode the dependencies into the code, and I thought that the settings management was a bit difficult to understand.
With that in mind, and due to the several research topics that we are currently working on (that will need to be merged and configured), I reworked mainly the following things:
TODO
Implemented Features and Fixes
(Updated 03.11.25, 14.11.25, 19.11.25, 03-05.12.25, 05.01-13.01)
Settings
FINNSettings) that can be used like any other class and will automatically adjust environment variablesFINNSettings, replacing most uses ofos.environ[...]finn_depsinstead ofdepsdepsinsite-packages. This could potentially cause confusion with other packages and doesn't mark the directory belonging to FINN, thus the changefinn.util.settings.initialize_dummy_settings()to create a settings object with default values and a non-existing flow configdummy.yaml(which can be retrieved usingget_settings()as usual). In the future we might move this into the__init__.pyof all relevant sub-packages so that users (for example in the notebooks) don't have to call the helper function mentioned above anytime they want to do something with FINN outside the flow.Dependencies
external_dependencies.yaml. This can be configured in settings and environment viaFINN_DEPS_DEFINITIONSfinn_xsiis part of the dependencies now, not requiring an extra setupDependencyManagernow,finn_xsistill needs to be loaded inprepare_finnto make sure it's available when skipping dependency updatesfinn deps updategot two more options:--accept-defaultsto accept missing settings files (explained below again)--forceto delete the dependency directory and freshly install all dependencies againCommands / Click
finn checkcommand. This simply starts the environment and exits. It does not update dependencies. This is useful to check paths and FINNs behaviour before starting a flow, or for testing.run_finn.py. Any click function is described by decorators that tell the name of the argument that they add to the function.finn configsubcommands for example)finn deps {edit,show}finn settings {create,edit,show}(and renamingfinn config)--accept-defaults)finn wizard settingsorfinn settings createfinn wizard flowDataflowOutputTypes, so you never accidentally forget themmodel_path. This way it's possible to runfinn build cfg.yamlfinn autotries to run FINN by automatically finding a flow config and a model. It searches for{cfg,config}.{yaml,yml,json}andmodel.onnxprimarily, but if one isnt found defaults to the first available .yaml/yml/json/onnx fileconfig.yamlandmodel.onnxin the same directory, simply runningfinn autowill find these and start FINN. Note however, that this command does not have any of the other configuration options. If no settings are found this will also automatically start the setup wizard as well.Tests
finn test --variant custom --name <name>, where name can be a test specification in pytest syntax (liketest_dir/complex_tests.py::ComplexTest::test_function, etc.)finn test -v doctest --name finn.transformation.fpgadataflow.mymodulebuild_dataflow_directory, since the function itself is removed as wellfinn test, the main functions setsFINN_SETTINGSto the given file so that the tests receive these settings as wellOther
XILINX_LOCAL_USER_DATA=nois set automatically, unless a value is already set for this variable. If it does not exist or is set to a different value thanno, a warning is emitted.--batchparameter. This disables the wizards, forces default values if no settings were found and disables interactive / live displaysoutput_dir: ~in the flow config, a directory namedNonewould be placed in~. This is fixed nowBackwards Compatibility
No:
finncan now start the wizards when some files are missing (and you have to specifically pass--accept-defaultsto avoid this), some automated scripts might break.finn depsandfinn configcommands were renamedIn the future, we'll remove the flow config from the settings, but this will be a new PR.
Patch Notes Style Summary
Commands
finn checkStart FINN to check that the environment is configured properlyfinn deps {edit,show}finn deps update--accept-defaultsStart even if settings files are missing--forceDelete all dependencies and re-download them->finn configfinn settings {create,edit,show}Create a new config (wizard), edit the current one, show the current onefinn wizard {config,flow}Start the wizard for settings / flow creationfinn build <config>Does not require a model, if given by themodel_pathfield in the flow configfinn autoTries to search for config and model and start a build flow. (Looks for{cfg,config}.{yaml,yml,json}andmodel.onnx)finn test --variant custom --name <pytest-specification>Start a single test from the suite with the given name, marker, filename, etc.finn test --variant doctest --name <module path>Run all doctests of the given module/package--batchoption to disable interactive displays and wizardsSettings
FINNSettingsfinn.util.settings.get_settings()finn.util.settings.initialize_dummy_settings()first to create a blank gloabal settings objectDependencies
DependencyManagernew class to handle everything regarding dependenciesexternal_dependencies.yamlOther
model_pathso that FINN can be started with the config aloneDataflowBuildConfigmember namesDataflowOutputTypes are used as an output productfinn settingscommandsrun_finn.pyslightlybuild_dataflow.pyoutput_dir: ~would lead to creation of aNonedirectory in the users homeXILINX_LOCAL_USER_DATA=nogets set automatically. Can be disabled by overwriting the variable before starting FINN.