Skip to content

Issue when using choices option. assert temperature <= 1e-5 TypeError: '<=' not supported between instances of 'NoneType' and 'float' #62

@psych0v0yager

Description

@psych0v0yager

I ran into the following error when running my code:

Code

import sglang as sgl

sgl.set_default_backend(sgl.RuntimeEndpoint("http://localhost:30000"))

@sgl.function
def test_function(s, test_prompt):
    s += "This is a test, I will provide a prompt and answer to the best of your abilities. Once you are done, end with the word 'END'" + "\n"
    s += "Q: " + test_prompt + "\n"
    s += "A: " + sgl.gen("car", max_tokens=100, stop='END') + "\n"
    s += "Q: Who would win batman or superman. You must choose ONE character in ONE sentence \n"  
    # s += "A: " + sgl.gen("hero", max_tokens=16, stop='END',)
    s += "A: " + sgl.gen("hero", choices=["batman", "superman"],)


output = test_function.run(test_prompt = "What is the fastest car?")

print(output["car"])
print(output["hero"])

print(output)

Error

Exception in thread Thread-7 (_thread_worker_func):
Traceback (most recent call last):
  File "/home/sr/anaconda3/envs/sglangONLY/lib/python3.11/threading.py", line 1045, in _bootstrap_inner
    self.run()
  File "/home/sr/anaconda3/envs/sglangONLY/lib/python3.11/site-packages/ipykernel/ipkernel.py", line 761, in run_closure
    _threading_Thread_run(self)
  File "/home/sr/anaconda3/envs/sglangONLY/lib/python3.11/threading.py", line 982, in run
    self._target(*self._args, **self._kwargs)
  File "/home/sr/anaconda3/envs/sglangONLY/lib/python3.11/site-packages/sglang/lang/interpreter.py", line 278, in _thread_worker_func
    self._execute(expr)
  File "/home/sr/anaconda3/envs/sglangONLY/lib/python3.11/site-packages/sglang/lang/interpreter.py", line 302, in _execute
    self._execute(x)
  File "/home/sr/anaconda3/envs/sglangONLY/lib/python3.11/site-packages/sglang/lang/interpreter.py", line 299, in _execute
    self._execute_select(other)
  File "/home/sr/anaconda3/envs/sglangONLY/lib/python3.11/site-packages/sglang/lang/interpreter.py", line 376, in _execute_select
    decision, scores = self.backend.select(self, expr.choices, expr.temperature)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/sr/anaconda3/envs/sglangONLY/lib/python3.11/site-packages/sglang/backend/runtime_endpoint.py", line 137, in select
    assert temperature <= 1e-5
           ^^^^^^^^^^^^^^^^^^^
TypeError: '<=' not supported between instances of 'NoneType' and 'float'
 As of now, the Bugatti Veyron Super Sport holds the record for the fastest car in the world, reaching a top speed of 268 mph (431 km/h). However, please note that this record can change as new cars with even greater speeds are developed.

This error also presents itself when I try to run the tool use (calculator + web) example from the documentation

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions