docker部署-配合compose

yum -y install perl perl-devel

curl -fsSL https://get.docker.com | bash

curl -L "https://github.com/docker/compose/releases/download/1.25.3/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

chmod a+x /usr/local/bin/docker-compose

docker-compose

把配置文档传到终端或者创建文件夹
(mkdir soga)

cd soga

把配置文档传到终端或直接新建黏贴
(vi docker-compose.yml)

service docker start

docker-compose up -d

docker ps

docker logs d4f681c3056a -f

常见命令:

需要在 docker-compose.yml 文件同目录下执行

docker-compose up # 前台启动soga,主要观察日志使用
docker-compose up -d # 后台启动soga,长期运行
docker-compose logs --tail=500 # 截取输出最后500行日志
docker-compose down # 停止并删除容器
docker-compose restart # 重启
docker-compose pull # 更新

更新流程:

需要在 docker-compose.yml 文件同目录下执行

首先更新

docker-compose pull

然后重新加载并重启即可,docker-compose 会自动删除旧容器并启动新更新的镜像

docker-compose up -d

服务器开启ssk key登录

ls -al ~/.ssh

检查ssh key 是否已经存在

ssh-keygen -t rsa -C

默认生成一个,一路回车3次就OK了

生成后,会在/root目录下,也就是当前用户的目录下,生成一个.ssh隐藏目录,目录中会有【id_rsa】和【id_rsa.pub】两个文件,一个是私钥,一个是公钥

撰写 Text Prompt 注意事项

Midjourney 跟 ChatGPT 在 prompt 的使用上有很多不一样的地方,本章会详细介绍下 Midjourney 的 text prompt 区别。

语法
首先 Midjourney 基本上是不懂语法的,所以即使你语法错了,只要词对了,也能生成图片。。

另外,不懂语法也导致了另一个问题:prompt 不是越长越好。特别是各种定语从句,它根本就不懂,还不如把指令用逗号隔开,一个个输入。以下是官方推荐的语法建议:

使用形容词+名词的词序来替换介词短语。
hair flowing in the wind 应该改为 flowing hair
a carrot for a nose 应该改为 carrot nose
使用非常具体的动词来替换介词短语。
a girl with a flashlight 应该改为 a girl using a flashlight
a girl with a big smile on her face 应该改为 smiling girl
最后, Midjourney 是不会区分大小写的。

单词
在单词的部分,Midjourney 跟 ChatGPT 有点类似,它对同义词的理解也不是很好。比如举两个例子:

big (大)这个词,到底指多大?越具象的大,对于 Midjourney 来说,效果越好,比如用 gigantic 就比用通用的 big 好。
cats(猫)这个词是个复数,但到底是多少只?对于 Midjourney 来说,two cats(两只猫)比 cats 更明确。
另外,Midjourney 还能用 emoji 代替单词(我觉得本质上 emoji 也是单词),算是一个比较有意思的特性。

与其说不要什么,不如说要什么
这个跟 ChatGPT 类似,你应该将你想要的东西说清楚,而不是告诉 Midjourney 不要什么,如果你想让 Midjourney 不生成某样东西,就需要用到 参数 — no。

你不说,模型就会随机给你
因为图像信息的信息量远超过文字,所以很多时候,Midjourney 会随机填充一些内容给你,它既是缺陷,也是亮点功能。因为当你不在 prompt 里说明这些词时,你就能获得发散的结果。

如果你想减少这些随机性,就需要用到一些 prompt 框架(或者所谓的模板),本教程会由浅入深地将这个框架教给你。

参数
Midjourney 还有一点跟 ChatGPT 有较大差异,它允许你在 prompt 里加入参数,而且这些参数相对来说一致性都比较好,所以如果你想实现的功能,参数里支持,那优先使用参数,而不是在主体里描述。你会在后续的教程中学到如何善用参数。

Midjourney测试

IMG_8957.JPG
Prompt:
A conceptual visualization of the skin-fascia interface, illustrating the molecular layers and their arrangement in a stylized manner, with geometric shapes and patterns representing the different components of the tissues, and subtle gradients and textures to convey depth and dimension, creating a visually intriguing and abstract depiction of the intricate molecular structure within the skin-fascia gap, Artwork, digital artwork with a minimalist and contemporary aesthetic, using vector graphics software and digital painting techniques --ar 1:1 --q 2 --s 750 --v 5.1

IMG_8958.JPG
Prompt:
night, annihilation movie style, hiny white female robot full-body Porcelain and hammered matt silver showing cracked inner working, light from within, ,fireflies around , firefly , swamp, cinematic lighting, amazing composition , 3d octane render, unreal engine, hyper realistic, soft illumination, trending artstation, environmental concept art, all in grey, 8k trending on ArtStation --ar 1:2 --q 2 --s 250

IMG_8959.JPG
Prompt:
realistic cinematic photo of supergirl as demon, neon red, wallpaper, agfa vista 400, --ar 10:16 --v 5.1

IMG_8960.JPG
Prompt:
realistic full-body photo of a Ironman/Devil hybrid, armored devil wings, epic background --ar 10:16 --v 5.1

Midjourney Prompt 基本结构

在 Midjourney 的官方介绍文档里,介绍了最简单的 Prompt 结构是这样的:
1.png

但我觉得上面那个 Prompt 过于简单了,反而 Advanced Prompt 更适合学习:

2.png

Image Prompts(选填)
Prompt 分成三个部分。第一个是 Image,这个属于选填,可以填也可以不填。

先说下这个 Image URL 是干什么用的,有很多玩法,比如将两张图合并为一张,大家可以看看下面这个例子,我就是将一个大理石雕像和花朵的图片上传到 Discord:

3.png

然后让 Midjourney blend (混合)一下(后续 blend 章节会介绍更多用法)后,就能生成下面这种图片:

4.png
需要注意的是:

你输入的是图片的 URL 地址,而且必须是公开可访问的地址。
图片格式仅支持 png、gif 和 jpg。
你最多只能放两张图的 URL,或者一张图的 URL + 一段话。
如果你不想将图片上传到一些图床服务器,也可以使用 Discord 的图床,你可以私聊 Midjourney Bot 然后通过上传图片的方式,将图片先发到 Discord 上,然后右键复制图片链接,像这样:

Text Prompt
这个就是你希望 AI 生成的图片的描述。这个有非常多的技巧,后续会详细介绍。这里我想说下,Midjourney 跟 ChatGPT 有点不一样:

无法理解句子结构和语法:Midjourney 没法像 ChatGPT 那样懂你说的话。类比的话,Midjourney 更像是命令式编程,ChatGPT 更像是声明式编程,你需要给 Midjourney 完整的指令,它才有可能生成你满意的结果。
Midjourney 有违禁词的设计:有些词语无法输入