Skip to content
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

[Bug]: Inconsistent Output from OPT-x models #5833

Open
NihalPotdar opened this issue Jun 25, 2024 · 0 comments
Open

[Bug]: Inconsistent Output from OPT-x models #5833

NihalPotdar opened this issue Jun 25, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@NihalPotdar
Copy link

Your current environment

Collecting environment information...
PyTorch version: 2.3.0+cu121
Is debug build: False
CUDA used to build PyTorch: 12.1
ROCM used to build PyTorch: N/A

OS: Ubuntu 22.04.4 LTS (x86_64)
GCC version: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
Clang version: Could not collect
CMake version: version 3.29.3
Libc version: glibc-2.35

Python version: 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0] (64-bit runtime)
Python platform: Linux-5.15.0-112-generic-x86_64-with-glibc2.35
Is CUDA available: True
CUDA runtime version: Could not collect
CUDA_MODULE_LOADING set to: LAZY
GPU models and configuration:
GPU 0: NVIDIA RTX A6000
GPU 1: NVIDIA RTX A6000

Nvidia driver version: 545.23.08
cuDNN version: Could not collect
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

CPU:
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Address sizes: 48 bits physical, 48 bits virtual
Byte Order: Little Endian
CPU(s): 24
On-line CPU(s) list: 0-23
Vendor ID: AuthenticAMD
Model name: AMD Ryzen Threadripper PRO 5945WX 12-Cores
CPU family: 25
Model: 8
Thread(s) per core: 2
Core(s) per socket: 12
Socket(s): 1
Stepping: 2
Frequency boost: enabled
CPU max MHz: 7014.8428
CPU min MHz: 1800.0000
BogoMIPS: 8184.12
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid aperfmperf rapl pni pclmulqdq monitor ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_llc mwaitx cpb cat_l3 cdp_l3 invpcid_single hw_pstate ssbd mba ibrs ibpb stibp vmmcall fsgsbase bmi1 avx2 smep bmi2 erms invpcid cqm rdt_a rdseed adx smap clflushopt clwb sha_ni xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local clzero irperf xsaveerptr rdpru wbnoinvd amd_ppin arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold avic v_vmsave_vmload vgif v_spec_ctrl umip pku ospke vaes vpclmulqdq rdpid overflow_recov succor smca fsrm
Virtualization: AMD-V
L1d cache: 384 KiB (12 instances)
L1i cache: 384 KiB (12 instances)
L2 cache: 6 MiB (12 instances)
L3 cache: 64 MiB (2 instances)
NUMA node(s): 2
NUMA node0 CPU(s): 0-11
NUMA node1 CPU(s): 12-23
Vulnerability Gather data sampling: Not affected
Vulnerability Itlb multihit: Not affected
Vulnerability L1tf: Not affected
Vulnerability Mds: Not affected
Vulnerability Meltdown: Not affected
Vulnerability Mmio stale data: Not affected
Vulnerability Retbleed: Not affected
Vulnerability Spec rstack overflow: Mitigation; safe RET, no microcode
Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl and seccomp
Vulnerability Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2: Mitigation; Retpolines; IBPB conditional; IBRS_FW; STIBP always-on; RSB filling; PBRSB-eIBRS Not affected; BHI Not affected
Vulnerability Srbds: Not affected
Vulnerability Tsx async abort: Not affected

Versions of relevant libraries:
[pip3] fast-pytorch-kmeans==0.2.0.1
[pip3] numpy==1.26.4
[pip3] nvidia-nccl-cu12==2.20.5
[pip3] optree==0.11.0
[pip3] torch==2.3.0
[pip3] torchprofile==0.0.4
[pip3] torchvision==0.18.0
[pip3] transformers==4.41.2
[pip3] triton==2.3.0
[conda] Could not collect
ROCM Version: Could not collect
Neuron SDK Version: N/A
vLLM Version: 0.4.3
vLLM Build Flags:
CUDA Archs: Not Set; ROCm: Disabled; Neuron: Disabled
GPU Topology:
GPU0 GPU1 CPU Affinity NUMA Affinity GPU NUMA ID
GPU0 X NV4 0-23 0-1 N/A
GPU1 NV4 X 0-23 0-1 N/A

Legend:

X = Self
SYS = Connection traversing PCIe as well as the SMP interconnect between NUMA nodes (e.g., QPI/UPI)
NODE = Connection traversing PCIe as well as the interconnect between PCIe Host Bridges within a NUMA node
PHB = Connection traversing PCIe as well as a PCIe Host Bridge (typically the CPU)
PXB = Connection traversing multiple PCIe bridges (without traversing the PCIe Host Bridge)
PIX = Connection traversing at most a single PCIe bridge
NV# = Connection traversing a bonded set of # NVLinks

🐛 Describe the bug

Recently, I have been experimenting with the opt models on VLLM and I am noticing that their output is non-sensical. For comparison, I have tested the same models by loading them with fast-api and hugging face. While the output produced by VLLM is odd and does not make sense relative to the prompt, the outputs produced by these other sources are consistent with what is expected. From my testing, this seems to be the same for any of the opt-x models and not only the opt-13b in the code below. On the same hardware and configurations, I have also tested other models through vllm and these were okay. Seems like the wrong model is being loaded?

My code is attached below for validation:

VLLM:
python -m vllm.entrypoints.openai.api_server --model facebook/opt-13b --dtype auto

Fast-API:

from transformers import AutoModelForCausalLM, TFAutoModelForCausalLM,  AutoTokenizer, AutoModelForMaskedLM, BitsAndBytesConfig
from huggingface_hub import login
from fastapi import FastAPI, HTTPException

# make sure you're logged in to HF
device = "cuda" # the device to load the model onto

app = FastAPI()

model_str = "facebook/opt-13b"
model_optimized = AutoModelForCausalLM.from_pretrained(model_str, device_map="auto")
tokenizer = AutoTokenizer.from_pretrained(model_str)

@app.post("/generate")
async def generate_text(prompt: str):
    inputs = tokenizer([prompt], return_tensors="pt")
    model_inputs = inputs.to(device)
    generated_ids = model_optimized.generate(**model_inputs, do_sample=True)
    decoded = tokenizer.batch_decode(generated_ids)
    return decoded

if __name__ == "__main__":
    import uvicorn
    uvicorn.run(app, host="0.0.0.0", port=8000)

Request for server:

from requests import get, post

url = "http://localhost:8000"

response = get(url)

print(response.status_code)
print(response.text)

response = post(url + "/generate?prompt=tell me about mayonaisse")
print(response.status_code)
print(response.text)
from openai import OpenAI

client = OpenAI(
    base_url="http://localhost:8000/v1",
    api_key="test",
)

completion = client.chat.completions.create(
    model="facebook/opt-13b",
    messages=[
        {"role": "user", "content": "tell me about mayonaisse"}
    ],
    max_tokens=100
)

print(completion.choices[0].message)

VLLM output: ChatCompletionMessage(content="It's not a bug, you can disable it in the settings.\nI know, but you can still get it if you swim too fast/far and your screen is shaking.\nI know, but the OP said you could only get it if you were swimming and not moving...", role='assistant', function_call=None, tool_calls=None)
fast-api output: ["</s>tell me about mayonaisse\nI like to dip my pizza rolls in it.</s>"]

Hardware: Nvidia RTX-A6000

@NihalPotdar NihalPotdar added the bug Something isn't working label Jun 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant