Skip to content

Commit

Permalink
update the launch_instrumentation example
Browse files Browse the repository at this point in the history
  • Loading branch information
geyang committed Jul 18, 2022
1 parent 0367b87 commit 9b9d896
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 23 deletions.
37 changes: 16 additions & 21 deletions 01_ssh_docker_configuration/launch_instrumentation.py
Original file line number Diff line number Diff line change
@@ -1,29 +1,24 @@
def launch(lr, model_name="LeNet"):
print(f"training model {model_name} with {lr}")
print('...')
print('This is working!!')
def train_fn(seed=None):
from time import sleep
from ml_logger import logger

print('now try to import ml-logger')
from ml_logger import logger, RUN
print('import succeeded')
logger.print('this is running')
logger.print(f"The exp seed is: {seed}", color="green")

print(logger)
logger.print('This is sleeping...', color="yellow")
sleep(5)
logger.print('done!')

print('now inspec the RUN object: RUN', vars(RUN))
assert RUN.prefix == "set_from_outside"
assert RUN.job_name == "ml-logger-test-job"


if __name__ == "__main__":
if __name__ == '__main__':
import jaynes
from ml_logger import RUN, instr
from ml_logger import logger, instr

RUN.prefix = "set_from_outside"
# need to set the job name too
RUN.job_name = "ml-logger-test-job"
jaynes.config()
thunk = instr(launch)
jaynes.run(thunk, lr=1e-3)

# this line allows you to keep the pipe open and hear back from the remote instance.
jaynes.listen(200)
for i in range(5):
thunk = instr(train_fn)
jaynes.add(thunk, seed=i * 100)

jaynes.execute()
jaynes.listen()
2 changes: 2 additions & 0 deletions docker/jaynes/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@ test-aws:
release:
docker image tag jaynes episodeyang/jaynes:$(version)
docker push episodeyang/jaynes:$(version)
docker image tag jaynes episodeyang/jaynes:latest
docker push episodeyang/jaynes:latest
4 changes: 2 additions & 2 deletions docker/pytorch/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM nvidia/cudagl:11.3.0-devel-ubuntu18.04
FROM nvidia/cudagl:11.6.0-devel-ubuntu20.04

FROM python:3.8
ENV PIP_NO_CACHE_DIR=1
Expand Down Expand Up @@ -28,6 +28,6 @@ RUN yes | apt install \
RUN yes | apt install libcgal-qt5-dev
RUN pip install --upgrade pip
RUN pip install pytest pytest-forked lz4 pyyaml
RUN pip install torch==1.8.1+cu111 torchvision==0.9.1+cu111 torchaudio==0.8.1 -f https://download.pytorch.org/whl/torch_stable.html
RUN pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu116
RUN pip install datasets einops sklearn torchinfo tqdm
RUN pip install jaynes ml-logger waterbear params-proto functional-notations
2 changes: 2 additions & 0 deletions docker/pytorch/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ run:
release:
docker tag pytorch episodeyang/pytorch:$(version)
docker push episodeyang/pytorch:$(version)
docker tag pytorch episodeyang/pytorch:latest
docker push episodeyang/pytorch:latest

0 comments on commit 9b9d896

Please sign in to comment.