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

[Usage]: Question about VRAM requirement and temperature #347

Closed
weicheng59 opened this issue Mar 20, 2024 · 2 comments
Closed

[Usage]: Question about VRAM requirement and temperature #347

weicheng59 opened this issue Mar 20, 2024 · 2 comments

Comments

@weicheng59
Copy link

Your current environment

The output of `python env.py`
Collecting environment information...
PyTorch version: 2.2.0+cu121
Is debug build: False
CUDA used to build PyTorch: 12.1
ROCM used to build PyTorch: N/A
OS: Ubuntu 22.04.1 LTS (x86_64)
GCC version: (conda-forge gcc 11.3.0-19) 11.3.0
Clang version: Could not collect 
CMake version: version 3.27.0
Libc version: glibc-2.35
Python version: 3.11.8 | packaged by conda-forge | (main, Feb 16 2024, 20:53:32) [GCC 12.3.0] (64-bit runtime)
Python platform: Linux-6.5.0-25-generic-x86_64-with-glibc2.35
Is CUDA available: True
CUDA runtime version: 12.1.105
CUDA_MODULE_LOADING set to: LAZY
GPU models and configuration: 
GPU 0: NVIDIA GeForce RTX 4090
GPU 1: NVIDIA GeForce RTX 4090
GPU 2: NVIDIA GeForce RTX 4090
GPU 3: NVIDIA GeForce RTX 4090
GPU 4: NVIDIA GeForce RTX 4090
GPU 5: NVIDIA GeForce RTX 4090
GPU 6: NVIDIA GeForce RTX 4090
GPU 7: NVIDIA GeForce RTX 4090

Nvidia driver version: 535.161.07
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:                      43 bits physical, 48 bits virtual
Byte Order:                         Little Endian
CPU(s):                             64
On-line CPU(s) list:                0-63
Vendor ID:                          AuthenticAMD
Model name:                         AMD EPYC 7302 16-Core Processor
CPU family:                         23
Model:                              49
Thread(s) per core:                 2
Core(s) per socket:                 16
Socket(s):                          2
Stepping:                           0
Frequency boost:                    enabled
CPU max MHz:                        3000.0000
CPU min MHz:                        1500.0000
BogoMIPS:                           5999.92
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 sse4_1 sse4_2 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 hw_pstate ssbd mba ibrs ibpb stibp vmmcall fsgsbase bmi1 avx2 smep bmi2 cqm rdt_a rdseed adx smap clflushopt clwb sha_ni xsaveopt xsavec xgetbv1 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 rdpid overflow_recov succor smca sev sev_es
Virtualization:                     AMD-V
L1d cache:                          1 MiB (32 instances)
L1i cache:                          1 MiB (32 instances)
L2 cache:                           16 MiB (32 instances)
L3 cache:                           256 MiB (16 instances)
NUMA node(s):                       2
NUMA node0 CPU(s):                  0-15,32-47
NUMA node1 CPU(s):                  16-31,48-63
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:             Mitigation; untrained return thunk; SMT enabled with STIBP protection
Vulnerability Spec rstack overflow: Mitigation; Safe RET
Vulnerability Spec store bypass:    Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1:           Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2:           Mitigation; Retpolines, IBPB conditional, STIBP always-on, RSB filling, PBRSB-eIBRS Not affected
Vulnerability Srbds:                Not affected
Vulnerability Tsx async abort:      Not affected
Versions of relevant libraries:
[pip3] numpy==1.26.4
[pip3] torch==2.2.0
[pip3] triton==2.2.0
[conda] blas                      2.16                        mkl    conda-forge
[conda] libblas                   3.8.0                    16_mkl    conda-forge
[conda] libcblas                  3.8.0                    16_mkl    conda-forge
[conda] liblapack                 3.8.0                    16_mkl    conda-forge
[conda] liblapacke                3.8.0                    16_mkl    conda-forge
[conda] mkl                       2020.2                      256  
[conda] numpy                     1.26.4                   pypi_0    pypi
[conda] pytorch-cuda              12.1                 ha16c6d3_5    pytorch
[conda] pytorch-mutex             1.0                        cuda    pytorch
[conda] torch                     2.2.0                    pypi_0    pypi
[conda] torchtriton               2.2.0                     py311    pytorchROCM Version: Could not collect 
Aphrodite Version: 0.5.2
Aphrodite Build Flags:
CUDA Archs: Not Set; ROCm: Disabled

How would you like to use Aphrodite?

I want to run this (https://huggingface.co/Qwen/Qwen1.5-14B-Chat).
I used following cmd in exllamaV2 to convert the model to exl2 format in 8.0 bit.

CUDA_VISIBLE_DEVICES=3 python convert.py \
    -i /home/by/llm/base_models/Qwen1.5-14B-Chat \
    -o /home/by/llm/base_models/Qwen1.5-14B-Chat-exl2 \
    -cf /home/by/llm/base_models/Qwen1.5-14B-Chat-exl2/8bpw/ \
    -b 8.0 \
    -hb 8

then I serve the api using

CUDA_VISIBLE_DEVICES=1 ./runtime.sh python -m aphrodite.endpoints.openai.api_server \
    --model /home/by/llm/base_models/Qwen1.5-14B-Chat-exl2/8bpw \
    --gpu-memory-utilization 1 \
    --kv-cache-dtype fp8_e5m2 \
    --max-model-len 8000 \
    --served-model-name qwen1.5-14b-chat \
    --quantization exl2 \
    --port 2242 \
    --max-num-batched-tokens 8000 \
    --enforce-eager \
    --disable-custom-all-reduce \
    --disable-log-requests \
    --host 0.0.0.0

this use all my VRAM on 4090 24212MiB / 24564MiB
I notice in log, the actual model itself only take 14.07 GB. It seemed like the kv-cache takes a lot of VRAM so I cannot use max-model-len more than 8k. However when I use TabbyAPI and using the same exl2 model. I can comfortably use up to 20k context without issue. Is this by design that batching takes more VRAM so less context can be use?

Another question is about temperature when requesting. Here is my request json to http://localhost:2242/v1/chat/completions

{
    "model": "qwen1.5-14b-chat",
    "messages": [
        {
            "role": "system",
            "content": "You are a helpful assistant."
        },
        {
            "role": "user",
            "content": "Please describe spring"
        }
    ],
    "temperature": 0,
    "max_tokens": 400
}

In my understanding, setting the temperature to 0 should result the same or at least, very similar response. However I am getting very different response from model. Is there other setting I should set if I want the response to be very much the same every time I request the same input?

@sgsdxzy
Copy link
Collaborator

sgsdxzy commented Mar 20, 2024

The current prompt prefill implementation is not very memory efficient for long context. https://github.com/PygmalionAI/aphrodite-engine/tree/feat/chunk_prompt when finished should be able to address this issue.

Please make separate issues for multiple problems.

@weicheng59
Copy link
Author

Thanks for the reply. Looking forward to see the update soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants