-
Notifications
You must be signed in to change notification settings - Fork 80
Initial integration with AutoDist #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
Open
DachengLi1
wants to merge
9
commits into
master
Choose a base branch
from
integration
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
a27ac73
integration
DachengLi1 17f8f49
move write_config to autodist
DachengLi1 95c77f8
5f68304
merge two functions
DachengLi1 dbb39cc
clean
DachengLi1 5dcff5b
lint
DachengLi1 c220221
add exception
DachengLi1 f146516
update dockerfile
DachengLi1 c012cde
update dockerfile
DachengLi1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,96 @@ | ||
| # Copyright 2020 Petuum, Inc. All Rights Reserved. | ||
|
DachengLi1 marked this conversation as resolved.
|
||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
|
|
||
| FROM python:3.6.12-buster | ||
| WORKDIR /root | ||
|
|
||
| FROM pytorch/pytorch:1.4-cuda10.1-cudnn7-runtime | ||
| WORKDIR /root | ||
|
DachengLi1 marked this conversation as resolved.
|
||
|
|
||
| FROM tensorflow/tensorflow:2.2.0-gpu | ||
|
|
||
| # Set default shell to /bin/bash | ||
| # SHELL ["/bin/bash", "-cu"] | ||
|
|
||
| # RUN rm -rf /etc/bash.bashrc | ||
|
|
||
| # Install apps | ||
| COPY adaptdl adaptdl | ||
| COPY examples/requirements.txt . | ||
|
|
||
| RUN cd adaptdl && python3 setup.py bdist_wheel | ||
|
|
||
| ARG ADAPTDL_VERSION=0.0.0 | ||
| RUN ADAPTDL_VERSION=${ADAPTDL_VERSION} pip install adaptdl/dist/*.whl | ||
| RUN pip install -r requirements.txt | ||
|
|
||
| RUN rm -rf adaptdl/dist | ||
| WORKDIR /root | ||
| COPY examples examples_adaptdl | ||
| #COPY examples examples | ||
| #RUN apt-get update && apt-get install -y --no-install-recommends apt-utils | ||
|
|
||
| # autodist env | ||
| SHELL ["/bin/bash", "-cu"] | ||
|
|
||
| RUN rm -rf /etc/bash.bashrc | ||
|
|
||
| RUN apt-get update && apt-get install -y --allow-downgrades --allow-change-held-packages --no-install-recommends \ | ||
| build-essential \ | ||
| git \ | ||
| curl \ | ||
| vim \ | ||
| wget \ | ||
| unzip | ||
|
|
||
| RUN curl -O https://bootstrap.pypa.io/get-pip.py && \ | ||
| python get-pip.py && \ | ||
| rm get-pip.py | ||
|
|
||
| WORKDIR /root | ||
| COPY bert_config.json bert_config.json | ||
| COPY tf_examples.tfrecord tf_examples.tfrecord | ||
| COPY autodist autodist | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Some of these COPY commands cannot work in a fresh clone of the AdaptDL repo? Can you make sure this example can work in that setting? Maybe git clone autodist instead of assuming it exists locally? |
||
| RUN cd autodist | ||
| RUN pip install tensorflow_hub | ||
| RUN wget https://github.com/protocolbuffers/protobuf/releases/download/v3.11.0/protoc-3.11.0-linux-x86_64.zip | ||
| COPY autodist/protoc-3.11.0-linux-x86_64.zip protoc-3.11.0-linux-x86_64.zip | ||
| RUN unzip protoc-3.11.0-linux-x86_64.zip | ||
| RUN PROTOC=autodist/bin/protoc python autodist/setup.py build | ||
| WORKDIR autodist | ||
| RUN rm ./examples/resource_spec.yml | ||
| RUN pip install -e .[dev] | ||
|
|
||
| # setup ssh | ||
| # Install OpenSSH to communicate between containers | ||
| RUN apt-get install -y --no-install-recommends openssh-client openssh-server && \ | ||
| mkdir -p /var/run/sshd | ||
|
|
||
| WORKDIR /root | ||
| RUN mkdir /root/.ssh | ||
| RUN ssh-keygen -f /root/.ssh/id_rsa && cat /root/.ssh/id_rsa.pub | cat >> /root/.ssh/authorized_keys | ||
| RUN chown -R root /root/.ssh | ||
| RUN chmod 700 /root/.ssh | ||
| RUN chmod 600 /root/.ssh/authorized_keys | ||
|
|
||
| RUN sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config | ||
| RUN sed -i 's/#PubkeyAuthentication yes/PubkeyAuthentication yes/' /etc/ssh/sshd_config | ||
|
|
||
| # Allow OpenSSH to talk to containers without asking for confirmation | ||
| RUN cat /etc/ssh/ssh_config | grep -v StrictHostKeyChecking > /etc/ssh/ssh_config.new && \ | ||
| echo " StrictHostKeyChecking no" >> /etc/ssh/ssh_config.new && \ | ||
| mv /etc/ssh/ssh_config.new /etc/ssh/ssh_config | ||
|
|
||
| ENV PYTHONUNBUFFERED=true | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| apiVersion: adaptdl.petuum.com/v1 | ||
| kind: AdaptDLJob | ||
| metadata: | ||
| generateName: integration- | ||
| spec: | ||
| minReplicas: 2 | ||
| template: | ||
| spec: | ||
| containers: | ||
| - name: main | ||
| command: | ||
| - python3 | ||
| - /root/autodist/examples/benchmark/bert.py | ||
| - -input_files=/root/tf_examples.tfrecord | ||
| - --bert_config_file=/root/bert_config.json | ||
| - --num_train_epochs=1 | ||
| - --num_steps_per_epoch=1000 | ||
| - --learning_rate=5e-5 | ||
| - --steps_per_loop=1 | ||
| - --autodist_strategy=PS | ||
| resources: | ||
| limits: | ||
| nvidia.com/gpu: 1 | ||
|
|
||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| { | ||
| "attention_probs_dropout_prob": 0.1, | ||
| "hidden_act": "gelu", | ||
| "hidden_dropout_prob": 0.1, | ||
| "hidden_size": 1024, | ||
| "initializer_range": 0.02, | ||
| "intermediate_size": 4096, | ||
| "max_position_embeddings": 512, | ||
| "num_attention_heads": 16, | ||
| "num_hidden_layers": 24, | ||
| "type_vocab_size": 2, | ||
| "vocab_size": 30522 | ||
| } |
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.