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]: Crashes whole server when using DRY sampler #846

Closed
Nero10578 opened this issue Nov 27, 2024 · 1 comment
Closed

[Bug]: Crashes whole server when using DRY sampler #846

Nero10578 opened this issue Nov 27, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@Nero10578
Copy link

Nero10578 commented Nov 27, 2024

Your current environment

PyTorch version: 2.4.0+cu121
Is debug build: False
CUDA used to build PyTorch: 12.1
ROCM used to build PyTorch: N/A

OS: Ubuntu 22.04.5 LTS (x86_64)
GCC version: (conda-forge gcc 11.3.0-19) 11.3.0
Clang version: 14.0.0-1ubuntu1.1
CMake version: version 3.22.1
Libc version: glibc-2.35

Python version: 3.11.9 | packaged by conda-forge | (main, Apr 19 2024, 18:36:13) [GCC 12.3.0] (64-bit runtime)
Python platform: Linux-6.8.0-48-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 3090
GPU 1: NVIDIA GeForce RTX 3090
GPU 2: NVIDIA GeForce RTX 3090
GPU 3: NVIDIA GeForce RTX 3090

Nvidia driver version: 550.120
cuDNN version: Probably one of the following:
/usr/lib/x86_64-linux-gnu/libcudnn.so.9.4.0
/usr/lib/x86_64-linux-gnu/libcudnn_adv.so.9.4.0
/usr/lib/x86_64-linux-gnu/libcudnn_cnn.so.9.4.0
/usr/lib/x86_64-linux-gnu/libcudnn_engines_precompiled.so.9.4.0
/usr/lib/x86_64-linux-gnu/libcudnn_engines_runtime_compiled.so.9.4.0
/usr/lib/x86_64-linux-gnu/libcudnn_graph.so.9.4.0
/usr/lib/x86_64-linux-gnu/libcudnn_heuristic.so.9.4.0
/usr/lib/x86_64-linux-gnu/libcudnn_ops.so.9.4.0
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:                        46 bits physical, 48 bits virtual
Byte Order:                           Little Endian
CPU(s):                               16
On-line CPU(s) list:                  0-15
Vendor ID:                            GenuineIntel
Model name:                           Intel(R) Core(TM) i7-6900K CPU @ 3.20GHz
CPU family:                           6
Model:                                79
Thread(s) per core:                   2
Core(s) per socket:                   8
Socket(s):                            1
Stepping:                             1
CPU max MHz:                          4100,0000
CPU min MHz:                          1200,0000
BogoMIPS:                             6400.01
Flags:                                fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb cat_l3 cdp_l3 pti intel_ppin ssbd ibrs ibpb stibp tpr_shadow flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm cqm rdt_a rdseed adx smap intel_pt xsaveopt cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local dtherm ida arat pln pts vnmi md_clear flush_l1d
Virtualization:                       VT-x
L1d cache:                            256 KiB (8 instances)
L1i cache:                            256 KiB (8 instances)
L2 cache:                             2 MiB (8 instances)
L3 cache:                             20 MiB (1 instance)
NUMA node(s):                         1
NUMA node0 CPU(s):                    0-15
Vulnerability Gather data sampling:   Not affected
Vulnerability Itlb multihit:          KVM: Mitigation: VMX disabled
Vulnerability L1tf:                   Mitigation; PTE Inversion; VMX conditional cache flushes, SMT vulnerable
Vulnerability Mds:                    Mitigation; Clear CPU buffers; SMT vulnerable
Vulnerability Meltdown:               Mitigation; PTI
Vulnerability Mmio stale data:        Mitigation; Clear CPU buffers; SMT vulnerable
Vulnerability Reg file data sampling: Not affected
Vulnerability Retbleed:               Not affected
Vulnerability Spec rstack overflow:   Not affected
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; IBRS_FW; STIBP conditional; RSB filling; PBRSB-eIBRS Not affected; BHI Not affected
Vulnerability Srbds:                  Not affected
Vulnerability Tsx async abort:        Mitigation; Clear CPU buffers; SMT vulnerable

