--- library_name: transformers tags: [] --- # Cephalo-Gemma-3-4b ```python import torch from transformers import AutoProcessor, Gemma3ForConditionalGeneration from transformers.image_utils import load_image from PIL import Image as PILImage ckpt = "lamm-mit/Cephalo-Gemma-3-4b-it-04-15-2025" model = Gemma3ForConditionalGeneration.from_pretrained( ckpt, device_map="auto", torch_dtype=torch.bfloat16, ) processor = AutoProcessor.from_pretrained(ckpt) image=PILImage.open(f'./spiderweb.png').convert("RGB") messages = [ { "role": "system", "content": [ {"type": "text", "text": "You are a materials scientist."} ], "role": "user", "content": [ {"type": "image", "image": image}, {"type": "text", "text": "What does this image show? Provide a detailed analysis."} ] } ] inputs = processor.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt" ).to(model.device) input_len = inputs["input_ids"].shape[-1] generation = model.generate(**inputs, max_new_tokens=512, do_sample=False) generation = generation[0][input_len:] decoded = processor.decode(generation, skip_special_tokens=True) print(decoded) ``` Output: ```raw The image shows a comparison between a 3D model of a structure and its physical 3D printed counterpart. The top part of the image displays a 3D model of a structure, which is a complex geometric design with multiple interconnected lines and angles. The model is likely created using computer-aided design (CAD) software, which allows for precise and detailed representation of the structure. The bottom part of the image shows the physical 3D printed version of the same structure. The printed object is a tangible representation of the CAD model, with the same geometric design and intricate details. The printed object is placed on a surface, which could be a table or a platform, and is illuminated to highlight its three-dimensional form. The comparison between the 3D model and the physical 3D printed object demonstrates the accuracy and fidelity of the 3D printing process. The printed object closely resembles the CAD model, indicating that the 3D printing technology can accurately reproduce complex geometric designs. The results shown in the image highlight the potential of 3D printing for creating complex and intricate structures with high precision and accuracy. This technology has various applications in fields such as manufacturing, engineering, and design, where the ability to create precise and detailed objects is crucial. ```