-
Notifications
You must be signed in to change notification settings - Fork 40
/
sd-webui-kohya-private.yaml
92 lines (84 loc) · 3.53 KB
/
sd-webui-kohya-private.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
AWSTemplateFormatVersion: '2010-09-09'
Description: A CloudFormation template to deploy the Stable Diffusion Web UI by Automatic1111
Parameters:
SubnetId:
Description: The ID of the subnet where the EC2 instance will be launched.
Type: AWS::EC2::Subnet::Id
Ec2ImageId:
Type: String
Default: ami-0e79b2db3e5f19265
Description: Enter appropriate AMI ID in your region. Tested with "Deep Learning AMI GPU PyTorch 1.13.1 (Ubuntu 20.04) 20230510" in us-east-1.
Ec2InstanceType:
Type: String
Default: g4dn.xlarge
SDWebUIVersion:
Type: String
Description: Branch of AUTOMATIC1111/stable-diffusion-webui
Default: v1.3.2
KohyaSSVersion:
Type: String
Description: Branch of bmaltais/kohya_ss
Default: v21.7.7
Resources:
EC2Instance:
Type: AWS::EC2::Instance
Properties:
InstanceType: !Ref Ec2InstanceType
ImageId: !Ref Ec2ImageId
SubnetId: !Ref SubnetId
BlockDeviceMappings:
- DeviceName: /dev/sda1
Ebs:
VolumeSize: 300
VolumeType: gp2
"Tags" : [
{"Key" : "Name", "Value" : "sd-web-ui-cf"},
]
UserData:
'Fn::Base64': !Sub |
Content-Type: multipart/mixed; boundary="//"
MIME-Version: 1.0
--//
Content-Type: text/cloud-config; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="cloud-config.txt"
#cloud-config
cloud_final_modules:
- [scripts-user, always]
--//
Content-Type: text/x-shellscript; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="userdata.txt"
#!/bin/bash
# Install packages
sudo apt update
sudo add-apt-repository ppa:deadsnakes/ppa -y
sudo apt -y install wget git
sudo apt -y install python3 python-is-python3 python3-pip python3-venv
sudo apt -y install python3.10 python3.10-distutils python3.10-venv python3.10-tk
curl -sS https://bootstrap.pypa.io/get-pip.py | python3.10
python3.10 -m pip install --upgrade pip
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 1
# Launch Kohya
cd /home/ubuntu
sudo -u ubuntu git clone https://github.com/bmaltais/kohya_ss.git -b ${KohyaSSVersion}
cd kohya_ss
# Needs to specify branch in setup. Feel free to change version here.
./setup.sh -b ${KohyaSSVersion} -v
sudo -u ubuntu nohup bash -c './gui.sh --listen 127.0.0.1 --server_port 7861 --headless &> ../kohya-log.txt' &
# Launch Stable Diffusion Web UI
cd /home/ubuntu
# setup script uses existing folder if it exists. Feel free to change version here.
sudo -u ubuntu git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git -b ${SDWebUIVersion}
sudo -u ubuntu nohup bash -c 'stable-diffusion-webui/webui.sh --xformers &> sd-webui-log.txt' &
# Launch File Browser
cd /home/ubuntu
sudo -u ubuntu curl -fsSL https://raw.githubusercontent.com/filebrowser/get/master/get.sh | bash
sudo -u ubuntu nohup bash -c 'filebrowser -r /home/ubuntu &> ./browser-log.txt' &
--//
Outputs:
InstanceID:
Description: EC2Instance ID
Value: !Ref EC2Instance