You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems like the model is producing some garbage output (which shouldnt be allowed by the logit processor). Posted my debug below.
Steps/code to reproduce the bug:
fromenumimportEnumfrompydanticimportBaseModel, constrimportoutlinesimportllama_cppclassWeapon(str, Enum):
sword="sword"axe="axe"mace="mace"spear="spear"bow="bow"crossbow="crossbow"classArmor(str, Enum):
leather="leather"chainmail="chainmail"plate="plate"classCharacter(BaseModel):
name: constr(max_length=10)
age: intarmor: Armorweapon: Weaponstrength: intif__name__=="__main__":
# curl -L -o mistral-7b-instruct-v0.2.Q5_K_M.gguf https://huggingface.co/TheBloke/Mistral-7B-Instruct-v0.2-GGUF/resolve/main/mistral-7b-instruct-v0.2.Q5_K_M.ggufmodel=outlines.models.LlamaCpp(
model=llama_cpp.Llama(model_path="./mistral-7b-instruct-v0.2.Q5_K_M.gguf")
)
# Construct structured sequence generatorgenerator=outlines.generate.json(model, Character)
# Draw a sampleseed=789005prompt="Instruct: You are a leading role play gamer. You have seen thousands of different characters and their attributes.\nPlease return a JSON object with common attributes of an RPG character. Give me a character description\nOutput:"sequence=generator(prompt, seed=seed, max_tokens=512)
print(sequence)
Expected result:
Valid Character Type
Error message:
Traceback (most recent call last):
File "/Users/bharathc/Projects/temp.py", line 48, in<module>
File "/Users/bharathc/Projects/.env/lib/python3.12/site-packages/outlines/generate/api.py", line 512, in __call__
return self._format(completions)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/bharathc/Projects/.env/lib/python3.12/site-packages/outlines/generate/api.py", line 488, in _format
return self.format_sequence(sequences)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/bharathc/Projects/.env/lib/python3.12/site-packages/outlines/generate/json.py", line 50, in<lambda>
generator.format_sequence = lambda x: schema_object.parse_raw(x)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/bharathc/Projects/.env/lib/python3.12/site-packages/pydantic/main.py", l
ine 1214, in parse_raw
raise pydantic_core.ValidationError.from_exception_data(cls.__name__, [error])
pydantic_core._pydantic_core.ValidationError: 1 validation error for Character
__root__
Expecting value: line 1 column 1 (char 0) [type=value_error.jsondecode, input_value='Abstract ERROR ERRORAbst...bstractAbstractAbstract', input_type=str]
Outlines/Python version information:
Outlines version 0.1.1
Python version Python 3.12.5 (main, Aug 6 2024, 19:08:49) [Clang 15.0.0 (clang-1500.1.0.2.5)]
Here is the interesting part of the error: ValidationError: 1 validation error for Order __root__ Expecting value: line 1 column 1 (char 0) [type=value_error.jsondecode, input_value='AbstractAbstractAbstract...bstractAbstractAbstract', input_type=str]
Looks like outlines is making the model output lots of 'Abstract'.
Outlines version 0.1.3.
Python version 3.11.7
llama_cpp_python version 0.3.1
Describe the issue as clearly as possible:
examples/llamcpp_example.py
is brokenIt seems like the model is producing some garbage output (which shouldnt be allowed by the logit processor). Posted my debug below.
Steps/code to reproduce the bug:
Expected result:
Error message:
Outlines/Python version information:
Outlines version
0.1.1
Python version
Python 3.12.5 (main, Aug 6 2024, 19:08:49) [Clang 15.0.0 (clang-1500.1.0.2.5)]
Context for the issue:
I put a breakpoint here
and it seems the value of
completions
is
So not sure whats going on, I guess llama cpp is not using the logit processor correctly?
The text was updated successfully, but these errors were encountered: