这是我的guided_jsonguided_json = {"type": "object", "properties": { "age": {"type": "string", "pattern": r"^Fifty"}, "height": {"type": "string", "pattern": r"^five"}}}我想在每个键中强制执行初始字符串,这是支持的吗?我应该如何做?
guided_json = {"type": "object", "properties": { "age": {"type": "string", "pattern": r"^Fifty"}, "height": {"type": "string", "pattern": r"^five"}}}
f4t66c6m1#
我也有同样的问题,如何使用正则表达式字符串或可能是Pydantic对象模式JSON作为输入进行受限解码。
qq24tv8q2#
我也有同样的问题!我尝试这样做:from outlines import models, generatemodel = models.vllm(model="TheBloke/Mistral-7B-OpenOrca-AWQ", device=device, quantization="awq", dtype="half", tensor_parallel_size=2)sampling_params = SamplingParams(temperature=0.0, top_p=0.95, max_tokens=300)generator = generate.json(model, schema)answer = generator(prompt, sampling_params = sampling_params)但是得到了错误 "AttributeError: module 'outlines.models' has no attribute 'vllm'"
from outlines import models, generate
model = models.vllm(model="TheBloke/Mistral-7B-OpenOrca-AWQ", device=device, quantization="awq", dtype="half", tensor_parallel_size=2)
sampling_params = SamplingParams(temperature=0.0, top_p=0.95, max_tokens=300)
generator = generate.json(model, schema)
answer = generator(prompt, sampling_params = sampling_params)
jv4diomz3#
有人知道这个问题的答案吗?
atmip9wb4#
当我在示例中给出JSON输出并在提示中添加一行“仅使用示例中给定的字段”时,输出将被限制为仅包含示例中给定的键。我完全不了解outlines库。希望这有所帮助!
4条答案
按热度按时间f4t66c6m1#
我也有同样的问题,如何使用正则表达式字符串或可能是Pydantic对象模式JSON作为输入进行受限解码。
qq24tv8q2#
我也有同样的问题!
我尝试这样做:
from outlines import models, generate
model = models.vllm(model="TheBloke/Mistral-7B-OpenOrca-AWQ", device=device, quantization="awq", dtype="half", tensor_parallel_size=2)
sampling_params = SamplingParams(temperature=0.0, top_p=0.95, max_tokens=300)
generator = generate.json(model, schema)
answer = generator(prompt, sampling_params = sampling_params)
但是得到了错误 "AttributeError: module 'outlines.models' has no attribute 'vllm'"
jv4diomz3#
有人知道这个问题的答案吗?
atmip9wb4#
当我在示例中给出JSON输出并在提示中添加一行“仅使用示例中给定的字段”时,输出将被限制为仅包含示例中给定的键。我完全不了解outlines库。希望这有所帮助!