1
0
forked from cgvr/DeltaVR

start of 3d generation pipelines

This commit is contained in:
Henri Sellis 2025-10-11 18:37:46 +03:00
parent 6b8c3b6fbb
commit 2cf0a9f711
4 changed files with 131 additions and 0 deletions

1
3d-generation-pipeline/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.venv

View File

@ -0,0 +1,105 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"id": "2c0da293",
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"c:\\Users\\henrisel.DOMENIS\\DeltaVR3DModelGeneration\\3d-generation-pipeline\\.venv\\lib\\site-packages\\tqdm\\auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n",
" from .autonotebook import tqdm as notebook_tqdm\n"
]
}
],
"source": [
"import torch\n",
"from diffusers import FluxPipeline"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "51879ff1",
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"Fetching 23 files: 0%| | 0/23 [00:00<?, ?it/s]"
]
}
],
"source": [
"model_name = \"black-forest-labs/FLUX.1-schnell\"\n",
"\n",
"pipe = FluxPipeline.from_pretrained(model_name, torch_dtype=torch.bfloat16)\n",
"#pipe.enable_model_cpu_offload() #save some VRAM by offloading the model to CPU. Remove this if you have enough GPU power"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "50a38bf4",
"metadata": {},
"outputs": [],
"source": [
"prompt = \"slightly curved sword, one side blue and other side green\"\n",
"pipe_result = pipe(\n",
" prompt,\n",
" guidance_scale=0.0,\n",
" num_inference_steps=4,\n",
" max_sequence_length=256,\n",
" generator=torch.Generator(\"gpu\")\n",
")\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "b692177a",
"metadata": {},
"outputs": [],
"source": [
"pipe_result"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "d55eb3ce",
"metadata": {},
"outputs": [],
"source": [
"image = pipe_result[\"images\"][0]\n",
"image.save(\"flux-schnell.png\")"
]
}
],
"metadata": {
"kernelspec": {
"display_name": ".venv",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.11"
}
},
"nbformat": 4,
"nbformat_minor": 5
}

View File

@ -0,0 +1,17 @@
import torch
from diffusers import StableDiffusion3Pipeline
model_name = "stabilityai/stable-diffusion-3.5-medium"
pipe = StableDiffusion3Pipeline.from_pretrained(model_name, use_safetensors=True, variant="fp16")
pipe = pipe.to("cuda")
prompt = "A cute cat eating a slice of pizza, stunning color scheme, masterpiece, illustration"
image = pipe(
prompt,
guidance_scale=3.0,
generator=torch.Generator("cuda")
).images[0]
image_name = "image.png"
image.save(image_name)

View File

@ -0,0 +1,8 @@
torch==2.8.0+cu129
transformers==4.57.0
#diffusers==0.35.1
it+https://github.com/huggingface/diffusers.git
accelerate==1.10.1
huggingface_hub[hf_xet]==1.1.10
sentencepiece==0.2.1
protobuf==6.32.1