Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ __pycache__
*/__pychache__/*
*.pyc

snapshot.pkl
snapshots/*
logs/*

*.egg-info
6 changes: 6 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM rayproject/ray-ml:1.6.0

# Copy watts/* into into /home/ray/
COPY . .
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this dump everything into /? If so, we might want to do:

COPY . /src
WORKDIR /src

just to keep things organized

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So it looks like this container puts things in /home/ray/ be default.

Interestingly, when I write this to another location I get that error you were seeing last week. For example, when trying to put it in ./src aka home/ray/src I get:

#8 9.786          cwd: /home/ray/src/
#8 9.786     Complete output (4 lines):
#8 9.786     running develop
#8 9.786     running egg_info
#8 9.786     creating watts.egg-info
#8 9.786     error: could not create 'watts.egg-info': Permission denied

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But when I just leave it in . aka home/ray/ it works fine 🤷‍♀️

It probably has something to do with the linux permissions in the container - but I haven't dug into it too deep. My docker-fu is pretty weak.


RUN pip install -e .
10 changes: 10 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
build:
docker build -t watts .

run:
docker run -i -t \
--shm-size=8G \
-p 8265:8265 \
--mount type=bind,source=`pwd`/logs,target=/home/ray/logs \
--mount type=bind,source=`pwd`/snapshots,target=/home/ray/snapshots \
watts python poet_distributed.py
10 changes: 4 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# enigma
# watts
PINSKY v2

This is a rewrite and extension of the UntouchableThunder repo.

**Furthermore, we aim for Enigma to generically tackle the
**Furthermore, we aim for Watts to generically tackle the
problem of simultaneous learning with generators and solvers.**

In PINSKY (v1.0), I manually created futures and collected answers after each distributed call.
Expand All @@ -15,10 +15,8 @@ by a user, and to cleanly scale to arbitrary compute.

Installation:

* conda create -n NAME python=3.7.10
* conda activate NAME
* Install pytorch according to your system and environment from here: https://pytorch.org/get-started/locally/
* At the root of this project, run: `pip install -e .`
* make
* make run

If you see stuff like:
```
Expand Down
Empty file added logs/.gitkeep
Empty file.
8 changes: 4 additions & 4 deletions poet_distributed.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ def save_obj(obj, folder, name):
network_factory = NetworkFactory(registry.network_name, registry.get_nn_build_info)


generator = StaticGenerator(args.initial_level_string)
#generator = EvolutionaryGenerator(args.initial_level_string,
# file_args=registry.get_generator_config)
# generator = StaticGenerator(args.initial_level_string)
generator = EvolutionaryGenerator(args.initial_level_string,
file_args=registry.get_generator_config)

if args.use_snapshot:
manager = POETManagerSerializer.deserialize()
Expand Down Expand Up @@ -96,7 +96,7 @@ def save_obj(obj, folder, name):
_release(manager._evolution_strategy._replacement_strategy.archive_history, manager.active_population)
manager._evolution_strategy._replacement_strategy.archive_history['run_stats'] = manager.stats
save_obj(manager._evolution_strategy._replacement_strategy.archive_history,
os.path.join('..', 'enigma_logs', _args.exp_name),
os.path.join('.', 'logs', _args.exp_name),
'total_serialized_alg')

elapsed = time.time() - start
Expand Down
4 changes: 2 additions & 2 deletions sample_args/args.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@ game_len: 500
opt_algo: "PPO"

# algo generation args
evolution_timer: 25
evolution_timer: 5
mutation_rate: 0.8
max_children: 3
max_envs: 10
comp_agent: mcts

# algo general args
num_poet_loops: 2
num_poet_loops: 100
transfer_timer: 10
snapshot_timer: 20
use_snapshot: False
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
author='Aaron Dharna <[email protected]>, Charlie Summers <[email protected]>, Rohin Dasari <[email protected]>',
url='https://github.com/aadharna/watts',
packages=['watts'],
python_requires='>=3.7.10',
python_requires='>=3.7.7',
install_requires=[
'ray[all]==1.6.0',
'griddly',
Expand Down
Empty file added snapshots/.gitkeep
Empty file.
4 changes: 2 additions & 2 deletions watts/serializer/POETManagerSerializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ def __init__(self, manager: POETManager):
self.manager = manager

def serialize(self):
with open('snapshot.pkl', 'wb') as f:
with open('./snapshots/snapshot.pkl', 'wb') as f:
pickle.dump(self, f, pickle.HIGHEST_PROTOCOL)

@staticmethod
def deserialize() -> POETManager:
with open('snapshot.pkl', 'rb') as f:
with open('./snapshots/snapshot.pkl', 'rb') as f:
return pickle.load(f).manager

def __getstate__(self):
Expand Down
2 changes: 1 addition & 1 deletion watts/solvers/SingleAgentSolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def __init__(self, trainer_constructor, trainer_config, registered_gym_name, net
self.network_factory = network_factory
self.gym_factory = gym_factory
self.trainer = trainer_constructor(config=trainer_config, env=registered_gym_name,
logger_creator=custom_log_creator(os.path.join('..', 'enigma_logs', self.exp),
logger_creator=custom_log_creator(os.path.join('.', 'logs', self.exp),
f'POET_{log_id}.')
)
self.agent = network_factory.make()(weights)
Expand Down
2 changes: 1 addition & 1 deletion watts/utils/gym_wrappers.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,6 @@ def policy_mapping_fn(agent_id):
stop = {"timesteps_total": 500000}

results = tune.run(PPOTrainer, config=config2, stop=stop,
local_dir=os.path.join('..', 'enigma_logs'), checkpoint_at_end=True)
local_dir=os.path.join('.', 'logs'), checkpoint_at_end=True)

ray.shutdown()