AI Slop Code RIsk Monitor

Unity-Technologies/ml-agents

The Unity Machine Learning Agents Toolkit (ML-Agents) is an open-source project that enables games and simulations to serve as environments for training intelligent agents using deep reinforcement learning and imitation learning.

8.4 Moderate pattern signal View on GitHub

Maintenance and Governance Review

This report summarizes scanner evidence for Unity-Technologies/ml-agents, a C# project with 19,731 GitHub stars. SynthScan examined 110,425 lines of code across 789 source files, recording 677 pattern matches distributed across 20 syntactic categories. The legacy adjusted pattern signal is 8.4 (Moderate pattern signal); it is not an authorship estimate.

Use the findings to ask whether maintainers can explain intent, verify dependencies, simplify unnecessary scaffolding, and focus review effort. Risk Payload v1 adds ownership, supply-chain, over-engineering, and review-effort vectors when available. These are prompts for human verification, not probabilities, security findings, or measured maintenance costs.

8.4
Adjusted Signal
8.4
Raw Pattern Score
100%
Time Factor
2026-10-07
Last Push
19.7K
Stars
C#
Language
110.4K
Lines of Code
789
Files
677
Pattern Hits
2026-10-12
Scan Date
0.06
HC Hit Rate

Risk Review · v3

Use each vector to guide manual verification of the underlying findings.

Cognitive Ownership Risk 23.3/100 · LOW

Can maintainers explain intent, assumptions, and trade-offs? 550 finding(s).

Hallucinated Dependency & Supply Chain Risk 2.9/100 · LOW

Are imports declared and package/API names verified? 35 finding(s).

Agent Over-Engineering Ratio 21.2/100 · LOW

Are wrappers, guards, and repeated structures necessary? 343 finding(s).

PR Review Velocity Impact 35.6/100 · MEDIUM

Which changes need focused human review? 677 finding(s).

What These Metrics Mean

Adjusted Signal
Legacy pattern score normalized per 1,000 scanned lines and multiplied by the repository-level time factor. It is not an estimate of AI authorship.
Raw Pattern Score
Sum of severity- and context-weighted pattern findings before applying the time factor.
Time Factor
A coarse multiplier based on repository last-push metadata. It does not identify when individual code was written.
Pattern Hits
Count of configured pattern findings. Review each location and surrounding code before acting.
HC Hit Rate
High- and critical-severity findings per scanned file. Severity is a configured detector weight, not proof of a vulnerability or authorship.
Lines / Files
Scan coverage denominators used by the legacy normalized score.

Pattern-Signal History

This chart tracks the legacy adjusted pattern score across scan runs. Changes can reflect source changes, scan coverage, or detector/scoring versions; they do not measure AI adoption or prove that a team refactored code. Compare runs only when their scoring versions are compatible. The dashed line tracks the raw pattern-hit count.

Severity Breakdown

Groups findings by configured severity weight. Severity is not a confidence estimate, security rating, or proof that a package is missing. Verify imports against the project's manifests and inspect each finding in its local design context.

CRITICAL 3HIGH 46MEDIUM 19LOW 609

Directory Score Breakdown

This horizontal bar chart shows where configured pattern scores accumulate across directories. Treat the bars as locations to inspect, not as evidence of authorship or code quality. Use the file-level findings to decide whether a directory needs a focused ownership, dependency, complexity, or review check.

Pattern Findings

The scanner identified 677 distinct pattern matches across 20 syntactic categories. Each entry below represents a discrete location in the source code where the engine recorded a detector match to inspect in context. Expand any category row to inspect the individual file paths, line numbers, code snippets, and the lexical context (CODE, COMMENT, or STRING) in which each match was detected.

Reading the findings table: The Severity column indicates the configured finding weight (CRITICAL / HIGH / MEDIUM / LOW). The Context column identifies whether the match occurred inside executable code, an inline comment, or a string literal — legacy comment-context matches receive a ×1.5 score weight. The ⚡ bolt icon marks clustered matches: three or more patterns within a 10-line window, each receiving an additional ×1.5 density multiplier under the legacy scoring model.

