Skip to content

Commit 3fd4f3d

Browse files
authored
Merge pull request #282 from NYU-RTS/Amanda-dong
Update LLM inference docs
2 parents 060da84 + 086037b commit 3fd4f3d

3 files changed

Lines changed: 25 additions & 2 deletions

File tree

docs/hpc/08_ml_ai_hpc/05_run_hf_model.md renamed to docs/hpc/08_ml_ai_hpc/llm_inference/05_run_hf_model.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ Some of the following steps can require significant resources, so we'll move to
2222

2323
### Copy appropriate overlay file to the project directory
2424
```bash
25-
[NetID@cm001 llm_example]$ cp -rp /scratch/work/public/overlay-fs-ext3/overlay-50G-10M.ext3.gz .
25+
[NetID@cm001 llm_example]$ cp -rp /share/apps/overlay-fs-ext3/overlay-50G-10M.ext3.gz .
2626
[NetID@cm001 llm_example]$ gunzip overlay-50G-10M.ext3.gz
2727
```
2828

2929
### Launch Singularity container in read/write mode
3030
```bash
31-
[NetID@cm001 llm_example]$ singularity exec --overlay overlay-50G-10M.ext3:rw /scratch/work/public/singularity/cuda12.1.1-cudnn8.9.0-devel-ubuntu22.04.2.sif /bin/bash
31+
[NetID@cm001 llm_example]$ apptainer exec --fakeroot --overlay overlay-50G-10M.ext3:rw /share/apps/images/cuda12.1.1-cudnn8.9.0-devel-ubuntu22.04.2.sif /bin/bash
3232
```
3333

3434
### Install miniconda in the container
File renamed without changes.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Overview
2+
This directory provides two primary pathways for deploying and running Large Language Models (LLMs) on the NYU Torch/Greene cluster: Hugging Face Transformers (for research/experimentation) and vLLM (for high-performance serving).
3+
4+
## 1. Basic Inference (Hugging Face)
5+
This method is ideal for feature extraction, embeddings, or small-scale batch processing. It relies on a persistent Singularity environment using an .ext3 overlay.
6+
7+
**Workflow:**
8+
Environment: Launch an Apptainer container with a read/write overlay.
9+
Persistence: Install Conda/Miniforge and libraries directly into /ext3.
10+
Execution: Use AutoModel to load weights and perform a forward pass.
11+
Key File: huggingface.py
12+
Ideal for: Extracting last_hidden_state (embeddings) or sentiment classification.
13+
14+
## 2. High-Performance Serving (vLLM)
15+
vLLM is the recommended tool for production-level throughput and low-latency inference. It utilizes PagedAttention to manage memory efficiently.
16+
17+
**Why vLLM?**
18+
Speed: higher throughput than standard backends on Torch.
19+
Compatibility: Drop-in replacement for OpenAI API.
20+
21+
**Deployment Options:**
22+
Online: Use vllm serve to start an HTTP server accessible via curl or OpenAI clients.
23+
Offline: Use the LLM class within Python for processing large datasets without a server.

0 commit comments

Comments
 (0)