以下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
#存储库克隆到你的 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
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.
✋热门推荐