Hyper-Verbose Identifiers240 hits · 241 pts
SeverityFileLineSnippetContext
LOWTools/ci/onboard.py74def update_template_variables(packages):CODE
LOWml-agents/tests/yamato/yamato_utils.py9def get_unity_executable_path():CODE
LOWml-agents/tests/yamato/yamato_utils.py209def override_legacy_config_file(python_version, src_path, dest_path, **kwargs):CODE
LOWml-agents/mlagents/plugins/trainer_type.py17def get_default_trainer_types() -> Tuple[Dict[str, Any], Dict[str, Any]]:CODE
LOWml-agents/mlagents/plugins/stats_writer.py13def get_default_stats_writers(run_options: RunOptions) -> List[StatsWriter]:CODE
LOWml-agents/mlagents/plugins/stats_writer.py32def register_stats_writer_plugins(run_options: RunOptions) -> List[StatsWriter]:CODE
LOWml-agents/mlagents/trainers/upgrade_config.py103def convert_samplers_and_curriculum(CODE
LOWml-agents/mlagents/trainers/subprocess_env_manager.py355 def _assert_worker_can_restart(self, worker_id: int, exception: Exception) -> None:CODE
LOWml-agents/mlagents/trainers/subprocess_env_manager.py376 def _worker_has_restart_quota(self, worker_id: int) -> bool:CODE
LOWml-agents/mlagents/trainers/subprocess_env_manager.py392 def _drop_old_restart_timestamps(self, worker_id: int) -> None:CODE
LOWml-agents/mlagents/trainers/directory_utils.py8def validate_existing_directories(CODE
LOWml-agents/mlagents/trainers/trainer_controller.py115 def _create_trainer_and_manager(CODE
LOWml-agents/mlagents/trainers/trainer_controller.py161 def _create_trainers_and_managers(CODE
LOWml-agents/mlagents/trainers/agent_processor.py159 def _add_group_status_and_obs(CODE
LOWml-agents/mlagents/trainers/agent_processor.py198 def _clear_group_status_and_obs(self, global_id: GlobalAgentId) -> None:CODE
LOWml-agents/mlagents/trainers/stats.py251 def _maybe_create_summary_writer(self, category: str) -> None:CODE
LOWml-agents/mlagents/trainers/learn.py175def create_environment_factory(CODE
LOWml-agents/mlagents/trainers/settings.py48def check_hyperparam_schedules(val: Dict, trainer_type: str) -> Dict:CODE
LOWml-agents/mlagents/trainers/settings.py622 def _set_default_hyperparameters(self):CODE
LOWml-agents/mlagents/trainers/settings.py626 def _set_default_checkpoint_interval(self):CODE
LOWml-agents/mlagents/trainers/settings.py649 def _check_batch_size_seq_length(self, attribute, value):CODE
LOW…s/mlagents/trainers/training_analytics_side_channel.py136 def _sanitize_trainer_settings(cls, config: TrainerSettings) -> Dict[str, Any]:CODE
LOW…s/mlagents/trainers/training_analytics_side_channel.py178 def _behavior_uses_curriculum(self, behavior_name: str) -> bool:CODE
LOW…nts/mlagents/trainers/environment_parameter_manager.py62 def get_minimum_reward_buffer_size(self, behavior_name: str) -> int:CODE
LOW…nts/mlagents/trainers/environment_parameter_manager.py94 def get_current_lesson_number(self) -> Dict[str, int]:CODE
LOWml-agents/mlagents/trainers/sac/optimizer_torch.py40 def _reward_signal_steps_per_update_default(self):CODE
LOW…-agents/mlagents/trainers/optimizer/torch_optimizer.py141 def get_trajectory_value_estimates(CODE
LOWml-agents/mlagents/trainers/tests/test_rl_trainer.py202def test_update_buffer_append():CODE
LOWml-agents/mlagents/trainers/tests/test_rl_trainer.py236 def test_warning_group_reward(self):CODE
LOWml-agents/mlagents/trainers/tests/test_stats.py22def test_stat_reporter_add_summary_write():CODE
LOWml-agents/mlagents/trainers/tests/test_stats.py68def test_stat_reporter_property():CODE
LOWml-agents/mlagents/trainers/tests/test_stats.py114def test_agent_manager_stats_report(aggregation_type):CODE
LOWml-agents/mlagents/trainers/tests/test_stats.py134def test_tensorboard_writer_clear(tmp_path):CODE
LOWml-agents/mlagents/trainers/tests/test_stats.py157def test_tensorboard_writer_hidden_keys(mock_summary):CODE
LOWml-agents/mlagents/trainers/tests/test_stats.py181def test_gauge_stat_writer_sanitize():CODE
LOWml-agents/mlagents/trainers/tests/test_stats.py230 def test_selfplay_console_writer(self):CODE
LOWml-agents/mlagents/trainers/tests/test_demo_loader.py119def test_unsupported_version_raises_error(mock_get_demo_files):CODE
LOWml-agents/mlagents/trainers/tests/test_rpc_utils.py35def generate_list_agent_proto(CODE
LOWml-agents/mlagents/trainers/tests/test_rpc_utils.py88def generate_compressed_proto_obs(CODE
LOWml-agents/mlagents/trainers/tests/test_rpc_utils.py104def generate_compressed_proto_obs_with_mapping(CODE
LOWml-agents/mlagents/trainers/tests/test_rpc_utils.py123def generate_uncompressed_proto_obs(in_array: np.ndarray) -> ObservationProto:CODE
LOWml-agents/mlagents/trainers/tests/test_rpc_utils.py205def proto_from_steps_and_action(CODE
LOWml-agents/mlagents/trainers/tests/test_rpc_utils.py245def test_process_pixels_multi_png():CODE
LOWml-agents/mlagents/trainers/tests/test_rpc_utils.py279def test_process_visual_observation():CODE
LOWml-agents/mlagents/trainers/tests/test_rpc_utils.py301def test_process_visual_observation_grayscale():CODE
LOWml-agents/mlagents/trainers/tests/test_rpc_utils.py325def test_process_visual_observation_padded_channels():CODE
LOWml-agents/mlagents/trainers/tests/test_rpc_utils.py344def test_process_visual_observation_bad_shape():CODE
LOWml-agents/mlagents/trainers/tests/test_rpc_utils.py358def test_batched_step_result_from_proto():CODE
LOWml-agents/mlagents/trainers/tests/test_rpc_utils.py388def test_mismatch_observations_raise_in_step_result_from_proto():CODE
LOWml-agents/mlagents/trainers/tests/test_rpc_utils.py402def test_action_masking_discrete():CODE
LOWml-agents/mlagents/trainers/tests/test_rpc_utils.py453def test_action_masking_continuous():CODE
LOWml-agents/mlagents/trainers/tests/test_rpc_utils.py465def test_agent_behavior_spec_from_proto():CODE
LOWml-agents/mlagents/trainers/tests/test_rpc_utils.py485def test_batched_step_result_from_proto_raises_on_infinite():CODE
LOWml-agents/mlagents/trainers/tests/test_rpc_utils.py496def test_batched_step_result_from_proto_raises_on_nan():CODE
LOW…nts/mlagents/trainers/tests/test_trainer_controller.py43def trainer_controller_with_start_learning_mocks(basic_trainer_controller):CODE
LOW…nts/mlagents/trainers/tests/test_trainer_controller.py73def test_start_learning_trains_forever_if_no_train_model(CODE
LOW…nts/mlagents/trainers/tests/test_trainer_controller.py90def test_start_learning_trains_until_max_steps_then_saves(CODE
LOW…nts/mlagents/trainers/tests/test_trainer_controller.py108def trainer_controller_with_take_step_mocks(basic_trainer_controller):CODE
LOW…nts/mlagents/trainers/tests/test_trainer_controller.py122def test_advance_adds_experiences_to_trainer_and_trains(CODE
LOW…trainers/tests/test_training_analytics_side_channel.py36def test_sanitize_run_options():STRING
180 more matches not shown…
Over-Commented Block208 hits · 198 pts
SeverityFileLineSnippetContext
LOW.yamato/sonar-python-package.yml1#csharp:COMMENT
LOW.yamato/com.unity.ml-agents-performance.yml1#disabling mac perf tests until utr issue is resolved.COMMENT
LOW.yamato/com.unity.ml-agents-performance.yml21# cancel_old_ci: trueCOMMENT
LOW.yamato/wrench/player-test.yml1#######################################################COMMENT
LOW.yamato/wrench/player-build.yml1#######################################################COMMENT
LOW…ents.tests/Tests/Runtime/Input/TestPushBlockActions.cs1#if MLA_INPUT_TESTSCOMMENT
LOW…ents.tests/Tests/Runtime/Sensor/GridSensorTestUtils.cs21 }COMMENT
LOW…ents.tests/Tests/Runtime/Sensor/GridSensorTestUtils.cs41 /// Which will make the total array will be the flattened arrayCOMMENT
LOW…Agents/Examples/PushBlock/Scripts/PushBlockSettings.cs1using UnityEngine;COMMENT
LOW…ssets/ML-Agents/Examples/Match3/Scripts/Match3Agent.cs1using System;COMMENT
LOW…ssets/ML-Agents/Examples/Match3/Scripts/Match3Agent.cs21 /// | |COMMENT
LOW…ssets/ML-Agents/Examples/Match3/Scripts/Match3Agent.cs41 FindMatches = 0,COMMENT
LOW…ets/ML-Agents/Examples/SharedAssets/Scripts/Monitor.cs1using System.Collections.Generic;COMMENT
LOW…ets/ML-Agents/Examples/SharedAssets/Scripts/Monitor.cs201 }COMMENT
LOW…ts/Examples/SharedAssets/Scripts/CollisionCallbacks.cs1using UnityEngine;COMMENT
LOW…ts/Examples/SharedAssets/Scripts/CollisionCallbacks.cs21 [Header("Collider Tag To Detect")]COMMENT
LOW…ts/Examples/SharedAssets/Scripts/CollisionCallbacks.cs61 // if (respawnIfTouched)COMMENT
LOW…ts/Examples/SharedAssets/Scripts/CollisionCallbacks.cs81 // /// </summary>COMMENT
LOW…Agents/Examples/SharedAssets/Scripts/ModelOverrider.cs281 return null;COMMENT
LOW…Agents/Examples/SharedAssets/Scripts/ModelOverrider.cs301COMMENT
LOW…Agents/Examples/SharedAssets/Scripts/ModelOverrider.cs321 // assetData.value = descStream.ToArray();COMMENT
LOW…Agents/Examples/SharedAssets/Scripts/ModelOverrider.cs341 //COMMENT
LOW…xamples/PushBlockWithInput/Scripts/PushBlockActions.cs1//------------------------------------------------------------------------------COMMENT
LOW…xamples/PushBlockWithInput/Scripts/PushBlockActions.cs21/// <remarks>COMMENT
LOW…xamples/PushBlockWithInput/Scripts/PushBlockActions.cs41///COMMENT
LOW…xamples/PushBlockWithInput/Scripts/PushBlockActions.cs61/// {COMMENT
LOW…xamples/PushBlockWithInput/Scripts/PushBlockActions.cs361COMMENT
LOW…xamples/PushBlockWithInput/Scripts/PushBlockActions.cs381 public void Disable() { Get().Disable(); }COMMENT
LOW…xamples/PushBlockWithInput/Scripts/PushBlockActions.cs481 /// <seealso cref="UnityEngine.InputSystem.InputAction.canceled" />COMMENT
LOW…shBlockWithInput/Scripts/PushBlockWithInputSettings.cs21 /// The spawn area margin multiplier.COMMENT
LOW…ithInput/Scripts/PushBlockWithInputPlayerController.cs1using Unity.MLAgents.Input;COMMENT
LOWml-agents-envs/mlagents_envs/environment.py61 # Revision history:COMMENT
LOWml-agents-envs/tests/simple_test_envs.py221 # new_vector_obs = self._make_obs(self.goal[name])COMMENT
LOWcom.unity.ml-agents/Runtime/InplaceArray.cs201 }COMMENT
LOWcom.unity.ml-agents/Runtime/Timer.cs21 const double k_TicksToSeconds = 1e-7; // 100 ns per tickCOMMENT
LOWcom.unity.ml-agents/Runtime/Timer.cs41 /// Number of total ticks elapsed for this node.COMMENT
LOWcom.unity.ml-agents/Runtime/Timer.cs301 /// The largest value that has been seen for the gauge since it was created.COMMENT
LOWcom.unity.ml-agents/Runtime/Timer.cs341 weightedAverage = (k_SmoothingFactor * newValue) + ((1f - k_SmoothingFactor) * weightedAverage);COMMENT
LOWcom.unity.ml-agents/Runtime/Timer.cs361 /// doSomeMoreWork();COMMENT
LOWcom.unity.ml-agents/Runtime/Academy.cs41 elseCOMMENT
LOWcom.unity.ml-agents/Runtime/Academy.cs61 /// fall back to inference or heuristic decisions. (You can also set agents to always useCOMMENT
LOWcom.unity.ml-agents/Runtime/Academy.cs81 /// </item>COMMENT
LOWcom.unity.ml-agents/Runtime/Academy.cs121 /// </summary>COMMENT
LOWcom.unity.ml-agents/Runtime/Academy.cs201 // that all the agents perform their steps in a consistent order (i.e. noCOMMENT
LOWcom.unity.ml-agents/Runtime/SimpleMultiAgentGroup.cs61 {COMMENT
LOWcom.unity.ml-agents/Runtime/SimpleMultiAgentGroup.cs81 public void AddGroupReward(float reward)COMMENT
LOWcom.unity.ml-agents/Runtime/SimpleMultiAgentGroup.cs101 /// Group rewards are treated differently than individual agent rewards during training, soCOMMENT
LOWcom.unity.ml-agents/Runtime/EnvironmentParameters.cs1using System;COMMENT
LOWcom.unity.ml-agents/Runtime/EnvironmentParameters.cs21COMMENT
LOWcom.unity.ml-agents/Runtime/EnvironmentParameters.cs41 return m_Channel.GetWithDefault(key, defaultValue);COMMENT
LOWcom.unity.ml-agents/Runtime/SensorHelper.cs1using Unity.InferenceEngine;COMMENT
LOWcom.unity.ml-agents/Runtime/StatsRecorder.cs1using Unity.MLAgents.SideChannels;COMMENT
LOWcom.unity.ml-agents/Runtime/StatsRecorder.cs21COMMENT
LOWcom.unity.ml-agents/Runtime/IMultiAgentGroup.cs1namespace Unity.MLAgentsCOMMENT
LOWcom.unity.ml-agents/Runtime/Agent.cs21 /// <summary>COMMENT
LOWcom.unity.ml-agents/Runtime/Agent.cs41COMMENT
LOWcom.unity.ml-agents/Runtime/Agent.cs101 { }COMMENT
LOWcom.unity.ml-agents/Runtime/Agent.cs121 ///COMMENT
LOWcom.unity.ml-agents/Runtime/Agent.cs141 /// making is used.COMMENT
LOWcom.unity.ml-agents/Runtime/Agent.cs161 /// environment -- by implementing the <see cref="OnEpisodeBegin"/> function. An agent alsoCOMMENT
148 more matches not shown…
Cross-File Repetition32 hits · 160 pts
SeverityFileLineSnippetContext
HIGHml-agents/mlagents/trainers/sac/trainer.py0responsible for collecting experiences and training a2c model. :param behavior_name: the name of the behavior associatedSTRING
HIGH…iner-plugin/mlagents_trainer_plugin/dqn/dqn_trainer.py0responsible for collecting experiences and training a2c model. :param behavior_name: the name of the behavior associatedSTRING
HIGHml-agents/mlagents/trainers/ppo/trainer.py0responsible for collecting experiences and training a2c model. :param behavior_name: the name of the behavior associatedSTRING
HIGHml-agents/mlagents/trainers/poca/trainer.py0responsible for collecting experiences and training a2c model. :param behavior_name: the name of the behavior associatedSTRING
HIGH…-agents/mlagents/trainers/trainer/on_policy_trainer.py0responsible for collecting experiences and training a2c model. :param behavior_name: the name of the behavior associatedSTRING
HIGH…agents/mlagents/trainers/trainer/off_policy_trainer.py0responsible for collecting experiences and training a2c model. :param behavior_name: the name of the behavior associatedSTRING
HIGH…iner-plugin/mlagents_trainer_plugin/a2c/a2c_trainer.py0responsible for collecting experiences and training a2c model. :param behavior_name: the name of the behavior associatedSTRING
HIGHml-agents/mlagents/trainers/sac/trainer.py0creates a policy with a pytorch backend and poca hyperparameters :param parsed_behavior_id: :param behavior_spec: specifSTRING
HIGHml-agents/mlagents/trainers/ppo/trainer.py0creates a policy with a pytorch backend and poca hyperparameters :param parsed_behavior_id: :param behavior_spec: specifSTRING
HIGH…iner-plugin/mlagents_trainer_plugin/a2c/a2c_trainer.py0creates a policy with a pytorch backend and poca hyperparameters :param parsed_behavior_id: :param behavior_spec: specifSTRING
HIGHml-agents/mlagents/trainers/poca/trainer.py0creates a policy with a pytorch backend and poca hyperparameters :param parsed_behavior_id: :param behavior_spec: specifSTRING
HIGHml-agents/mlagents/trainers/sac/trainer.py0gets policy from trainer associated with name_behavior_id :param name_behavior_id: full identifier of policySTRING
HIGHml-agents/mlagents/trainers/ppo/trainer.py0gets policy from trainer associated with name_behavior_id :param name_behavior_id: full identifier of policySTRING
HIGHml-agents/mlagents/trainers/poca/trainer.py0gets policy from trainer associated with name_behavior_id :param name_behavior_id: full identifier of policySTRING
HIGHml-agents/mlagents/trainers/ppo/optimizer_torch.py0performs update on model. :param batch: batch of experiences. :param num_sequences: number of sequences to process. :retSTRING
HIGHml-agents/mlagents/trainers/poca/optimizer_torch.py0performs update on model. :param batch: batch of experiences. :param num_sequences: number of sequences to process. :retSTRING
HIGH…er-plugin/mlagents_trainer_plugin/dqn/dqn_optimizer.py0performs update on model. :param batch: batch of experiences. :param num_sequences: number of sequences to process. :retSTRING
HIGH…er-plugin/mlagents_trainer_plugin/a2c/a2c_optimizer.py0performs update on model. :param batch: batch of experiences. :param num_sequences: number of sequences to process. :retSTRING
HIGHml-agents/mlagents/trainers/ppo/trainer.py0takes a trajectory and processes it, putting it into the update buffer. processing involves calculating value and advantSTRING
HIGHml-agents/mlagents/trainers/poca/trainer.py0takes a trajectory and processes it, putting it into the update buffer. processing involves calculating value and advantSTRING
HIGH…iner-plugin/mlagents_trainer_plugin/a2c/a2c_trainer.py0takes a trajectory and processes it, putting it into the update buffer. processing involves calculating value and advantSTRING
HIGHml-agents/mlagents/trainers/poca/trainer.py0returns whether or not the trainer has enough elements to run update model :return: a boolean corresponding to wether orSTRING
HIGH…-agents/mlagents/trainers/trainer/on_policy_trainer.py0returns whether or not the trainer has enough elements to run update model :return: a boolean corresponding to wether orSTRING
HIGH…agents/mlagents/trainers/trainer/off_policy_trainer.py0returns whether or not the trainer has enough elements to run update model :return: a boolean corresponding to wether orSTRING
HIGHml-agents/mlagents/trainers/trainer/rl_trainer.py0returns whether or not the trainer has enough elements to run update model :return: a boolean corresponding to wether orSTRING
HIGHml-agents-envs/mlagents_envs/rpc_communicator.py0sends a shutdown signal to the unity environment, and closes the socket connection.STRING
HIGHml-agents-envs/mlagents_envs/mock_communicator.py0sends a shutdown signal to the unity environment, and closes the socket connection.STRING
HIGHml-agents-envs/mlagents_envs/communicator.py0sends a shutdown signal to the unity environment, and closes the socket connection.STRING
HIGHml-agents-envs/mlagents_envs/environment.py0sends a shutdown signal to the unity environment, and closes the socket connection.STRING
HIGH…s-envs/mlagents_envs/side_channel/raw_bytes_channel.py0is called by the environment to the side channel. can be called multiple times per step if multiple messages are meant fSTRING
HIGH…mlagents_envs/side_channel/float_properties_channel.py0is called by the environment to the side channel. can be called multiple times per step if multiple messages are meant fSTRING
HIGH…agents-envs/mlagents_envs/side_channel/side_channel.py0is called by the environment to the side channel. can be called multiple times per step if multiple messages are meant fSTRING
Empty Error Handlers13 hits · 65 pts
SeverityFileLineSnippetContext
HIGHml-agents/mlagents/torch_utils/torch.py19except PackageNotFoundError:CODE
HIGHml-agents/mlagents/trainers/subprocess_env_manager.py348except EmptyQueueException:CODE
HIGHml-agents/mlagents/trainers/subprocess_env_manager.py429except EmptyQueueException:CODE
HIGHml-agents/mlagents/trainers/subprocess_env_manager.py495except EmptyQueueException:CODE
HIGHml-agents/mlagents/trainers/trainer_controller.py280except Exception:CODE
HIGHml-agents/mlagents/trainers/agent_processor.py110except KeyError:CODE
HIGHml-agents/mlagents/trainers/buffer.py317except ValueError:CODE
HIGHml-agents/mlagents/trainers/buffer.py326except ValueError:CODE
HIGH…s/mlagents/trainers/tests/torch_entities/test_ghost.py53except AssertionError:CODE
HIGHml-agents/mlagents/trainers/ghost/trainer.py241except AgentManagerQueue.Empty:CODE
HIGHml-agents/mlagents/trainers/ghost/trainer.py250except AgentManagerQueue.Empty:CODE
HIGH…nts/mlagents/trainers/model_saver/torch_model_saver.py152except OSError:CODE
HIGHutils/validate_meta_files.py40except ValueError:CODE
Deep Nesting39 hits · 39 pts
SeverityFileLineSnippetContext
LOWTools/ci/onboard.py38CODE
LOWml-agents/tests/yamato/check_coverage_percent.py7CODE
LOWml-agents/tests/yamato/scripts/run_llapi.py9CODE
LOWml-agents/mlagents/trainers/upgrade_config.py17CODE
LOWml-agents/mlagents/trainers/upgrade_config.py103CODE
LOWml-agents/mlagents/trainers/subprocess_env_manager.py116CODE
LOWml-agents/mlagents/trainers/subprocess_env_manager.py330CODE
LOWml-agents/mlagents/trainers/subprocess_env_manager.py406CODE
LOWml-agents/mlagents/trainers/trajectory.py145CODE
LOWml-agents/mlagents/trainers/demo_loader.py105CODE
LOWml-agents/mlagents/trainers/demo_loader.py174CODE
LOWml-agents/mlagents/trainers/agent_processor.py90CODE
LOWml-agents/mlagents/trainers/agent_processor.py212CODE
LOWml-agents/mlagents/trainers/agent_processor.py441CODE
LOWml-agents/mlagents/trainers/settings.py671CODE
LOWml-agents/mlagents/trainers/settings.py894CODE
LOW…s/mlagents/trainers/training_analytics_side_channel.py54CODE
LOWml-agents/mlagents/trainers/simple_env_manager.py50CODE
LOW…nts/mlagents/trainers/environment_parameter_manager.py62CODE
LOW…nts/mlagents/trainers/environment_parameter_manager.py135CODE
LOWml-agents/mlagents/trainers/sac/optimizer_torch.py277CODE
LOWml-agents/mlagents/trainers/tests/simple_test_envs.py427CODE
LOWml-agents/mlagents/trainers/tests/simple_test_envs.py501CODE
LOWml-agents/mlagents/trainers/tests/test_settings.py45CODE
LOWml-agents/mlagents/trainers/ghost/trainer.py219CODE
LOWml-agents/mlagents/trainers/torch_entities/layers.py62CODE
LOW…nts/mlagents/trainers/model_saver/torch_model_saver.py85CODE
LOWml-agents/mlagents/trainers/trainer/rl_trainer.py278CODE
LOWutils/validate_release_links.py143CODE
LOWutils/validate_meta_files.py4CODE
LOWml-agents-envs/mlagents_envs/env_utils.py20CODE
LOWml-agents-envs/mlagents_envs/rpc_utils.py317CODE
LOWml-agents-envs/mlagents_envs/registry/binary_utils.py27CODE
LOWml-agents-envs/mlagents_envs/registry/binary_utils.py70CODE
LOW…s-envs/mlagents_envs/envs/unity_pettingzoo_base_env.py112CODE
LOW…s-envs/mlagents_envs/envs/unity_pettingzoo_base_env.py147CODE
LOWml-agents-envs/tests/simple_test_envs.py374CODE
LOWml-agents-envs/tests/simple_test_envs.py450CODE
LOWml-agents-envs/tests/test_timers.py12CODE
Modern Structural Boilerplate36 hits · 36 pts
SeverityFileLineSnippetContext
LOWml-agents/mlagents/torch_utils/torch.py42def set_torch_config(torch_settings: TorchSettings) -> None:CODE
LOWml-agents/mlagents/trainers/subprocess_env_manager.py449 def set_env_parameters(self, config: Dict = None) -> None:CODE
LOWml-agents/mlagents/trainers/env_manager.py45 def set_policy(self, brain_name: BehaviorName, policy: Policy) -> None:CODE
LOWml-agents/mlagents/trainers/env_manager.py72 def set_env_parameters(self, config: Dict = None) -> None:CODE
LOWml-agents/mlagents/trainers/training_status.py100 def set_parameter_state(category: str, key: StatusType, value: Any) -> None:CODE
LOWml-agents/mlagents/trainers/stats.py343 def set_stat(self, key: str, value: float) -> None:CODE
LOWml-agents/mlagents/trainers/settings.py738 def set_config_specified(self, require_config_specified: bool) -> None:CODE
LOWml-agents/mlagents/trainers/simple_env_manager.py50 def set_env_parameters(self, config: Dict = None) -> None:CODE
LOWml-agents/mlagents/trainers/torch_entities/encoders.py108 def update_normalization(self, inputs: torch.Tensor) -> None:CODE
LOWml-agents/mlagents/trainers/torch_entities/networks.py86 def update_normalization(self, buffer: AgentBuffer) -> None:CODE
LOWml-agents/mlagents/trainers/torch_entities/networks.py225 def update_normalization(self, buffer: AgentBuffer) -> None:CODE
LOWml-agents/mlagents/trainers/torch_entities/networks.py327 def update_normalization(self, buffer: AgentBuffer) -> None:CODE
LOWml-agents/mlagents/trainers/torch_entities/networks.py436 def update_normalization(self, buffer: AgentBuffer) -> None:CODE
LOWml-agents/mlagents/trainers/torch_entities/networks.py479 def update_normalization(self, buffer: AgentBuffer) -> None:CODE
LOWml-agents/mlagents/trainers/torch_entities/networks.py513 def update_normalization(self, buffer: AgentBuffer) -> None:CODE
LOWml-agents/mlagents/trainers/torch_entities/networks.py619 def update_normalization(self, buffer: AgentBuffer) -> None:CODE
LOWml-agents/mlagents/trainers/torch_entities/utils.py54 def update_learning_rate(optim: torch.optim.Optimizer, lr: float) -> None:CODE
LOWml-agents/mlagents/trainers/poca/optimizer_torch.py84 def update_normalization(self, buffer: AgentBuffer) -> None:CODE
LOW…agents/mlagents/trainers/trainer/off_policy_trainer.py237 def _update_reward_signals(self) -> None:CODE
LOWml-agents/mlagents/trainers/trainer/rl_trainer.py70 def _update_end_episode_stats(self, agent_id: str, optimizer: Optimizer) -> None:CODE
LOW…er-plugin/mlagents_trainer_plugin/dqn/dqn_optimizer.py210 def update_normalization(self, buffer: AgentBuffer) -> None:CODE
LOWutils/validate_versions.py94def set_package_version(new_version: str) -> None:STRING
LOWml-agents-envs/mlagents_envs/logging_util.py43def set_log_level(log_level: int) -> None:CODE
LOWml-agents-envs/mlagents_envs/logging_util.py60def _set_formatter_for_all_loggers(formatter: logging.Formatter) -> None:CODE
LOWml-agents-envs/mlagents_envs/base_env.py584 def set_actions(self, behavior_name: BehaviorName, action: ActionTuple) -> None:CODE
LOWml-agents-envs/mlagents_envs/environment.py287 def _update_behavior_specs(self, output: UnityOutputProto) -> None:CODE
LOWml-agents-envs/mlagents_envs/environment.py299 def _update_state(self, output: UnityRLOutputProto) -> None:CODE
LOWml-agents-envs/mlagents_envs/environment.py367 def set_actions(self, behavior_name: BehaviorName, action: ActionTuple) -> None:CODE
LOWml-agents-envs/mlagents_envs/timers.py226 def set_gauge(self, name: str, value: float) -> None:CODE
LOWml-agents-envs/mlagents_envs/timers.py313def set_gauge(name: str, value: float, timer_stack: TimerStack = None) -> None:CODE
LOW…ts-envs/mlagents_envs/side_channel/outgoing_message.py56 def set_raw_bytes(self, buffer: bytearray) -> None:CODE
LOW…ents_envs/side_channel/engine_configuration_channel.py123 def set_configuration(self, config: EngineConfig) -> None:CODE
LOW…mlagents_envs/side_channel/float_properties_channel.py29 def set_property(self, key: str, value: float) -> None:CODE
LOW…ts_envs/side_channel/environment_parameters_channel.py34 def set_float_parameter(self, key: str, value: float) -> None:CODE
LOW…s-envs/mlagents_envs/envs/unity_pettingzoo_base_env.py76 def _update_observation_spaces(self) -> None:CODE
LOW…s-envs/mlagents_envs/envs/unity_pettingzoo_base_env.py112 def _update_action_spaces(self) -> None:CODE
Hallucination Indicators3 hits · 30 pts
SeverityFileLineSnippetContext
CRITICAL…agents/Runtime/Grpc/CommunicatorObjects/Observation.cs350 FloatData = new global::Unity.MLAgents.CommunicatorObjects.ObservationProto.Types.FloatData();CODE
CRITICAL…agents/Runtime/Grpc/CommunicatorObjects/Observation.cs381 global::Unity.MLAgents.CommunicatorObjects.ObservationProto.Types.FloatData subBuilder = new global::Unity.MCODE
CRITICAL…s/Runtime/SideChannels/TrainingAnalyticsSideChannel.cs29 anyMessage = Google.Protobuf.WellKnownTypes.Any.Parser.ParseFrom(msg.GetRawBytes());CODE
Unused Imports29 hits · 29 pts
SeverityFileLineSnippetContext
LOWml-agents/mlagents/torch_utils/__init__.py1CODE
LOWml-agents/mlagents/torch_utils/__init__.py2CODE
LOWml-agents/mlagents/torch_utils/__init__.py3CODE
LOWml-agents/mlagents/torch_utils/__init__.py4CODE
LOWml-agents/mlagents/trainers/optimizer/__init__.py1CODE
LOW…ts/mlagents/trainers/tests/torch_entities/test_poca.py8CODE
LOW…nts/mlagents/trainers/tests/torch_entities/test_sac.py6CODE
LOW…torch_entities/components/reward_providers/__init__.py1CODE
LOW…torch_entities/components/reward_providers/__init__.py4CODE
LOW…torch_entities/components/reward_providers/__init__.py7CODE
LOW…torch_entities/components/reward_providers/__init__.py10CODE
LOW…torch_entities/components/reward_providers/__init__.py13CODE
LOW…torch_entities/components/reward_providers/__init__.py16CODE
LOWml-agents/mlagents/trainers/trainer/__init__.py1CODE
LOWml-agents/mlagents/trainers/trainer/__init__.py2CODE
LOWml-agents/mlagents/trainers/policy/__init__.py1CODE
LOW…envs/mlagents_envs/communicator_objects/command_pb2.py8CODE
LOW…envs/mlagents_envs/communicator_objects/command_pb2.py9CODE
LOW…s/mlagents_envs/communicator_objects/space_type_pb2.py8CODE
LOW…s/mlagents_envs/communicator_objects/space_type_pb2.py9CODE
LOW…nts_envs/communicator_objects/unity_to_external_pb2.py7CODE
LOW…nts_envs/communicator_objects/unity_to_external_pb2.py8CODE
LOW…nts_envs/communicator_objects/unity_to_external_pb2.py15CODE
LOWml-agents-envs/mlagents_envs/registry/__init__.py1CODE
LOWml-agents-envs/mlagents_envs/registry/__init__.py1CODE
LOWml-agents-envs/mlagents_envs/side_channel/__init__.py1CODE
LOWml-agents-envs/mlagents_envs/side_channel/__init__.py2CODE
LOWml-agents-envs/mlagents_envs/side_channel/__init__.py4CODE
LOWml-agents-envs/mlagents_envs/side_channel/__init__.py5CODE
Self-Referential Comments9 hits · 23 pts
SeverityFileLineSnippetContext
MEDIUMml-agents/mlagents/trainers/tests/test_demo_loader.py120 # Create a metadata proto with an unsupported versionCOMMENT
MEDIUMml-agents/mlagents/trainers/tests/__init__.py5 # This file is importer by pytest multiple times, but this breaks the patchingCOMMENT
MEDIUM…ents/mlagents/trainers/torch_entities/distributions.py131 # This function is equivalent to torch.diag(self.probs.T[value.flatten().long()]),COMMENT
MEDIUMml-agents/mlagents/trainers/model_saver/model_saver.py7 """This class is the base class for the ModelSaver"""STRING
MEDIUMml-agents/mlagents/trainers/ppo/optimizer_torch.py44 # Create the graph here to give more granular control of the TF graph to the Optimizer.COMMENT
MEDIUMml-agents/mlagents/trainers/poca/optimizer_torch.py163 # Create the graph here to give more granular control of the TF graph to the Optimizer.COMMENT
MEDIUMml-agents/mlagents/trainers/trainer/trainer.py20 """This class is the base class for the mlagents_envs.trainers"""STRING
MEDIUM…er-plugin/mlagents_trainer_plugin/a2c/a2c_optimizer.py49 # Create the graph here to give more granular control of the TF graph to the Optimizer.COMMENT
MEDIUM…nvs/communicator_objects/unity_to_external_pb2_grpc.py48 # This class is part of an EXPERIMENTAL API.COMMENT
Redundant / Tautological Comments12 hits · 18 pts
SeverityFileLineSnippetContext
LOWml-agents/mlagents/trainers/learn.py74 # Check if directory existsCOMMENT
LOWml-agents/mlagents/trainers/settings.py49 # Check if beta and epsilon are set. If not, set to match learning rate schedule.COMMENT
LOWml-agents/mlagents/trainers/settings.py605 # Assign team_change to about 4x save_stepsCOMMENT
LOWml-agents/mlagents/trainers/settings.py682 # Check if a default_settings was specified. If so, used those as the defaultCOMMENT
LOWml-agents/mlagents/trainers/sac/trainer.py94 # Check if we used group rewards, warn if so.COMMENT
LOW…nts/mlagents/trainers/tests/torch_entities/test_ppo.py180 # Check if buffer size is too bigCOMMENT
LOW…nts/mlagents/trainers/tests/torch_entities/test_ppo.py237 # Check if we ignore terminal states properlyCOMMENT
LOW…ts/mlagents/trainers/tests/torch_entities/test_poca.py182 # Check if we ignore terminal states properlyCOMMENT
LOW…ts/mlagents/trainers/tests/torch_entities/test_poca.py281 # Check if buffer size is too bigCOMMENT
LOWml-agents/mlagents/trainers/ppo/trainer.py78 # Check if we used group rewards, warn if so.COMMENT
LOW…iner-plugin/mlagents_trainer_plugin/dqn/dqn_trainer.py63 # Check if we used group rewards, warn if so.COMMENT
LOW…iner-plugin/mlagents_trainer_plugin/a2c/a2c_trainer.py76 # Check if we used group rewards, warn if so.COMMENT
Structural Annotation Overuse10 hits · 15 pts
SeverityFileLineSnippetContext
LOW⚡ml-agents/mlagents/utils/push_to_hf.py64 # Step 1: Read the config.jsonCOMMENT
LOW⚡ml-agents/mlagents/utils/push_to_hf.py72 # Step 2: Create the metadataCOMMENT
LOW⚡ml-agents/mlagents/utils/push_to_hf.py75 # Step 3: Generate the model cardCOMMENT
LOW⚡ml-agents/mlagents/utils/push_to_hf.py148 # Step 1: Create the repoSTRING
LOW⚡ml-agents/mlagents/utils/push_to_hf.py158 # Step 2: Create a config fileSTRING
LOW⚡ml-agents/mlagents/utils/push_to_hf.py161 # Step 3: Generate and save the model cardSTRING
LOW…gents/Documentation~/Tutorial-Custom-Trainer-Plugin.md5### Step 1: Write your custom trainer classCOMMENT
LOW…gents/Documentation~/Tutorial-Custom-Trainer-Plugin.md114### Step 2: implement your custom optimizer for the trainer.COMMENT
LOW…gents/Documentation~/Tutorial-Custom-Trainer-Plugin.md196### Step 3: Integrate your custom trainer into the plugin systemCOMMENT
LOW…gents/Documentation~/Tutorial-Custom-Trainer-Plugin.md239### Step 4: Install your custom trainer and run training:COMMENT
Excessive Try-Catch Wrapping11 hits · 14 pts
SeverityFileLineSnippetContext
MEDIUMml-agents/tests/yamato/training_int_tests.py156 print("Error running inference!")CODE
LOWml-agents/mlagents/trainers/subprocess_env_manager.py228 except Exception as ex:CODE
LOWml-agents/mlagents/trainers/trainer_controller.py88 except Exception:CODE
LOWml-agents/mlagents/trainers/trainer_controller.py280 except Exception:CODE
MEDIUMml-agents/mlagents/trainers/trainer_controller.py84def _create_output_path(output_path):CODE
LOWml-agents/mlagents/trainers/learn.py228 except Exception:CODE
LOWml-agents/mlagents/trainers/tests/test_torch_utils.py38 except Exception:CODE
MEDIUMml-agents/mlagents/trainers/tests/test_torch_utils.py21def test_set_torch_device(CODE
LOWml-agents-envs/mlagents_envs/rpc_communicator.py74 except Exception:CODE
LOW⚡ml-agents-envs/mlagents_envs/environment.py510 except Exception:CODE
LOWml-agents-envs/mlagents_envs/registry/binary_utils.py52 except Exception:CODE
Modern AI Meta-Vocabulary5 hits · 12 pts
SeverityFileLineSnippetContext
MEDIUMml-agents/mlagents/trainers/torch_entities/networks.py290 # Modules for multi-agent self-attentionCOMMENT
MEDIUMml-agents-envs/mlagents_envs/environment.py67 # * 1.5.0 - support variable length observation training and multi-agent groups.COMMENT
MEDIUM…m.unity.ml-agents/Documentation~/ML-Agents-Overview.md195See our [Designing Agents](Learning-Environment-Design-Agents.md#defining-multi-agent-scenarios) page for more informatiCODE
MEDIUMcom.unity.ml-agents/Documentation~/index.md7This documentation contains comprehensive instructions about [Unity ML-Agents Toolkit](https://github.com/Unity-TechnoloCODE
MEDIUMcom.unity.ml-agents/Documentation~/Migrating.md405- We have removed the `Done` call as well as the capacity to set `Max Steps` on the Academy. Therefore, an AcademyReset CODE
AI Structural Patterns11 hits · 11 pts
SeverityFileLineSnippetContext
LOWml-agents/mlagents/trainers/trajectory.py116CODE
LOWml-agents/mlagents/trainers/trajectory.py133CODE
LOW…s/mlagents/trainers/training_analytics_side_channel.py45CODE
LOWml-agents/mlagents/trainers/tests/simple_test_envs.py42CODE
LOWml-agents/mlagents/trainers/tests/simple_test_envs.py351CODE
LOWml-agents/mlagents/trainers/torch_entities/attention.py265CODE
LOW…gents/mlagents/trainers/torch_entities/conditioning.py133CODE
LOWml-agents-envs/mlagents_envs/environment.py145CODE
LOW…nvs/communicator_objects/unity_to_external_pb2_grpc.py53CODE
LOWml-agents-envs/tests/simple_test_envs.py46CODE
LOWml-agents-envs/tests/simple_test_envs.py297CODE
Verbosity Indicators7 hits · 10 pts
SeverityFileLineSnippetContext
LOW⚡ml-agents/mlagents/utils/push_to_hf.py64 # Step 1: Read the config.jsonCOMMENT
LOW⚡ml-agents/mlagents/utils/push_to_hf.py72 # Step 2: Create the metadataCOMMENT
LOW⚡ml-agents/mlagents/utils/push_to_hf.py75 # Step 3: Generate the model cardCOMMENT
LOW⚡ml-agents/mlagents/utils/push_to_hf.py148 # Step 1: Create the repoSTRING
LOW⚡ml-agents/mlagents/utils/push_to_hf.py158 # Step 2: Create a config fileSTRING
LOW⚡ml-agents/mlagents/utils/push_to_hf.py161 # Step 3: Generate and save the model cardSTRING
LOWml-agents/mlagents/trainers/tests/test_buffer.py208 # We need to check if we ever get a breaking start - this will maximize the probabilityCOMMENT
AI Slop Vocabulary4 hits · 9 pts
SeverityFileLineSnippetContext
LOW…agents/trainers/tests/torch_entities/test_simple_rl.py450 # Otherwise, we can just call solve to execute the optimal policyCOMMENT
LOWml-agents-envs/mlagents_envs/registry/binary_utils.py133 # TODO: Once we don't use python 3.7 we should just use exists_ok=True when creating the dirs to avoid this.COMMENT
MEDIUM…nts/Runtime/Input/Adaptors/ButtonInputActionAdaptor.cs17 /// TODO this method needs to be more nuanced depending the types of controls that can back it. i.e. TriggerConCOMMENT
MEDIUM…nts/Runtime/Input/Adaptors/ButtonInputActionAdaptor.cs29 /// TODO again this might need to be more nuanced for things like continuous buttons.COMMENT
Slop Phrases4 hits · 6 pts
SeverityFileLineSnippetContext
LOWml-agents/mlagents/trainers/env_manager.py116 # We make sure to empty the policy queue before continuing to produce steps.COMMENT
LOWml-agents/mlagents/trainers/trainer_controller.py195 # If the environment failed, we want to make sure to raiseCOMMENT
LOWml-agents/mlagents/trainers/agent_processor.py435 # In the environment manager, we make sure to empty the policy queue before continuing to produce steps.COMMENT
LOW…nts/mlagents/trainers/tests/torch_entities/test_ppo.py207 # Time horizon is longer than sequence length, make sure to testCOMMENT
Cross-Language Confusion1 hit · 5 pts
SeverityFileLineSnippetContext
HIGHml-agents-envs/mlagents_envs/timers.py277 timer_node = timer_stack.push(name)CODE
Fake / Example Data2 hits · 2 pts
SeverityFileLineSnippetContext
LOW…ests/Tests/Editor/TrainingAnalyticsSideChannelTests.cs48 var badBytes = Encoding.ASCII.GetBytes("Lorem ipsum");CODE
LOWDevProject/Assets/placeholder.txt1lorem ipsumCODE
Example Usage Blocks1 hit · 2 pts
SeverityFileLineSnippetContext
LOWcom.unity.ml-agents/Runtime/Timer.cs352 /// Example usage:COMMENT