Skip to content

Commit

Permalink
Removed more old scripts. Added header comments to all scripts.
Browse files Browse the repository at this point in the history
  • Loading branch information
maximecb committed Oct 2, 2018
1 parent 52d1872 commit fa2bc72
Show file tree
Hide file tree
Showing 16 changed files with 64 additions and 101 deletions.
4 changes: 4 additions & 0 deletions gui.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#!/usr/bin/env python3

"""
Sample GUI application to interact with BabyAI levels
"""

import time
import sys
import threading
Expand Down
5 changes: 5 additions & 0 deletions run_tests.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
#!/usr/bin/env python3

"""
Run basic BabyAI level tests
Note: there are other automated tests in .circleci/config.yml
"""

import babyai
from babyai import levels
from babyai import agents
Expand Down
4 changes: 4 additions & 0 deletions scripts/compute_possible_instructions.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#!/usr/bin/env python3

"""
Compute the number of possible instructions in the BabyAI grammar.
"""

from gym_minigrid.minigrid import COLOR_NAMES

def count_Sent():
Expand Down
1 change: 1 addition & 0 deletions scripts/enjoy.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"""
Visualize the performance of a model on a given environment.
"""

import argparse
import gym
import time
Expand Down
5 changes: 5 additions & 0 deletions scripts/eval_bot.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
#!/usr/bin/env python3

"""
Evaluate the success rate of the bot
This script is used for testing/debugging purposes
"""

import random
import time
from optparse import OptionParser
Expand Down
4 changes: 4 additions & 0 deletions scripts/evaluate.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#!/usr/bin/env python3

"""
Evaluate a trained model or bot
"""

import argparse
import gym
import time
Expand Down
11 changes: 7 additions & 4 deletions scripts/evaluate_all_demos.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
'''
Script to evaluate all available demos. It assumes all demos (human and agent, except the "valid" ones)
"""
Script to evaluate all available demos.
Assumes all demos (human and agent, except the "valid" ones)
are generated with seed 1
'''
"""

import os
from subprocess import call
import sys
Expand All @@ -19,4 +22,4 @@
print("> Env: {} - {}".format(env, demos))
seed = 0 if demos.endswith('valid') else 1
command = ["python evaluate.py --env {} --demos {} --seed {}".format(env, demos, seed)] + sys.argv[1:]
call(" ".join(command), shell=True)
call(" ".join(command), shell=True)
6 changes: 4 additions & 2 deletions scripts/evaluate_all_models.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
"""Evaluate all models in a storage directory.
"""
Evaluate all models in a storage directory.
In order to use this script make sure to add baby-ai-game/scripts to the $PATH
environment variable.
Example of usage: evaluate_all_models.py --episodes 200 --argmax
Sample usage:
evaluate_all_models.py --episodes 200 --argmax
"""

import os
Expand Down
47 changes: 0 additions & 47 deletions scripts/launch_demo_count.py

This file was deleted.

45 changes: 0 additions & 45 deletions scripts/launch_max_experiments.py

This file was deleted.

8 changes: 7 additions & 1 deletion scripts/make_agent_demos.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
#!/usr/bin/env python3

"""
Generate a set of agent demonstrations.
The agent can either be a trained model or the heuristic expert (bot)
"""

import argparse
import gym
import logging
Expand Down Expand Up @@ -194,4 +200,4 @@ def generate_demos(n_episodes, valid, seed, shift=0):

# Validation demos
if args.valid_episodes:
generate_demos(args.valid_episodes, True, 0)
generate_demos(args.valid_episodes, True, 0)
4 changes: 4 additions & 0 deletions scripts/make_human_demos.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#!/usr/bin/env python3

"""
Generate a set of human demonstrations
"""

import sys
import copy
import random
Expand Down
4 changes: 3 additions & 1 deletion scripts/show_level_instructions.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
"""Randomly sample instructions from a level."""
"""
Randomly sample and print out instructions from a level.
"""

import argparse

Expand Down
1 change: 1 addition & 0 deletions scripts/train_il.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"""
Script to train agent through imitation learning using demonstrations.
"""

import os
import argparse
import csv
Expand Down
8 changes: 7 additions & 1 deletion scripts/train_intelligent_expert.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
#!/usr/bin/env python3

"""
Train an agent using an intelligent expert
Train an agent using an intelligent expert.
The procedure starts with a small set of training demonstrations, and
iteratively grows the training set by some percentage. At every step, the new
demos used to grow the training set are demos the agent is currently failing
on. A new model is trained from scratch at every step.
Sample usage:
scripts/train_intelligent_expert.py --env BabyAI-GoToObj-v0 --demos GoToObj-bot-100k --validation-interval 5
Vanilla imitation learning:
Expand Down
8 changes: 8 additions & 0 deletions test_mission_gen.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
#!/usr/bin/env python3

"""
Test the level/mission generation code.
This script allows users to visualize generated missions for a given
level and control the agent manually. The instruction string for the
current mission is printed in the console.
"""

import random
import time
from optparse import OptionParser
Expand Down

0 comments on commit fa2bc72

Please sign in to comment.