-
Notifications
You must be signed in to change notification settings - Fork 7
Add new example #27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Add new example #27
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
||
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 --- | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
|
||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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?