$ python replicate-stream-llama-test.py
Traceback (most recent call last):
File "/Users/z/Desktop/replicate-stream-llama-test.py", line 4, in <module>
for event in replicate.stream(
File "/Users/z/.pyenv/versions/python-3.10.4/lib/python3.10/site-packages/replicate/stream.py", line 201, in stream
yield from EventSource(response)
File "/Users/z/.pyenv/versions/python-3.10.4/lib/python3.10/site-packages/replicate/stream.py", line 142, in __iter__
raise RuntimeError(sse.data)
RuntimeError: {"detail":"top_k is currently not supported by our generation engine."}
This is the offending code:
# The meta/llama-2-70b-chat model can stream output as it's running.
for event in replicate.stream(
"meta/llama-2-70b-chat",
input={
"debug": False,
"top_k": 50,
"top_p": 1,
"prompt": "Can you write a poem about open source machine learning? Let's make it in the style of E. E. Cummings.",
"temperature": 0.5,
"system_prompt": "You are a helpful, respectful and honest assistant. Always answer as helpfully as possible, while being safe. Your answers should not include any harmful, unethical, racist, sexist, toxic, dangerous, or illegal content. Please ensure that your responses are socially unbiased and positive in nature.\n\nIf a question does not make any sense, or is not factually coherent, explain why instead of answering something not correct. If you don't know the answer to a question, please don't share false information.",
"max_new_tokens": 500,
"min_new_tokens": -1
},
):
print(str(event), end="")
It looks like the issue is that if you leave top_k unset, everything works. But if you set a value for top_k, even if it's the same value as the default, this error occurs.
Possible fixes:
Push a new version of the model with the top_k input removed
Show a warning when the value is set, instead of blowing up
Allow the input value to be the same as the default without causing a warning or an error.
Running the default Python code snippet from the Playground at https://replicate.com/meta/llama-2-70b-chat?input=python produces this error:
This is the offending code:
It looks like the issue is that if you leave
top_k
unset, everything works. But if you set a value fortop_k
, even if it's the same value as the default, this error occurs.Possible fixes:
top_k
input removed