-
Notifications
You must be signed in to change notification settings - Fork 0
71 gnn for 3d simulator data redesign #72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…his branch: fixed variants problem in boidsAgents, added ground weights option, fixed separation weight getting multiplied twice, updated tqdm,
…imple) GNN model is created, which can be trained, and basic plotting of attention weights is provided.
…ectories working, and some minor fixes.
…working. Training seems to be working too well -- maybe some of the validation data is leaking into the training? Need to figure that out.
…es (which seems to work), run_simulator.py added as new (and better designed) entry point for the simulator, gnn_agent.py added to allow the gnn model to work with the simulator for rollouts, boid_agents.py added to allow for different kinds of agent classes to be used with the simulator, various other fixes and bugs added.
…ode off into a separate file.
…ta file. Some formatting fixes as well.
…ata directory to better separate the original data from the training results and make it easier to have multiplet types of input features and models.
… show.) - Added abstract class in simulator_agents_abstract.py - Clipped the actions to run trajectories so they don't go beyond the box boundaries.
… 5. Need more tests. Also, pytest code ran successfully.
…ter that train uses to create the model rather than the model being hard coded in train_3DGNN().
…s if running remote tests. Also changed where those folders were placed.
…. This commit has build and train. Last one was just build and it ran successfully.
…. This commit has build and train and show. Last one was build and train, which ran successfully.
…. This commit has build, train and analyze. Last one was build, train, and show, which failed.
…ild, train and analyze all run remotely, but the test for show fails for some reason. Changed the show test to run locally only.
dimkab
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the awesome work!
| """ | ||
| TOC -- 010226 8:52PM | ||
| Why are these torch.inf instead of np.inf? | ||
| """ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
have you tried to switch to np.inf and rerun tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All tests pass with np.inf, so I changed that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we have two run_simulator()'s now (this one and the old run_boids_simulator.py) and this is confusing. Since you have run_simulator_main here with boid_agents, is it supposed to replicate the functionality from run_boids_simulator.py? if so, I'd much prefer if there was only one simulator...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
run_simulator() is more general and doesn't always use boids, so it makes sense to keep that name. I removed run_boids_simulator.py.
|
|
||
| def convert_dataframe_to_node_features( | ||
| df: pd.DataFrame, columns=None, time_window_length=1 | ||
| ): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
docstring/type hint for return value
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added docstrings and type hints for all the new code (I think) -- hopefully, they are accurate and specific enough. Didn't have time to go back to the simulator code.
| ): | ||
| """ | ||
| Args: | ||
| df (pd.DataFrame): the dataframe containing a description of the agents in the environment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
expected format of the df?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added
| node_feature_columns=None, | ||
| label_type: Optional[str] = None, | ||
| time_window_length: int = 1, | ||
| ): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
type hint / docstring for return value
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added
collab_env/gnn/gnn_3D/train_3DGNN.py
Outdated
| ) | ||
|
|
||
|
|
||
| def load_dataset(directory: str): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(optional) parameters: seed, batch_size (is >1 supported?), train_size_ratio
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe batch_size>1 will work (it runs) but I have to rethink how I am processing the training results since torch-geometric combines the graphs into a single graph.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added support in process_results() to handle results generated with batches. I also added train_size_ratio and seed parameters.
collab_env/gnn/gnn_3D/train_3DGNN.py
Outdated
| ) | ||
|
|
||
| train_loader = DataLoader(dataset=train_dataset, batch_size=1, shuffle=True) | ||
| val_loader = DataLoader(dataset=val_dataset, batch_size=1, shuffle=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for validation is better to have shuffle=False to compare between epochs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
collab_env/gnn/gnn_3D/train_3DGNN.py
Outdated
| if not stored_init_pos: | ||
| stored_init_pos = True | ||
| # print('x shape: ', graph.x.shape) | ||
| """ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this comment still relevant? if anything, the assumption about attention weights being returned does create dependency to the model type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed the stored init pos stuff.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this file used somewhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, removed it.
tests/test_gnn3D_position_labels.py
Outdated
| # | ||
| # Train | ||
| # | ||
| result = subprocess.run( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there any way to have everything here run without spawning a new process? will help debugging the thing...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually never mind that, debugging is not an issue
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed all those already. :)
| scale_positions=1500, | ||
| ) | ||
|
|
||
| if remote_test: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this branch is never executed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I excluded the show_trajectories part of the test for now because I couldn't get it to work. If we add this back it, we will need the remote test check to see if we want to remove the folders.
…a numpy array to a scalar. Got rid of a bunch of unnecessary comments. Added type hints everywhere. Added a notebook to run the 3DGNN code (animating weights doesn't work yet in the notebook, though). Removed the gnn3D_postion_labels_agent_config.yaml files and the run_boids_simulator file.
…. support in process_results() for batched data. Removed now redundant run_boids_simulator.py.
…_main() instead of defunct run_boids_simulator(). Updated README.md to say run_simulator where it used to say run_boids_simulator.
… run_boids_simulator().
… can get past the CI test. Removed a couple of unused files from the simulator folder.
… wouldn't have conflicts if the default config.yaml file changed. The notebook requires like 5 episodes, while the default was just 1 episode.
Initial code working. We can build torch geometric datasets, train GNNs on those datasets, and perform some analysis of the results.