{ "cells": [ { "cell_type": "code", "execution_count": null, "id": "31b1e378", "metadata": {}, "outputs": [], "source": [ "!mkdir docker" ] }, { "cell_type": "code", "execution_count": null, "id": "c5772040", "metadata": {}, "outputs": [], "source": [ "%%writefile docker/requirements.txt\n", "ftfy\n", "spacy \n", "\n", "#-f https://download.pytorch.org/whl/cu113/torch_stable.html\n", "#torch==1.12.1+cu113 \n", "\n", "transformers==4.21.0 \n", "accelerate \n", "diffusers==0.4.1\n", "datasets\n", "\n", "tensorflow\n", "scikit-image" ] }, { "cell_type": "code", "execution_count": null, "id": "e2c5bca1", "metadata": {}, "outputs": [], "source": [ "%%writefile docker/Dockerfile\n", "\n", "FROM 763104351884.dkr.ecr.us-east-1.amazonaws.com/pytorch-training:1.12.1-gpu-py38-cu113-ubuntu20.04-sagemaker \n", "\n", "COPY requirements.txt .\n", " \n", "RUN pip install -r requirements.txt\n" ] }, { "cell_type": "code", "execution_count": null, "id": "ccd07357", "metadata": {}, "outputs": [], "source": [ "! aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin 763104351884.dkr.ecr.us-east-1.amazonaws.com" ] }, { "cell_type": "code", "execution_count": null, "id": "7311d49e", "metadata": {}, "outputs": [], "source": [ "version = 'v1'" ] }, { "cell_type": "code", "execution_count": null, "id": "a7ad0493", "metadata": {}, "outputs": [], "source": [ "!docker build -t stable-diffusion:{version} docker" ] }, { "cell_type": "code", "execution_count": null, "id": "bc4761c0", "metadata": {}, "outputs": [], "source": [ "# paste your account ID here\n", "account = " ] }, { "cell_type": "code", "execution_count": null, "id": "6753e698", "metadata": {}, "outputs": [], "source": [ "!aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin {account}.dkr.ecr.us-east-1.amazonaws.com" ] }, { "cell_type": "code", "execution_count": null, "id": "2f72b433", "metadata": {}, "outputs": [], "source": [ "!docker tag stable-diffusion:{version} {account}.dkr.ecr.us-east-1.amazonaws.com/stable-diffusion:{version}" ] }, { "cell_type": "code", "execution_count": null, "id": "85476816", "metadata": {}, "outputs": [], "source": [ "!docker push {account}.dkr.ecr.us-east-1.amazonaws.com/stable-diffusion:{version}" ] } ], "metadata": { "kernelspec": { "display_name": "conda_python3", "language": "python", "name": "conda_python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.8.12" } }, "nbformat": 4, "nbformat_minor": 5 }