Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions examples/gcp-linux-fastchat-new-vs-old/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<p align="center">
<img src="https://github.com/intel/terraform-intel-gcp-vm/blob/main/images/logo-classicblue-800px.png?raw=true" alt="Intel Logo" width="250"/>
</p>

# Intel Cloud Optimization Modules for Terraform

© Copyright 2023, Intel Corporation

## GCP C3 4th Gen Xeon(code named Sapphire Rapids) & Intel® Cloud Optimized Recipe for FastChat

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change to Optimized Cloud Recipe?

This demo will showcase Large Language Model(LLM) CPU inference using 4th Gen Xeon Scalable Processors on GCP.

## Usage

You may need to change the appropriate IAM settings as described here: https://cloud.google.com/docs/terraform/get-started-with-terraform

1. Log on to CGP Portal
2. Enter the GCP Cloud Shell (terminal button on top right of page)
3. Run the following commands in order:

`git clone https://github.com/intel/terraform-intel-gcp-vm.git`

`cd terraform-intel-gcp-vm/examples/gcp-linux-fastchat-new-vs-old`

`terraform init`

`terraform apply`

## Running the Demo


1. **Wait ~10 minutes** for the Recipe to download/install FastChat and the LLM model before continuing
2. SSH into newly created GCP VM
3. **Run `source /usr/local/bin/run_demo.sh`**
4. If you did not choose to open a port, your app will be proxied through gradio. See https://xxxxxxx.gradio.live URL that is generated during the gradio run.
5. Otherwise, if you choose to open port 7860 in main.tf: on your computer, open a browser and navigate to **http://<VM_PLUBLIC_IP>:7860**. Get your Public IP from the "Compute Engine" section of the GCP console.

<p align="center">
<img src="https://github.com/intel/terraform-intel-gcp-vm/blob/main/images/gradio.png?raw=true" alt="Gradio_Output" width="250"/>
</p>


--- KNOWN ISSUE ---

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this still needed now, I thought we fixed this with Fowler's new example

The demo may initially fail. In this case, run

`pip install gradio==3.10`

`pip install gradio==3.35.2`

Then, run:

`source /usr/local/bin/run_demo.sh`

And navigate again using your browser.

## Pre-requisites for running on a Workstation (bypass if using GCP Cloud Shell)

1. Google Cloud CLI: https://cloud.google.com/sdk/docs/install
2. CGP account access configured: https://registry.terraform.io/providers/hashicorp/google/latest/docs/guides/provider_reference.html#running-terraform-on-your-workstation
3. Terraform: https://learn.hashicorp.com/tutorials/terraform/install-cli
4. Git: https://git-scm.com/book/en/v2/Getting-Started-Installing-Git
15 changes: 15 additions & 0 deletions examples/gcp-linux-fastchat-new-vs-old/cloud_init.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#cloud-config
package_update: true
package_upgrade: true

package:
- git

ansible:
install_method: distro
package_name: ansible
pull:
url: "https://github.com/intel/optimized-cloud-recipes.git"
playbook_name: "recipes/ai-fastchat-amx-ubuntu/recipe.yml"


58 changes: 58 additions & 0 deletions examples/gcp-linux-fastchat-new-vs-old/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
variable "project" {
type = string
description = "GCP Project ID"
}


#GCP Linux VM with Intel Cloud Optimized Recipe for FastChat
module "linux_vm" {
source = "intel/gcp-vm/intel"
project = var.project
boot_image_project = "ubuntu-os-cloud"
boot_image_family = "ubuntu-2204-lts"
name = "spr-intel-fastchat-vm"
zone = "us-central1-a"
machine_type = "c3-standard-22"
tags = ["fschat"]
user_data = templatefile("./cloud_init.yml", {})
access_config = [{
nat_ip = null
public_ptr_domain_name = null
network_tier = "PREMIUM"
}, ]
}

#GCP Linux VM with Intel Cloud Optimized Recipe for FastChat
module "linux_vm2" {
source = "intel/gcp-vm/intel"
project = var.project
boot_image_project = "ubuntu-os-cloud"
boot_image_family = "ubuntu-2204-lts"
name = "older-intel-fastchat-vm"
zone = "us-central1-a"
machine_type = "custom-22-90112"
allow_stopping_for_update = true
tags = ["fschat"]
user_data = templatefile("./cloud_init.yml", {})
access_config = [{
nat_ip = null
public_ptr_domain_name = null
network_tier = "PREMIUM"
}, ]
}

#FastChat Gradio Webserver can be accessed by the Gradio Proxy. See https://xxxxxxx.gradio.live URL that is generated during the gradio run
#You can also access it directly on the VM Public IP on Port 7860, http://<VM_PLUBLIC_IP>:7860
resource "google_compute_firewall" "rules" {
project = var.project
name = "fastchat-firewall"
network = "default"
description = "Allows access to FastChat Webserver."

allow {
protocol = "tcp"
ports = ["7860"]
}
source_ranges = [ "0.0.0.0/0" ]
target_tags = ["fschat"]
}