4

玩玩文字轉圖片的 min(DALL·E)

 2 years ago
source link: https://blog.gslin.org/archives/2022/07/24/10812/%e7%8e%a9%e7%8e%a9%e6%96%87%e5%ad%97%e8%bd%89%e5%9c%96%e7%89%87%e7%9a%84-mindall%c2%b7e/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

玩玩文字轉圖片的 min(DALL·E)

幾個禮拜前看到「Show HN: I stripped DALL·E Mini to its bare essentials and converted it to Torch (github.com/kuprel)」這個東西,有訓練好的 model 可以直接玩文字轉圖片,GitHub 專案在「min(DALL·E) is a fast, minimal port of DALL·E Mini to PyTorch」這邊可以取得。

因為這是包裝過的版本,裝起來 & 跑起來都很簡單,但沒想到桌機的 1080 Ti 還是跑不動,只能用 CPU 硬扛了,速度上當然是比官網上面列出來用 GPU 的那些慢很多,但至少能跑起來玩看看。

首先是拿官方的句子來玩看看,第一次跑會需要下載 model (會放到我們指定的 pretrained 目錄下):

#!/usr/bin/env python3

from min_dalle import MinDalle
import torch

model = MinDalle(
    models_root='./pretrained',
    dtype=torch.float32,
    device='cpu',
    is_mega=True,
    is_reusable=False,
)

images = model.generate_image(
    text='Nuclear explosion broccoli',
    seed=-1,
    grid_size=2,
    is_seamless=False,
    temperature=1,
    top_k=256,
    supercondition_factor=32,
    is_verbose=False,
)

images = images.save('test.png')

我自己在下載過後,跑每個生成大概都需要十分鐘左右 (參數就像上面列的,CPU 是 AMD 的 5800X,定頻跑在 4.5GHz),出來的結果是這樣:

oRyzQhW.png

接著是一些比較普通的描述,這是 sleeping fat cats

85yQygQ.png

然後來測試看看一些比較偏門的詞,像是 Lolicon,這個就差蠻多了:

UdI6oz8.png

但感覺有蠻多應用可以掛上去,這樣有點想買張 3090 了...

Related

Amazon EC2 有 Mac (M1) 機種可以租用了

2020 年年底的時候 AWS 推出用 Mac mini 配合搭建出 Mac (Intel) 機種:「Amazon EC2 推出 Mac Instance」,當初有計畫在 2021 年推出 M1 的版本: Apple M1 Chip – EC2 Mac instances with the Apple M1 chip are already in the works, and planned for 2021. 不過就沒什麼意外的 delay 了,這次則是推出了 M1 的版本:「New – Amazon EC2 M1 Mac Instances」。…

July 10, 2022

In "AWS"

ClickHouse 自家做的 benchmark 比較

在「Show HN: A benchmark for analytical databases (Snowflake, Druid, Redshift) (clickhouse.com)」這邊看到 ClickHouse 自家做的 benchmark 比較,網站在「ClickBench — a Benchmark For Analytical DBMS」這邊。 這種 benchmark 基本上是拿來當作清單來看,另外 Hacker News 上的討論一定得看,尤其是沒被列上 benchmark 的... 講到 ClickHouse,先前是有朋友跑來說他有個需求是需要跑分析,但遇到用 PostgreSQL 時發現寫入速度不夠快的問題,看看有沒有什麼方法可以解。問了多一點以後發現他的需求是 OLAP 類而不是 OLTP 類,就先跟他講要去找 OLAP engine 來解決。 然後就聊到維基百科上「Comparison of OLAP servers」這個條目,裡面列出來的 open source 軟體是不少,但 Apache 家基本上大家都知道是回收場,裡面就剩下 ClickHouse…

July 15, 2022

In "Computer"

Cloudflare 上的 Hertzbleed 解釋

除了 Hertzbleed 當初公佈時的論文與網頁外,Cloudflare 上也有一篇 Hertzbleed 的解釋:「Hertzbleed explained」。 會特別拿出來提是因為這篇是 Yingchen Wang 寫的,也就是 Hertzbleed 論文裡兩位第一作者之一 (另外一位是 Riccardo Paccagnella),而從她的網站上也可以看到 Cloudflare intern 的資訊: Graduate Research Intern at Cloudflare, 2022 Summer Hertzbleed 也是一種 side-channel attack,利用 CPU 會依照電量與溫度,而動態調整頻率的特性來達到遠端攻擊,而不需要在機器旁邊有功率錶之類儀器。 傳統上針對這類執行時間的程式會用 constant-time programming 來保護,但 Hertzbleed 則是利用了 CPU 會動態調整頻率的特性鑽出一個洞。現在學界對這個攻擊方式還不熟悉,等熟悉了以後應該是會把洞鑽大... 依照原理來說,定頻應該會是一個解法... 像是大家現在都很喜歡搞「降壓超頻」,算是某種定頻的方式,而一般大家會設定在全速跑也不會過熱降頻的情況。 目前 Intel 跟 AMD 都決定不 patch,依照洞一向都是愈挖愈大,來期待洞大到 RSA 或是…

July 12, 2022

In "Computer"

a611ee8db44c8d03a20edf0bf5a71d80?s=49&d=identicon&r=gAuthor Gea-Suan LinPosted on July 24, 2022Categories Computer, Murmuring, Photo, Programming, Recreation, SoftwareTags dall, e, graph, image, learning, machine, min, mindalle, mini, model, python, pytorch, text, to, torch

Leave a Reply

Your email address will not be published. Required fields are marked *

Comment *

Name *

Email *

Website

Notify me of follow-up comments by email.

Notify me of new posts by email.

To respond on your own website, enter the URL of your response which should contain a link to this post's permalink URL. Your response will then appear (possibly after moderation) on this page. Want to update or remove your response? Update or delete your post and re-enter your post's URL again. (Learn More)

Post navigation


Recommend

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK