How to make 3D models from text using AI for 3D printing
HTML-код
- Опубликовано: 10 июн 2023
- Accelerate your 3D printing journey: www.kickstarter.com/projects/...
Newly released code allows you to create actual 3D models directly from text and you can 3D print them!
SHAP-E CODE:
__________
Code snippet #1
!git clone github.com/openai/shap-e.git
__________
Code snippet #2
%cd shap-e
__________
Code snippet #3
!pip install -e .
__________
Code snippet #4
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
__________
Code snippet #5
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
__________
Code snippet #6
xm = load_model('transmitter', device=device)
model = load_model('text300M', device=device)
diffusion = diffusion_from_config(load_config('diffusion'))
__________
Code snippet #7
batch_size = 4
guidance_scale = 15.0
prompt = "shark"
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,
)
__________
Code snippet #8
render_mode = 'nerf' # you can change this to 'stf'
size = 128 # 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))
__________
Code snippet #9
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'shark_mesh_{i}.ply', 'wb') as f:
t.write_ply(f)
with open(f'shark_mesh_{i}.obj', 'w') as f:
t.write_obj(f)
This is amizing! thanks for helping the newbies like me start in this the easiest way!
Works good. This is the beginning of the 3d AI era, a year from now it might be all over for people who cant use AI to make art or 3D
very unlikely its inside a year. Classic first failings of all humans (myself included) is to see something cool and vastly underestimate the timeframe its going to take. A point a colleague made today. How many people use voice for text? you wrote this with a keyboard, yet voice to text has existed for like 2 decades. Where's VR? Then ask yourself, whats the realistic timescale that AI is generating models (in a way that actually competes vs a skilled competent person). Its going to be quite some time before an AI can beat a skilled persons when doing complex modelling that requires things like stress analysis. Sure gimmicky shit, AI got that down.
@@robertproudfoot7990 stable diffusion went from crap to perfection in 6 months, I think you underestimate how fast this is all moving
Anyone can use AI to make art or 3D (or anything). That is the point of those AI tools. The barrier to entry is close to 0. As long as those AI remain tools in the sense that they do not act as AGI, they will need human imput. It will thus be like photography. The barrier to taking a photo is having a camera or a cellphone. But not anyone can be a good/great photographer; that requires skills other than simply being able to manipulate a camera. In the same vein (and as long as we don't have AGI) those who currently are good artists will be able to make use of AI to create things that people with no artistic skills could not. And when we have AGI well... that's a wrap on pretty much everything.
@@aegisgfx I used this all day yesterday and I wish it was ready but its not. Will need another 6 months or so. But these models are unusable lmao
@@NickyPerry-zy6xw well it depends, if you get a low res shark out of it then you can take that into sculpt mode, up the res and sculpt in the details. So its working we for creating base models at the moment in my opinion
This is insane, thanks for rhe tut, if u have any more tips or tricks to use with this AI pls do more vids of dem
This was really helpful ..thank you so much !
Thank you!
very cool
to bad this is not shoing in youtube search what so ever...This is exacly what i was looking for...Took mee weeks to find this where you not need any whitelist or buying some wrong ai acces...
very big thanks from my side!
I noticed that the repository does not specify a license. Could you please clarify if the code is open for public use, and if so, if there are any specific terms or conditions I should be aware of? I want to ensure that I respect the original author's intentions and comply with any applicable licensing terms.
import it into Z brush and refine it and add textures lol, Fast workflow dude
Can this be run inside of jyputer notebook locally? But yes mike is right! this is very cool!!
code snippet 6 isnt working for me, it says it should have hash (bunch of letters and numbers) but has (different letters and numbers) try deleting and running this call again. i keep trying that but isnt working.
i have like 0 coding knowledge so yaaa..
How to integrate this in android studio for app
Why not just make a colab notebook with all the stuff in it and share the ipynb?
ya I wondered that too
can frosting ai work?
I received "SHA256 checksum does not match" on #7 text300M load_model
I ran the code again and it worked. It said it re-downloaded the file.
Please help!!!!!!!!!!
batch_size = 4
guidance_scale = 15.0
prompt = "shark"
-> 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,
)
"NameError: name 'latents' is not defined". Please help!!!!
when I try this it is saying error for this line: latents = sample_latents( any ideas how to fix this?
Did you change the notebook settings to "GPU"? 0:14
Make sure you do that before everything else
@@3DPrinterAcademy Yeah, I followed all the steps exactly. It's very odd
you can also use GPT4 to help debug coding errors. Just ask the AI, "what does this error message mean: (past error message)"
It can be very helpful!
@@3DPrinterAcademyTutorials ah yeah, good point. thanks :)
how did you fix this? I'm getting the same error
What code snippet???????????????????????
Check the description of the video.
God forbid having it in a proper, easy ti use GUI aint'it ? elitist gonna be eliti-ing?
Hello Thanks for this content!! So everything was fine i changes the prompt to "sunglasses" and it made them but the last part to save them for download and after this final snippet "# 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'sunglasses_mesh_{i}.ply', 'wb') as f:
t.write_ply(f)
with open(f'sunglasses_mesh_{i}.obj', 'w') as f:
t.write_obj(f)" Nothing happens it just completes the run in 4 seconds