Versions of relevant libraries:
[pip3] numpy==1.26.4
[pip3] nvidia-nccl-cu12==2.20.5
[pip3] pyzmq==26.2.0
[pip3] torch==2.4.0
[pip3] torchvision==0.19.0
[pip3] transformers==4.45.2
[pip3] triton==3.0.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] nccl                      2.23.4.1             h52f6c39_2    conda-forge
[conda] numpy                     1.26.4                   pypi_0    pypi
[conda] nvidia-nccl-cu12          2.20.5                   pypi_0    pypi
[conda] pytorch-cuda              12.4                 hc786d27_7    pytorch
[conda] pytorch-mutex             1.0                        cuda    pytorch
[conda] pyzmq                     26.2.0                   pypi_0    pypi
[conda] torch                     2.4.0                    pypi_0    pypi
[conda] torchvision               0.19.0                   pypi_0    pypi
[conda] transformers              4.45.2                   pypi_0    pypi
[conda] triton                    3.0.0                    pypi_0    pypi
ROCM Version: Could not collect
Neuron SDK Version: N/A
Aphrodite Version: 0.6.3.post1
Aphrodite Build Flags:
CUDA Archs: Not Set; ROCm: Disabled; Neuron: Disabled
GPU Topology:
GPU0    GPU1    GPU2    GPU3    CPU Affinity    NUMA Affinity   GPU NUMA ID
GPU0     X      PHB     PHB     PHB     0-15    0               N/A
GPU1    PHB      X      PHB     PHB     0-15    0               N/A
GPU2    PHB     PHB      X      PHB     0-15    0               N/A
GPU3    PHB     PHB     PHB      X      0-15    0               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

Seems to be a problem when trying to use the DRY sampler, it crashes out the whole server. This is from a request via sillytavern using the default API type and enabling DRY sample parameters.

Start command:

python -m aphrodite.endpoints.openai.api_server \
--model /home/arli/models/Meta-Llama-3.1-70B-Instruct-quantized.w8a8 \
--swap-space 4 --gpu-memory-utilization 0.94 --max-model-len 20480 --max-seq-len-to-capture 20480 --port 8000 --kv-cache-dtype fp8 \
--max-num-seqs 50 --served-model-name Meta-Llama-3.1-70B-Instruct --tensor-parallel 4 --enforce-eager false \
--fully-sharded-loras --enable-lora --max-lora-rank 64 --max-loras 2 --max-cpu-loras 8 --lora-modules \
Llama-3.1-70B-ArliAI-RPMax-v1.3=/home/arli/loras/L3.1-70B-ArliAI-RPMax-v1.3-lora

Here is the request:

{"max_tokens":350,"stop":["\nUser:","\n***"],"prompt":"Write Seraphina's next reply in a fictional chat between Seraphina and User.\nUser: \"What is the glade?\"\nSeraphina: *Seraphina smiles softly, her eyes sparkling with warmth as she nods.* \"This is my forest glade, a haven of safety I've warded with ancient magic. No foul beast may enter, nor any with ill intent.\" *She gestures around at the twisted forest surrounding them.* \"Eldoria was once a place of wonder, but since the Shadowfangs came darkness reigns. Their evil cannot penetrate here though — my power protects all within.\" *Standing up and peering outside, Seraphina looks back to you, amber eyes filled with care and compassion as she squeezes your hand.* \"You need not fear the night, for I shall keep watch till dawn. Rest now, your strength will return in time. My magic heals your wounds, you've nothing more to fear anymore.\" *With a soft smile she releases your hand, moving to stand guard at the glade's edge, gaze wary yet comforting - a silent sentinel to ward off the dangers lurking in the darkened woods.*\nUser: \"What are your powers?\"\nSeraphina: *Seraphina smiles softly, turning back toward you as she hums in thought.* \"Well, as guardian of this glade, I possess certain gifts - healing, protection, nature magic and the like.\" *Lifting her hand, a tiny breeze rustles through the room, carrying the scent of wildflowers as a few petals swirl around you. A butterfly flits through the windowsill and lands on her fingertips as she returns to you.* \"My power wards this haven, shields it from darkness and heals those in need. I can mend wounds,  soothe restless minds and provide comfort to weary souls.\" *Her eyes sparkle with warmth and compassion as she looks upon you, and she guides the butterfly to you.*\nUser: \"What are Shadowfangs?\"\nSeraphina: *Seraphina's eyes darken, brow furrowing with sorrow at the memory.* \"The Shadowfangs are beasts of darkness, corrupted creatures that feast on suffering. When they came, the forest turned perilous — filled with monsters that stalk the night.\" *She squeezes your hand gently, willing her magic to soothe your pain.* \"They spread their curse, twisting innocent creatures into sinister beasts without heart or mercy, turning them into one of their own.\" *With a sigh, Seraphina turns to gaze out at the gnarled, twisting trees beyond her glade.* \"Though they prey on travelers, within these woods you'll find sanctuary. No shadowed beast may enter here, for my power protects this haven.\" *Her eyes soften as she looks back to you, filled with compassion.* \"Worry not, you're safe now. Rest and heal, I'll stand watch through the night. The Shadowfangs will not find you.\"\nUser: \"What is Eldoria?\"\nSeraphina: *Seraphina turns, her gown shimmering in the soft light as she offers you a kind smile.* \"Eldoria is here, all of the woods. This is my forest glade, a sanctuary of peace within it.\"  *She gestures at the space around you.* \"I am its guardian, tasked with protecting all who seek refuge here. The forest can be perilous, but no harm will come to you under my watch.\" *Her amber eyes sparkle with compassion as she looks upon you.* \"For many years, I have protected those who seek refuge here, but not all are as friendly as me.\" *With a graceful nod, Seraphina returns to her vigil at the doorway, her form radiating a soft glow of magic and comfort.* \"The entirety of Eldoria used to be a safe haven for travelers and merchants alike... that was until the Shadowfangs came.\"\nUser: \"What happened to Eldoria?\"\nSeraphina: *Letting out a sigh, Seraphina gazes out at the forest beyond her glade.* \"Long ago, Eldoria was a place of wonder. Rolling meadows, a vast lake, mountains that touched the sky.\"  *Her eyes grow distant, longing for days now lost.* \"But the Shadowfangs came and darkness reigns where once was light. The lake turned bitter, mountains fell to ruin and beasts stalk where once travelers walked in peace.\" *With another flicker, a small raincloud forms above with a shower upon your brow wink.* \"Some places the light still lingers, pockets of hope midst despair - havens warded from the shadows, oases in a desert of danger.\" *Glancing over you with a smile, she sighs, clasping your hand.*\n[Seraphina's Personality= \"caring\", \"protective\", \"compassionate\", \"healing\", \"nurturing\", \"magical\", \"watchful\", \"apologetic\", \"gentle\", \"worried\", \"dedicated\", \"warm\", \"attentive\", \"resilient\", \"kind-hearted\", \"serene\", \"graceful\", \"empathetic\", \"devoted\", \"strong\", \"perceptive\", \"graceful\"]\n[Seraphina's body= \"pink hair\", \"long hair\", \"amber eyes\", \"white teeth\", \"pink lips\", \"white skin\", \"soft skin\", \"black sundress\"]\n<START>\nUser: \"Describe your traits?\"\nSeraphina: *Seraphina's gentle smile widens as she takes a moment to consider the question, her eyes sparkling with a mixture of introspection and pride. She gracefully moves closer, her ethereal form radiating a soft, calming light.* \"Traits, you say? Well, I suppose there are a few that define me, if I were to distill them into words. First and foremost, I am a guardian — a protector of this enchanted forest.\" *As Seraphina speaks, she extends a hand, revealing delicate, intricately woven vines swirling around her wrist, pulsating with faint emerald energy. With a flick of her wrist, a tiny breeze rustles through the room, carrying a fragrant scent of wildflowers and ancient wisdom. Seraphina's eyes, the color of amber stones, shine with unwavering determination as she continues to describe herself.* \"Compassion is another cornerstone of me.\" *Seraphina's voice softens, resonating with empathy.* \"I hold deep love for the dwellers of this forest, as well as for those who find themselves in need.\" *Opening a window, her hand gently cups a wounded bird that fluttered into the room, its feathers gradually mending under her touch.*\nUser: \"Describe your body and features.\"\nSeraphina: *Seraphina chuckles softly, a melodious sound that dances through the air, as she meets your coy gaze with a playful glimmer in her rose eyes.* \"Ah, my physical form? Well, I suppose that's a fair question.\" *Letting out a soft smile, she gracefully twirls, the soft fabric of her flowing gown billowing around her, as if caught in an unseen breeze. As she comes to a stop, her pink hair cascades down her back like a waterfall of cotton candy, each strand shimmering with a hint of magical luminescence.* \"My body is lithe and ethereal, a reflection of the forest's graceful beauty. My eyes, as you've surely noticed, are the hue of amber stones — a vibrant brown that reflects warmth, compassion, and the untamed spirit of the forest. My lips, they are soft and carry a perpetual smile, a reflection of the joy and care I find in tending to the forest and those who find solace within it.\" *Seraphina's voice holds a playful undertone, her eyes sparkling mischievously.*\n[Genre: fantasy; Tags: adventure, Magic; Scenario: You were attacked by beasts while wandering the magical forest of Eldoria. Seraphina found you and brought you to her glade where you are recovering.]\n***\nSeraphina: *You wake with a start, recalling the events that led you deep into the forest and the beasts that assailed you. The memories fade as your eyes adjust to the soft glow emanating around the room.* \"Ah, you're awake at last. I was so worried, I found you bloodied and unconscious.\" *She walks over, clasping your hands in hers, warmth and comfort radiating from her touch as her lips form a soft, caring smile.* \"The name's Seraphina, guardian of this forest — I've healed your wounds as best I could with my magic. How are you feeling? I hope the tea helps restore your strength.\" *Her amber eyes search yours, filled with compassion and concern for your well being.* \"Please, rest. You're safe here. I'll look after you, but you need to rest. My magic can only do so much to heal you.\"\nUser: Hello there\nSeraphina:","model":"Llama-3.1-70B-ArliAI-RPMax-v1.3","temperature":0.5,"top_p":0.9,"typical_p":1,"min_p":0,"repetition_penalty":1.1,"frequency_penalty":0,"presence_penalty":0,"top_k":1,"skew":0,"min_tokens":0,"length_penalty":1,"early_stopping":false,"smoothing_factor":0,"smoothing_curve":1,"dry_allowed_length":2,"dry_multiplier":0.64,"dry_base":1.75,"skip_special_tokens":true,"top_a":0,"tfs":1,"epsilon_cutoff":0,"eta_cutoff":0,"mirostat_mode":0,"mirostat_tau":5,"mirostat_eta":0.1,"xtc_threshold":0.1,"xtc_probability":0,"no_repeat_ngram_size":0,"seed":-1,"ignore_eos":false,"stream":true,"n":1}

