Update requirements.txt
Browse files- requirements.txt +9 -124
requirements.txt
CHANGED
|
@@ -1,124 +1,9 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
"import torch\n",
|
| 11 |
-
"\n",
|
| 12 |
-
"from shap_e.diffusion.sample import sample_latents\n",
|
| 13 |
-
"from shap_e.diffusion.gaussian_diffusion import diffusion_from_config\n",
|
| 14 |
-
"from shap_e.models.download import load_model, load_config\n",
|
| 15 |
-
"from shap_e.util.notebooks import create_pan_cameras, decode_latent_images, gif_widget"
|
| 16 |
-
]
|
| 17 |
-
},
|
| 18 |
-
{
|
| 19 |
-
"cell_type": "code",
|
| 20 |
-
"execution_count": null,
|
| 21 |
-
"id": "8eed3a76",
|
| 22 |
-
"metadata": {},
|
| 23 |
-
"outputs": [],
|
| 24 |
-
"source": [
|
| 25 |
-
"device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')"
|
| 26 |
-
]
|
| 27 |
-
},
|
| 28 |
-
{
|
| 29 |
-
"cell_type": "code",
|
| 30 |
-
"execution_count": null,
|
| 31 |
-
"id": "2d922637",
|
| 32 |
-
"metadata": {},
|
| 33 |
-
"outputs": [],
|
| 34 |
-
"source": [
|
| 35 |
-
"xm = load_model('transmitter', device=device)\n",
|
| 36 |
-
"model = load_model('text300M', device=device)\n",
|
| 37 |
-
"diffusion = diffusion_from_config(load_config('diffusion'))"
|
| 38 |
-
]
|
| 39 |
-
},
|
| 40 |
-
{
|
| 41 |
-
"cell_type": "code",
|
| 42 |
-
"execution_count": null,
|
| 43 |
-
"id": "53d329d0",
|
| 44 |
-
"metadata": {},
|
| 45 |
-
"outputs": [],
|
| 46 |
-
"source": [
|
| 47 |
-
"batch_size = 4\n",
|
| 48 |
-
"guidance_scale = 15.0\n",
|
| 49 |
-
"prompt = \"a shark\"\n",
|
| 50 |
-
"\n",
|
| 51 |
-
"latents = sample_latents(\n",
|
| 52 |
-
" batch_size=batch_size,\n",
|
| 53 |
-
" model=model,\n",
|
| 54 |
-
" diffusion=diffusion,\n",
|
| 55 |
-
" guidance_scale=guidance_scale,\n",
|
| 56 |
-
" model_kwargs=dict(texts=[prompt] * batch_size),\n",
|
| 57 |
-
" progress=True,\n",
|
| 58 |
-
" clip_denoised=True,\n",
|
| 59 |
-
" use_fp16=True,\n",
|
| 60 |
-
" use_karras=True,\n",
|
| 61 |
-
" karras_steps=64,\n",
|
| 62 |
-
" sigma_min=1e-3,\n",
|
| 63 |
-
" sigma_max=160,\n",
|
| 64 |
-
" s_churn=0,\n",
|
| 65 |
-
")"
|
| 66 |
-
]
|
| 67 |
-
},
|
| 68 |
-
{
|
| 69 |
-
"cell_type": "code",
|
| 70 |
-
"execution_count": null,
|
| 71 |
-
"id": "633da2ec",
|
| 72 |
-
"metadata": {},
|
| 73 |
-
"outputs": [],
|
| 74 |
-
"source": [
|
| 75 |
-
"render_mode = 'nerf' # you can change this to 'stf'\n",
|
| 76 |
-
"size = 64 # this is the size of the renders; higher values take longer to render.\n",
|
| 77 |
-
"\n",
|
| 78 |
-
"cameras = create_pan_cameras(size, device)\n",
|
| 79 |
-
"for i, latent in enumerate(latents):\n",
|
| 80 |
-
" images = decode_latent_images(xm, latent, cameras, rendering_mode=render_mode)\n",
|
| 81 |
-
" display(gif_widget(images))"
|
| 82 |
-
]
|
| 83 |
-
},
|
| 84 |
-
{
|
| 85 |
-
"cell_type": "code",
|
| 86 |
-
"execution_count": null,
|
| 87 |
-
"id": "85a4dce4",
|
| 88 |
-
"metadata": {},
|
| 89 |
-
"outputs": [],
|
| 90 |
-
"source": [
|
| 91 |
-
"# Example of saving the latents as meshes.\n",
|
| 92 |
-
"from shap_e.util.notebooks import decode_latent_mesh\n",
|
| 93 |
-
"\n",
|
| 94 |
-
"for i, latent in enumerate(latents):\n",
|
| 95 |
-
" t = decode_latent_mesh(xm, latent).tri_mesh()\n",
|
| 96 |
-
" with open(f'example_mesh_{i}.ply', 'wb') as f:\n",
|
| 97 |
-
" t.write_ply(f)\n",
|
| 98 |
-
" with open(f'example_mesh_{i}.obj', 'w') as f:\n",
|
| 99 |
-
" t.write_obj(f)"
|
| 100 |
-
]
|
| 101 |
-
}
|
| 102 |
-
],
|
| 103 |
-
"metadata": {
|
| 104 |
-
"kernelspec": {
|
| 105 |
-
"display_name": "Python 3 (ipykernel)",
|
| 106 |
-
"language": "python",
|
| 107 |
-
"name": "python3"
|
| 108 |
-
},
|
| 109 |
-
"language_info": {
|
| 110 |
-
"codemirror_mode": {
|
| 111 |
-
"name": "ipython",
|
| 112 |
-
"version": 3
|
| 113 |
-
},
|
| 114 |
-
"file_extension": ".py",
|
| 115 |
-
"mimetype": "text/x-python",
|
| 116 |
-
"name": "python",
|
| 117 |
-
"nbconvert_exporter": "python",
|
| 118 |
-
"pygments_lexer": "ipython3",
|
| 119 |
-
"version": "3.11.3"
|
| 120 |
-
}
|
| 121 |
-
},
|
| 122 |
-
"nbformat": 4,
|
| 123 |
-
"nbformat_minor": 5
|
| 124 |
-
}
|
|
|
|
| 1 |
+
torch==2.0.1
|
| 2 |
+
torchvision==0.15.2
|
| 3 |
+
diffusers==0.19.3
|
| 4 |
+
transformers==4.30.2
|
| 5 |
+
gradio==3.39.0
|
| 6 |
+
numpy==1.23.5
|
| 7 |
+
Pillow==9.5.0
|
| 8 |
+
requests==2.31.0
|
| 9 |
+
xformers==0.0.20
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|