sharpie.webserver.experiment.models
Functions
Classes
|
The union of policies and participants, i.e. an entity that perceives information from its environment, makes decisions based on those perceptions and internal goals, and acts to influence the environment’s future state. |
|
Singleton config for connection quality checks. |
|
A simulated Markov decision process (MDP) adhering to the Gymnasium API with a tensor actions and rewards to support multi-agent and multi-objective settings. |
|
A configured study combining zero, one or more RL agent(s), a single environment, one or more participants. |
|
The instance of an RL policy, i.e. a particular stochastic or deterministic mapping of states to actions. |
- sharpie.webserver.experiment.models.default_policy_filepaths()
- sharpie.webserver.experiment.models.default_keyboard_inputs()
- sharpie.webserver.experiment.models.default_environment_filepaths()
- class sharpie.webserver.experiment.models.Policy(*args, **kwargs)
The instance of an RL policy, i.e. a particular stochastic or deterministic mapping of states to actions.
- Parameters:
id (BigAutoField) – Primary key: ID
name (CharField) – Name
description (TextField) – Description
filepaths (JSONField) – List of files needed by the policy. Those should be located under the top runner folder. You can also specify files under subfolders like <folder>/<filename>.py. <a href=”/experiment/download/policy_template” target=”_blank”>Download policy template</a>, your policy file should define a variable called “policy” that implements the logic of the policy.
checkpoint_interval (IntegerField) – Checkpoint interval. Checkpoint interval (in steps) at which the policy is saved. Can also be 0 (never) or -2 (at the end of each episode).
metadata (JSONField) – Metadata
Reverse relationships:
- Parameters:
agent (Reverse
ForeignKeyfromAgent) – All agents of this policy (related name ofpolicy)
- name
Type:
CharFieldName
- description
Type:
TextFieldDescription
- filepaths
Type:
JSONFieldList of files needed by the policy. Those should be located under the top runner folder. You can also specify files under subfolders like <folder>/<filename>.py. <a href=”/experiment/download/policy_template” target=”_blank”>Download policy template</a>, your policy file should define a variable called “policy” that implements the logic of the policy.
- checkpoint_interval
Type:
IntegerFieldCheckpoint interval. Checkpoint interval (in steps) at which the policy is saved. Can also be 0 (never) or -2 (at the end of each episode).
- metadata
Type:
JSONFieldMetadata
- clean()
Validate the policy model: 1. All files in filepaths can be found in the system 2. There is one file stored in the filepaths dict with key “policy” 3. That script defines a policy variable
- exception DoesNotExist
- exception MultipleObjectsReturned
- id
Type:
BigAutoFieldPrimary key: ID
- objects = <django.db.models.Manager object>
- class sharpie.webserver.experiment.models.Agent(*args, **kwargs)
The union of policies and participants, i.e. an entity that perceives information from its environment, makes decisions based on those perceptions and internal goals, and acts to influence the environment’s future state.
- Parameters:
id (BigAutoField) – Primary key: ID
role (CharField) – Role in the environment (will be used as an ID)
name (CharField) – Name that will be displayed
description (TextField) – Description
participant (BooleanField) – Can the participant act?
keyboard_inputs (JSONField) – Inputs captured from the participant, with mapping
keyboard_input_display (JSONField) – Display config for each key: {key: {“symbol”: “←”, “label”: “Left”}}. Optional. Maps key names to display config. E.g. {“Enter”: {“symbol”: “↵”, “label”: “Enter”}}. Keys not listed use the key name.
multiple_keyboard_inputs (BooleanField) – Allow multiple inputs from users
inputs_type (CharField) – How will the inputs be used in the environment?
textual_inputs (BooleanField) – Allow textual inputs from users
metadata (JSONField) – Metadata
Relationship fields:
- Parameters:
policy (
ForeignKeytoPolicy) – Policy (related name:agent)
Reverse relationships:
- Parameters:
experiment (Reverse
ManyToManyFieldfromExperiment) – All experiment of this agent (related name ofagents)
- role
Type:
CharFieldRole in the environment (will be used as an ID)
- name
Type:
CharFieldName that will be displayed
- description
Type:
TextFieldDescription
- participant
Type:
BooleanFieldCan the participant act?
- keyboard_inputs
Type:
JSONFieldInputs captured from the participant, with mapping
- keyboard_input_display
Type:
JSONFieldDisplay config for each key: {key: {“symbol”: “←”, “label”: “Left”}}. Optional. Maps key names to display config. E.g. {“Enter”: {“symbol”: “↵”, “label”: “Enter”}}. Keys not listed use the key name.
- multiple_keyboard_inputs
Type:
BooleanFieldAllow multiple inputs from users
- inputs_type
Type:
CharFieldHow will the inputs be used in the environment?
Choices:
actionsrewardother
- textual_inputs
Type:
BooleanFieldAllow textual inputs from users
- metadata
Type:
JSONFieldMetadata
- clean()
Hook for doing any extra model-wide validation after clean() has been called on every field by self.clean_fields. Any ValidationError raised by this method will not be associated with a particular field; it will have a special-case association with the field defined by NON_FIELD_ERRORS.
- get_keyboard_input_display_map()
Returns display config for each key in keyboard_inputs (except default). Uses keyboard_input_display when set, else key name (Space for ‘ ‘).
- exception DoesNotExist
- exception MultipleObjectsReturned
- experiment
Type: Reverse
ManyToManyFieldfromExperimentAll experiment of this agent (related name of
agents)
- get_inputs_type_display(*, field=<django.db.models.CharField: inputs_type>)
Shows the label of the
inputs_type. Seeget_FOO_display()for more information.
- id
Type:
BigAutoFieldPrimary key: ID
- objects = <django.db.models.Manager object>
- class sharpie.webserver.experiment.models.Environment(*args, **kwargs)
A simulated Markov decision process (MDP) adhering to the Gymnasium API with a tensor actions and rewards to support multi-agent and multi-objective settings.
- Parameters:
id (BigAutoField) – Primary key: ID
name (CharField) – Name
description (TextField) – Description
filepaths (JSONField) – List of files needed by the environment. Those should be located under the top runner folder. You can also specify files under subfolders like <folder>/<filename>.py. <a href=”/experiment/download/environment_template” target=”_blank”>Download environment template</a>, your environment file should define a variable called “environment” that implements the logic of the environment.
metadata (JSONField) – Metadata
Reverse relationships:
- Parameters:
experiment (Reverse
ForeignKeyfromExperiment) – All experiments of this environment (related name ofenvironment)
- name
Type:
CharFieldName
- description
Type:
TextFieldDescription
- filepaths
Type:
JSONFieldList of files needed by the environment. Those should be located under the top runner folder. You can also specify files under subfolders like <folder>/<filename>.py. <a href=”/experiment/download/environment_template” target=”_blank”>Download environment template</a>, your environment file should define a variable called “environment” that implements the logic of the environment.
- metadata
Type:
JSONFieldMetadata
- clean()
Validate the environment model: 1. All files in filepaths can be found in the system 2. There is one file stored in the filepaths dict with key “environment” 3. That script defines an environment variable
- exception DoesNotExist
- exception MultipleObjectsReturned
- experiment_set
Type: Reverse
ForeignKeyfromExperimentAll experiments of this environment (related name of
environment)
- id
Type:
BigAutoFieldPrimary key: ID
- objects = <django.db.models.Manager object>
- class sharpie.webserver.experiment.models.Experiment(*args, **kwargs)
A configured study combining zero, one or more RL agent(s), a single environment, one or more participants.
- Parameters:
id (BigAutoField) – Primary key: ID
name (CharField) – Name
link (CharField) – Link to the experiment. Unique identifier (slug) for the experiment URL
conda_environment (CharField) – Name of a Conda environment already installed on the runner
short_description (TextField) – To be displayed on the home page
long_description (TextField) – To be displayed on the experiment page
enabled (BooleanField) – Enabled
redirect_url (URLField) – Redirect url. If provided, participants will be redirected to this URL after completing the experiment.
number_of_episodes (IntegerField) – Number of episodes to complete
target_fps (FloatField) – Target FPS for the experiment. If you enable wait for inputs, the FPS will be determined by the participants’ inputs and this setting will be used as a forced pause after receiving inputs.
wait_for_inputs (BooleanField) – Wait for participants’ input before moving to the next step
Relationship fields:
- Parameters:
environment (
ForeignKeytoEnvironment) – Environment (related name:experiment)agents (
ManyToManyFieldtoAgent) – Agents (related name:experiment)
Reverse relationships:
- Parameters:
sessions (Reverse
ForeignKeyfromSession) – All sessions of this experiment (related name ofexperiment)
- name
Type:
CharFieldName
- link
Type:
CharFieldLink to the experiment. Unique identifier (slug) for the experiment URL
- conda_environment
Type:
CharFieldName of a Conda environment already installed on the runner
- short_description
Type:
TextFieldTo be displayed on the home page
- long_description
Type:
TextFieldTo be displayed on the experiment page
- enabled
Type:
BooleanFieldEnabled
- redirect_url
Type:
URLFieldRedirect url. If provided, participants will be redirected to this URL after completing the experiment.
- environment
Type:
ForeignKeytoEnvironmentEnvironment (related name:
experiment)
- agents
Type:
ManyToManyFieldtoAgentAgents (related name:
experiment)
- number_of_episodes
Type:
IntegerFieldNumber of episodes to complete
- target_fps
Type:
FloatFieldTarget FPS for the experiment. If you enable wait for inputs, the FPS will be determined by the participants’ inputs and this setting will be used as a forced pause after receiving inputs.
- wait_for_inputs
Type:
BooleanFieldWait for participants’ input before moving to the next step
- save(*args, **kwargs)
Save the current instance. Override this in a subclass if you want to control the saving process.
The ‘force_insert’ and ‘force_update’ parameters can be used to insist that the “save” must be an SQL insert or update (or equivalent for non-SQL backends), respectively. Normally, they should not be set.
- exception DoesNotExist
- exception MultipleObjectsReturned
- environment_id
Internal field, use
environmentinstead.
- id
Type:
BigAutoFieldPrimary key: ID
- objects = <django.db.models.Manager object>
- sessions
Type: Reverse
ForeignKeyfromSessionAll sessions of this experiment (related name of
experiment)
- class sharpie.webserver.experiment.models.ConnectionCheckerConfig(*args, **kwargs)
Singleton config for connection quality checks. Edit in admin.
- Parameters:
id (BigAutoField) – Primary key: ID
bandwidth_threshold (FloatField) – Bandwidth threshold. Minimum acceptable bandwidth (Mbps)
latency_threshold (IntegerField) – Latency threshold. Maximum acceptable latency (ms)
test_image_size (IntegerField) – Test image size. Test image size for bandwidth test (bytes)
- bandwidth_threshold
Type:
FloatFieldBandwidth threshold. Minimum acceptable bandwidth (Mbps)
- latency_threshold
Type:
IntegerFieldLatency threshold. Maximum acceptable latency (ms)
- test_image_size
Type:
IntegerFieldTest image size. Test image size for bandwidth test (bytes)
- save(*args, **kwargs)
Save the current instance. Override this in a subclass if you want to control the saving process.
The ‘force_insert’ and ‘force_update’ parameters can be used to insist that the “save” must be an SQL insert or update (or equivalent for non-SQL backends), respectively. Normally, they should not be set.
- delete(*args, **kwargs)
- exception DoesNotExist
- exception MultipleObjectsReturned
- id
Type:
BigAutoFieldPrimary key: ID
- objects = <django.db.models.Manager object>