以下code 有沒有錯,或者,待優化之處?

#存储库克隆到你的 Google Colab Notebook
!git clone https://t.cn/A6NRWmuS

#进入 shap-e目录并安装依赖包:
%cd shap-e
!pip install -e .

#导入所有必需的库
import torch

from shap_e.diffusion.sample import sample_latents
from shap_e.diffusion.gaussian_diffusion import diffusion_from_config
from shap_e.models.download import load_model, load_config
from shap_e.util.notebooks import create_pan_cameras, decode_latent_images, gif_widget

#将设备设置为 cuda(如果可用),否则设置为 cpu。
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')

#加载模型和权重。
xm = load_model('transmitter', device=device)
model = load_model('text300M', device=device)
diffusion = diffusion_from_config(load_config('diffusion'))

#在这里我们将生成 3D 模型。
batch_size = 1 # this is the size of the models, higher values take longer to generate.
guidance_scale = 15.0 # this is the scale of the guidance, higher values make the model look more like the prompt.
prompt = "A mystical sword with a slender, gleaming blade is adorned with intricate designs. It emits a soft glow illuminating the dark, starry cosmos that serves as its backdrop." # this is the prompt, you can change this to anything you want.

latents = sample_latents(

batch_size=batch_size,

model=model,

diffusion=diffusion,

guidance_scale=guidance_scale,

model_kwargs=dict(texts=[prompt] * batch_size),

progress=True,

clip_denoised=True,

use_fp16=True,

use_karras=True,

karras_steps=64,

sigma_min=1E-3,

sigma_max=160,

s_churn=0,
)

#渲染 3D 模型,使用 render_mode = 'nerf' 神经辐射场 (NeRF) 来渲染 3D 模型。 你可以将其更改为 render_mode = 'stf' 以使用风格传递函数 (STF) 渲染模式渲染 3D 模型。

render_mode = 'nerf' # you can change this to 'stf'
size = 64 # this is the size of the renders, higher values take longer to render.

cameras = create_pan_cameras(size, device)
for i, latent in enumerate(latents):

images = decode_latent_images(xm, latent, cameras, rendering_mode=render_mode)

display(gif_widget(images))

#将 3D 模型保存为 .ply 和 .obj 文件。注意: .obj,稍后我们将使用它在 Blender Studio 中进行自定义。

# Example of saving the latents as meshes.
from shap_e.util.notebooks import decode_latent_mesh

for i, latent in enumerate(latents):

t = decode_latent_mesh(xm, latent).tri_mesh()

with open(f'example_mesh_{i}.ply', 'wb') as f: # this is three-dimensional geometric data of model.

t.write_ply(f)

with open(f'example_mesh_{i}.obj', 'w') as f: # we will use this file to customize in Blender Studio later.

t.write_obj(f)

# Clone the repo.
!git clone https://t.cn/A6jX18IT
%cd /content/camp_zipnerf

# Make a conda environment.
!conda create --name camp_zipnerf python=3.11
!conda activate camp_zipnerf

# Prepare pip.
!conda install pip
!pip install --upgrade pip

# Install requirements.
!pip install -r requirements.txt

# Manually install rmbrualla's `pycolmap` (don't use pip's! It's different).
!git clone https://t.cn/A6jX18IH ./internal/pycolmap

# Confirm that all the unit tests pass.
!./scripts/run_all_unit_tests.sh

%cd /content
!git clone -b dev https://t.cn/A6jX0dU6

!git clone -b dev https://t.cn/A6jX0dUJ
%cd /content/threefiner
!pip install .

%cd /content/3DTopia

!apt -y install -qq aria2
!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://t.cn/A6jX0dUS -d /content/3DTopia/checkpoints -o 3dtopia_diffusion_state_dict.ckpt

!pip install -q pymcubes trimesh pytorch_lightning omegaconf einops wandb git+https://t.cn/A6qBislP kornia open-clip-torch
!pip install -q https://t.cn/A6jX0dUK
!pip install -q https://t.cn/A6jX0dUi
!pip install -q threefiner

# stage 2 - step 1

!threefiner sd --mesh results/default/stage1/example_mesh_0.ply --prompt "A mystical sword with a slender, gleaming blade is adorned with intricate designs. It emits a soft glow illuminating the dark, starry cosmos that serves as its backdrop." --text_dir --front_dir='-y' --outdir results/default/stage2/ --save A_mystical_sword_1_0_sd.glb --force_cuda_rast

# stage 2 - step 2
!threefiner if2 --mesh results/default/stage2/A_mystical_sword_1_0_sd.glb --prompt "A mystical sword with a slender, gleaming blade is adorned with intricate designs. It emits a soft glow illuminating the dark, starry cosmos that serves as its backdrop." --outdir results/default/stage2/ --save A_mystical_sword_1_0_if2.glb --force_cuda_rast

ttps://github.com/3DTopia/3DTopia

ttps://github.com/camenduru/3DTopia-jupyter

stage 1 - step 1(T4跑不动,别用T4 run)

这个a_dragon_0_0.ply就是 24-1-16 16:33
text to 3D_shap-e.
https://t.cn/A6jX0dUM

---------------------
%cd /content
!git clone -b dev https://t.cn/A6jX0dU6

!git clone -b dev https://t.cn/A6jX0dUJ
%cd /content/threefiner
!pip install .

%cd /content/3DTopia

!apt -y install -qq aria2
!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://t.cn/A6jX0dUS -d /content/3DTopia/checkpoints -o 3dtopia_diffusion_state_dict.ckpt

!pip install -q pymcubes trimesh pytorch_lightning omegaconf einops wandb git+https://t.cn/A6qBislP kornia open-clip-torch
!pip install -q https://t.cn/A6jX0dUK
!pip install -q https://t.cn/A6jX0dUi
!pip install -q threefiner

# stage 2 - step 1

!threefiner sd --mesh results/default/stage1/a_dragon_0_0.ply --prompt "a dragon" --text_dir --front_dir='-y' --outdir results/default/stage2/ --save a_dragon_1_0_sd.glb --force_cuda_rast

#成毅[超话]#Ich werde dich immer lieben und mit dir zusammen sein... 99 Umarmungen in 100 Städten, 98 Sonnenuntergänge, 97 Küsse, 96 Fotos, 95 Rosen, 94 Restaurants, 93 Meere, 92 Gassen, 91 Regenschirme, 90 Händchen halten, 89 Erdbeeren pflanzen, 88 Decken, 87 Tassen warmes Wasser, 86 Reste, 85 Filme, 84 Mittagessen, 83 Früchte schneiden, 82 Desserts essen und 81 Mal trinken. Warmer Tee braucht 80 Umarmungen, 79 Grills, 78 Spieße, 77 Hot Pot, 76 Meeresfrüchte, 75 Snacks, 74 Abendessen, 73 Gläser Hochzeitswein, 72 westliche Lebensmittel, 71 Süßigkeiten, 70 duftende Küsse, 69 Schaukel, 68 nächster Tag, 67 Gras, 66 Sternenhimmel, 65 Haare, 64 Schulterblätter, 63 Wangen, 62 Schlüsselbeinbisse, 6 Einmal Ohren, dann 60 Umarmungen, 59 Geisterfilme, 58 Tassen Milchtee, 57 Eimer Reisblumen, 56 Geschäftsgebäude, 55 Taxis, 54 Busse usw.Die U-Bahn fährt 52 Mal.


发布     👍 0 举报 写留言 🖊   
✋热门推荐
  • 张婷钰5.1_5.7日,邀请隔离的友人们共同进入亭玉的客厅,与自己的身心一起去进入放松的呼吸、冥想、寂静瑜伽,诗歌唱诵、自由舞蹈。详情请看:赠友人我想将房间陆续
  • 性感与自由是系列的代名词,亮片的光芒映射着Ibiza岛的无忧无虑,肌肤从短裙下摆、系带和镂空处自然裸露出来。秸草和拉菲草编织品是Paula’s Ibiza夏日限
  • 周星驰的一部电影改变了一座古城,如今的场景遍地都是紫霞,只是世间再无至尊宝怀着爱意 带着虔诚 保持温朋友圈背景图好看柔 追随星星不要站在雾里 不要执着于没有意义
  • #899的自话自说# の日运宝贝又要去哪儿啊(嘻嘻麻麻知道帮你保密保密)这一天一天的遥哪儿跑 而且要去某地长时间待着 也可以说是必须要做的事情/工作 行吧 宝贝
  • 心细,即以明睿的智慧处事,三思而行,审时度势,先谋后动,利人利己,事半功倍。心细,即以明睿的智慧处事,三思而行,审时度势,先谋后动,利人利己,事半功倍。
  • 期待肖战时影 肖战玉骨遥肖战顾魏 肖战余生请多指教肖战斗罗大陆 肖战唐三 肖战粉丝小飞侠理智支持肖战代言 支持肖战影视综艺 我喜欢肖战 我喜欢肖战
  • (《河阳县志》)●行像摩竭提国,年年常以建卯月八日行像,作四轮车,缚竹作五层,有承栌揠戟,高二丈馀,以白氎缠上。十一日,庙中有衙前乐,教乐所人员部领诸色乐部,诣
  • 歡迎大家加入協會,入會表格:#今非昔墨 #水墨畫 #畫展 #香港畫展 #音樂 #香港藝術 #香港大會堂 #墨寶 ##hk #hkart #artstagram
  • 也许是吧,那些开化之人喜欢的咖啡,法国的西装,与各国的舶来品,我果然与他们并无不同。阿联酋驻华大使阿里·奥贝德·扎希里博士阁下致辞道:“阿联酋一直从其秉持包容与
  • 值得一提的是,今年盈创动力将建立科技金融服务超市,实现金融服务场景与产业发展的深度结合;并打造盈创动力3.0科技金融示范新点位,与科技金融超市、企业服务工作站紧
  • 最近,左侧的头像和各项参数不见了、“博文目录”的按年搜索没了、“被推荐博文”的标识没了、“个人中心”的快速评论等没了,只能看到“喜欢”。博客怎么了如今博客系统已
  • 【实时好物[打call]】免爬楼合集来啦,如果有刚需商品也可自助搜券:【拍3件84】橘朵*泡泡玛特 哑光唇泥*3支【凑单】【94】蓝胖子 全脂/脱脂奶粉2斤【拍
  • 观众缘是靠多年积累的演技口碑垒起来的,你在wb撕B,在垃圾组造谣,在黑区️瓶,这些都不会影响到张若昀的收视率和播放量。说庆余年靠老戏骨的,男主戏份占比80%,别
  • 側田認為自己不擅長當唱片監製,由於擔心作品欠新突破,所以久久未推出新專輯,今次他滿意此專輯,更溫馨提示樂迷順曲序聽歌,會有更佳體驗,他說:「現在才開始我真正的音
  • 但是上次自从在川藏线72遇到轮胎突发情况,还顶着压力和高原反应在海拔5000米的网红景点换轮胎,时候让我觉得一款可靠的轮胎是自驾所必须配备的。这就是我郑雨薇呀[
  • 啊差点忘了,这期间其实还有位叫东哥的有偷偷带窝去眯了一眼雨爸,但又说不能公开说,大银的世界真难懂~ (摊手无辜眼)所以窝就这样很多天都沒有见过窝雨爸啦~(一脸可
  • 在第三季看了三遍之后(嗑死我了断断续续把四季都看完了看完之后甚至让我感恩起隔离生活来SKAM和sex education是我唯二看的教育片sex educati
  • 一批优质项目“收入囊中”11月8日上午,以“共赢发展 魅力龙华”为主题的2019年深圳(龙华)——西安经贸交流会在西安举办。[爱你]】21日晚上,市中心城区19
  • 以下同学,请私信与我联系,留下您的联系方式和自我介绍,小V将在新一年的录制中,选择合适的时间联络各位~今天先公布第一波,前三位获奖者~(后面七位明日继续公布,没
  • #美食探店##LiveIn 海南# 【超好喝的椰子鸡汤】三亚椰子鸡店那是相当的多,如果你还在纠结不知道去哪家店好,不妨可以去打卡椰小鸡店他家店主打绿色调,进店可