ECE Undergraduate Laboratory
ECE 381 - Applied Machine Learning

ECE 381 - Applied Machine Learning Lab

Lab 4: Generative Ai – Text-To-Image And Natural Language Generation
Part I: Stable Diffusion for Text-to-Image Generation

Objective

This lab introduces students to generative AI in the visual domain through the use of Stable Diffusion, a powerful text-to-image model. Students will interact with a WebUI hosted via Docker on the Jetson Orin Nano and learn how prompt engineering and hyperparameter tuning affect the quality and diversity of generated images.


Learning Outcomes


Lab Tasks

  1. Environment Setup: Pull and launch the Docker container dustynv/stable-diffusion-webui:r36.2.0. The UI is hosted locally on http://0.0.0.0:7860.
  2. Basic Prompt Execution: Start with a fixed prompt (e.g., \An orange cat wearing a cowboy hat") and generate base output.
  3. Hyperparameter Tuning:
    • Experiment with 3 different sampling methods and analyze qualitative differences.
    • Vary sampling steps (e.g., 10, 50, 150) and observe changes in resolution and detail.
    • Adjust CFG Scale to influence prompt adherence.
    • Test different batch count and size combinations to study their impact on diversity.
    • Use different seed values and compare outputs to evaluate randomness and reproducibility.
  4. Documentation: Capture and annotate screenshots to record parameter effects and insights.

Expected Deliverables


Part II: Interactive Language Modeling with TinyLLaMA


Objective

This lab explores the application of Large Language Models (LLMs) for real-time, prompt-based natural language generation. Students will run a lightweight LLM—TinyLLaMA—within a WebUI hosted via Docker, and investigate the role of different hyperparameters in shaping output quality and coherence.


Learning Outcomes


Lab Tasks

  1. Model Setup: Pull and launch the Docker container dustynv/text-generation-webui:r36.2.0. Use the terminal-generated local URL to open the WebUI.
  2. Model Download and Load: Use the WebUI interface to download the model TheBloke/TinyLlama-1.1B-Chat-v1.0-GGUF and load the quantized model file tinyllama-1.1b-chat-v1.0.Q3_K_M.gguf.
  3. Prompt Execution: Start with a base prompt (e.g., \Tell me what you know about New Jersey Institute of Technology") and run inference.
  4. Parameter Exploration: Vary at least 3 values for each of the 10 hyperparameters available in the WebUI (e.g., temperature, top-p, top-k, repetition penalty).
  5. Output Analysis: Record changes in response length, creativity, hallucination, and repetition under different parameter settings.

Expected Deliverables