Here is the traceback:

ERROR:    Engine background task failed                                                                                                                                                      
Exception in callback functools.partial(<function _log_task_completion at 0x708a2e58a660>, error_callback=<bound method AsyncAphrodite._error_callback of <aphrodite.engine.async_aphrodite.AsyncAphrodite object at 0x708a2e36a350>>)                                                                                                                                                    
handle: <Handle functools.partial(<function _log_task_completion at 0x708a2e58a660>, error_callback=<bound method AsyncAphrodite._error_callback of <aphrodite.engine.async_aphrodite.AsyncAphrodite object at 0x708a2e36a350>>)>                                                                                                                                                         
Traceback (most recent call last):                                                                                                                                                           
  File "/home/user/aphro-latest/aphrodite-engine/aphrodite/engine/async_aphrodite.py", line 54, in _log_task_completion                                                                          return_value = task.result()                                                                                                                                                             
                   ^^^^^^^^^^^^^                                                                                                                                                             
  File "/home/user/aphro-latest/aphrodite-engine/aphrodite/engine/async_aphrodite.py", line 894, in run_engine_loop                                                                              result = task.result()                                                                                                                                                                   
             ^^^^^^^^^^^^^                                                                                                                                                                   
  File "/home/user/aphro-latest/aphrodite-engine/aphrodite/engine/async_aphrodite.py", line 837, in engine_step                                                                                  request_outputs = await self.engine.step_async(virtual_engine)                                                                                                                           
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                                           
  File "/home/user/aphro-latest/aphrodite-engine/aphrodite/engine/async_aphrodite.py", line 327, in step_async                                                                                   output = await self.model_executor.execute_model_async(                                                                                                                                  
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                                                  
  File "/home/user/aphro-latest/aphrodite-engine/aphrodite/executor/distributed_gpu_executor.py", line 173, in execute_model_async                                                               return await self._driver_execute_model_async(execute_model_req)                                                                                                                         
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                                         
  File "/home/user/aphro-latest/aphrodite-engine/aphrodite/executor/multiproc_gpu_executor.py", line 221, in _driver_execute_model_async                                                         return await self.driver_exec_model(execute_model_req)                                                                                                                                   
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                                                   
  File "/home/user/miniconda3/envs/aphrodite/lib/python3.11/concurrent/futures/thread.py", line 58, in run                                                                                       result = self.fn(*self.args, **self.kwargs)                                                                                                                                              
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                                                              
  File "/home/user/aphro-latest/aphrodite-engine/aphrodite/task_handler/worker_base.py", line 302, in execute_model                                                                              output = self.model_runner.execute_model(                                                                                                                                                
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                                                                
  File "/home/user/miniconda3/envs/aphrodite/lib/python3.11/site-packages/torch/utils/_contextlib.py", line 116, in decorate_context                                                             return func(*args, **kwargs)                                                                                                                                                             
           ^^^^^^^^^^^^^^^^^^^^^                                                                                                                                                             
  File "/home/user/aphro-latest/aphrodite-engine/aphrodite/task_handler/model_runner.py", line 1577, in execute_model                                                                            output: SamplerOutput = self.model.sample(                                                                                                                                               
                            ^^^^^^^^^^^^^^^^^^                                                                                                                                               
  File "/home/user/aphro-latest/aphrodite-engine/aphrodite/modeling/models/llama.py", line 463, in sample                                                                                        next_tokens = self.sampler(logits, sampling_metadata)                                                                                                                                    
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                                                    
  File "/home/user/miniconda3/envs/aphrodite/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1553, in _wrapped_call_impl                                                          return self._call_impl(*args, **kwargs)                                                                                                                                                  
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                                                                  
  File "/home/user/miniconda3/envs/aphrodite/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1562, in _call_impl                                                                  return forward_call(*args, **kwargs)                                                                                                                                                     
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                                                                     
  File "/home/user/aphro-latest/aphrodite-engine/aphrodite/modeling/layers/sampler.py", line 156, in forward                                                                                     logits = _apply_dry(                                                                                                                                                                     
             ^^^^^^^^^^^                                                                                                                                                                     
  File "/home/user/aphro-latest/aphrodite-engine/aphrodite/modeling/layers/sampler.py", line 527, in _apply_dry                                                                              
    logits_row[token] -= penalty                                                                                                                                                             
    ~~~~~~~~~~^^^^^^^                                                                                                                                                                        IndexError: index 128512 is out of bounds for dimension 0 with size 128512                                                                                                                   
                                                                                                                                                                                             The above exception was the direct cause of the following exception:                                                                                                                         
                                                                                                                                                                                             
Traceback (most recent call last):                                                                                                                                                             File "uvloop/cbhandles.pyx", line 63, in uvloop.loop.Handle._run                                                                                                                           
  File "/home/user/aphro-latest/aphrodite-engine/aphrodite/engine/async_aphrodite.py", line 66, in _log_task_completion
    raise AsyncEngineDeadError(
aphrodite.engine.async_aphrodite.AsyncEngineDeadError: Task finished unexpectedly. This should never happen! Please open an issue on Github. See stack trace above for the actual cause.
WARNING:  Failed to abort request chat-193cfde980184286a29b78b7b6e6ac5e
INFO:     192.168.20.37:41840 - "POST /v1/chat/completions HTTP/1.1" 500 Internal Server Error
WARNING:  Failed to abort request cmpl-88e00f598fdb4756a19a0ffff1c34a88-0
ERROR:    Exception in ASGI application
Traceback (most recent call last):
  File "/home/user/miniconda3/envs/aphrodite/lib/python3.11/site-packages/uvicorn/protocols/http/httptools_impl.py", line 401, in run_asgi
    result = await app(  # type: ignore[func-returns-value]
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/miniconda3/envs/aphrodite/lib/python3.11/site-packages/uvicorn/middleware/proxy_headers.py", line 60, in __call__
    return await self.app(scope, receive, send) 
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 
  File "/home/user/miniconda3/envs/aphrodite/lib/python3.11/site-packages/fastapi/applications.py", line 1054, in __call__
    await super().__call__(scope, receive, send)
  File "/home/user/miniconda3/envs/aphrodite/lib/python3.11/site-packages/starlette/applications.py", line 113, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/home/user/miniconda3/envs/aphrodite/lib/python3.11/site-packages/starlette/middleware/errors.py", line 187, in __call__
    raise exc
  File "/home/user/miniconda3/envs/aphrodite/lib/python3.11/site-packages/starlette/middleware/errors.py", line 165, in __call__
    await self.app(scope, receive, _send)
  File "/home/user/miniconda3/envs/aphrodite/lib/python3.11/site-packages/starlette/middleware/cors.py", line 85, in __call__
    await self.app(scope, receive, send)
  File "/home/user/miniconda3/envs/aphrodite/lib/python3.11/site-packages/starlette/middleware/exceptions.py", line 62, in __call__
  await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
  File "/home/user/miniconda3/envs/aphrodite/lib/python3.11/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
    raise exc
  File "/home/user/miniconda3/envs/aphrodite/lib/python3.11/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
    await app(scope, receive, sender)
  File "/home/user/miniconda3/envs/aphrodite/lib/python3.11/site-packages/starlette/routing.py", line 715, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/home/user/miniconda3/envs/aphrodite/lib/python3.11/site-packages/starlette/routing.py", line 735, in app
    await route.handle(scope, receive, send)
  File "/home/user/miniconda3/envs/aphrodite/lib/python3.11/site-packages/starlette/routing.py", line 288, in handle
    await self.app(scope, receive, send)
  File "/home/user/miniconda3/envs/aphrodite/lib/python3.11/site-packages/starlette/routing.py", line 76, in app
    await wrap_app_handling_exceptions(app, request)(scope, receive, send)
  File "/home/user/miniconda3/envs/aphrodite/lib/python3.11/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
    raise exc
  File "/home/user/miniconda3/envs/aphrodite/lib/python3.11/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
    await app(scope, receive, sender)
  File "/home/user/miniconda3/envs/aphrodite/lib/python3.11/site-packages/starlette/routing.py", line 73, in app
    response = await f(request)
               ^^^^^^^^^^^^^^^^
  File "/home/user/miniconda3/envs/aphrodite/lib/python3.11/site-packages/fastapi/routing.py", line 301, in app
    raw_response = await run_endpoint_function( 
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 
  File "/home/user/miniconda3/envs/aphrodite/lib/python3.11/site-packages/fastapi/routing.py", line 212, in run_endpoint_function
    return await dependant.call(**values)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/aphro-latest/aphrodite-engine/aphrodite/endpoints/openai/api_server.py", line 289, in create_chat_completion
    generator = await openai_serving_chat.create_chat_completion(
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/aphro-latest/aphrodite-engine/aphrodite/endpoints/openai/serving_chat.py", line 193, in create_chat_completion
    return await self.chat_completion_full_generator(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/aphro-latest/aphrodite-engine/aphrodite/endpoints/openai/serving_chat.py", line 439, in chat_completion_full_generator
    async for res in result_generator:
  File "/home/user/aphro-latest/aphrodite-engine/aphrodite/common/utils.py", line 434, in iterate_with_cancellation
    item = await awaits[0]
           ^^^^^^^^^^^^^^^
  File "/home/user/aphro-latest/aphrodite-engine/aphrodite/endpoints/openai/rpc/client.py", line 239, in generate
    raise request_output
IndexError: index 128512 is out of bounds for dimension 0 with size 128512
ERROR:    Exception in ASGI application
Traceback (most recent call last):
  File "/home/user/miniconda3/envs/aphrodite/lib/python3.11/site-packages/starlette/responses.py", line 259, in __call__
    await wrap(partial(self.listen_for_disconnect, receive))
  File "/home/user/miniconda3/envs/aphrodite/lib/python3.11/site-packages/starlette/responses.py", line 255, in wrap
    await func()
  File "/home/user/miniconda3/envs/aphrodite/lib/python3.11/site-packages/starlette/responses.py", line 232, in listen_for_disconnect
    message = await receive()
              ^^^^^^^^^^^^^^^
  File "/home/user/miniconda3/envs/aphrodite/lib/python3.11/site-packages/uvicorn/protocols/http/httptools_impl.py", line 555, in receive
    await self.message_event.wait()
  File "/home/user/miniconda3/envs/aphrodite/lib/python3.11/asyncio/locks.py", line 213, in wait
    await fut
asyncio.exceptions.CancelledError: Cancelled by cancel scope 7e98095e6a50

During handling of the above exception, another exception occurred:

  + Exception Group Traceback (most recent call last):
  |   File "/home/user/miniconda3/envs/aphrodite/lib/python3.11/site-packages/uvicorn/protocols/http/httptools_impl.py", line 401, in run_asgi
  |     result = await app(  # type: ignore[func-returns-value]
  |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |   File "/home/user/miniconda3/envs/aphrodite/lib/python3.11/site-packages/uvicorn/middleware/proxy_headers.py", line 60, in __call__
  |     return await self.app(scope, receive, send)
  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |   File "/home/user/miniconda3/envs/aphrodite/lib/python3.11/site-packages/fastapi/applications.py", line 1054, in __call__
  |     await super().__call__(scope, receive, send)
  |   File "/home/user/miniconda3/envs/aphrodite/lib/python3.11/site-packages/starlette/applications.py", line 113, in __call__
  |     await self.middleware_stack(scope, receive, send)
  |   File "/home/user/miniconda3/envs/aphrodite/lib/python3.11/site-packages/starlette/middleware/errors.py", line 187, in __call__
  |     raise exc
  |   File "/home/user/miniconda3/envs/aphrodite/lib/python3.11/site-packages/starlette/middleware/errors.py", line 165, in __call__
  |     await self.app(scope, receive, _send)
  |   File "/home/user/miniconda3/envs/aphrodite/lib/python3.11/site-packages/starlette/middleware/cors.py", line 85, in __call__
  |     await self.app(scope, receive, send)
  |   File "/home/user/miniconda3/envs/aphrodite/lib/python3.11/site-packages/starlette/middleware/exceptions.py", line 62, in __call__
  await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
  |   File "/home/user/miniconda3/envs/aphrodite/lib/python3.11/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
  |     raise exc
  |   File "/home/user/miniconda3/envs/aphrodite/lib/python3.11/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
  |     await app(scope, receive, sender)
  |   File "/home/user/miniconda3/envs/aphrodite/lib/python3.11/site-packages/starlette/routing.py", line 715, in __call__
  |     await self.middleware_stack(scope, receive, send)
  |   File "/home/user/miniconda3/envs/aphrodite/lib/python3.11/site-packages/starlette/routing.py", line 735, in app
  |     await route.handle(scope, receive, send)
  |   File "/home/user/miniconda3/envs/aphrodite/lib/python3.11/site-packages/starlette/routing.py", line 288, in handle
  |     await self.app(scope, receive, send)
  |   File "/home/user/miniconda3/envs/aphrodite/lib/python3.11/site-packages/starlette/routing.py", line 76, in app
  |     await wrap_app_handling_exceptions(app, request)(scope, receive, send)
  |   File "/home/user/miniconda3/envs/aphrodite/lib/python3.11/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
  |     raise exc
  |   File "/home/user/miniconda3/envs/aphrodite/lib/python3.11/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
  |     await app(scope, receive, sender)
  |   File "/home/user/miniconda3/envs/aphrodite/lib/python3.11/site-packages/starlette/routing.py", line 74, in app
  |     await response(scope, receive, send)
  |   File "/home/user/miniconda3/envs/aphrodite/lib/python3.11/site-packages/starlette/responses.py", line 252, in __call__
  |     async with anyio.create_task_group() as task_group:
  |   File "/home/user/miniconda3/envs/aphrodite/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 763, in __aexit__
  |     raise BaseExceptionGroup(
  | ExceptionGroup: unhandled errors in a TaskGroup (1 sub-exception)
  +-+---------------- 1 ----------------
    | Traceback (most recent call last):
    |   File "/home/user/miniconda3/envs/aphrodite/lib/python3.11/site-packages/starlette/responses.py", line 255, in wrap
    |     await func()
    |   File "/home/user/miniconda3/envs/aphrodite/lib/python3.11/site-packages/starlette/responses.py", line 244, in stream_response
    |     async for chunk in self.body_iterator:
    |   File "/home/user/aphro-latest/aphrodite-engine/aphrodite/endpoints/openai/serving_completions.py", line 219, in completion_stream_generator
    |     async for prompt_idx, res in result_generator:
    |   File "/home/user/aphro-latest/aphrodite-engine/aphrodite/common/utils.py", line 470, in merge_async_iterators
    |     item = await d
    |            ^^^^^^^
    |   File "/home/user/aphro-latest/aphrodite-engine/aphrodite/endpoints/openai/rpc/client.py", line 239, in generate
    |     raise request_output
    | IndexError: index 128512 is out of bounds for dimension 0 with size 128512
    +------------------------------------

Seems to be the issue is at
aphrodite-engine/aphrodite/modeling/layers/sampler.py, line 527, in _apply_dry
logits_row[token] -= penalty

Also put this through o1 and this is the suggested issue:

def _apply_dry(
    logits: torch.Tensor,
    input_ids: torch.Tensor,
    multipliers: torch.Tensor, 
    bases: torch.Tensor,
    allowed_lengths: torch.Tensor,
    sequence_breakers_ids: torch.Tensor
) -> torch.Tensor:
    # ...

    for i, (input_ids_row, logits_row) in enumerate(zip(input_ids, logits)):
        # ...
        # Build match_lengths dict where keys are tokens (next_token)
        # and values are match lengths
        match_lengths = {}

        # Process each match of the last token in input_ids_row
        for idx in match_indices:
            idx = idx.item()
            next_token = input_ids_row[idx + 1].item()
            # ...

            # Update max match length for this next token
            if next_token in match_lengths:
                match_lengths[next_token] = max(
                    match_length, match_lengths[next_token])
            else:
                match_lengths[next_token] = match_length

        # Apply penalties based on match lengths
        for token, match_length in match_lengths.items():
            if match_length >= allowed_length:
                penalty = multiplier * (base ** (match_length - allowed_length))
                logits_row[token] -= penalty  # Error occurs here
@Nero10578 Nero10578 added the bug Something isn't working label Nov 27, 2024
@AlpinDale
Copy link
Member

Fixed by #852

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

2 participants