Skip to content

Create Usage section in documentation + API #1577

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

Closed
wants to merge 1 commit into from

Conversation

RobinPicard
Copy link
Contributor

No description provided.

@RobinPicard RobinPicard force-pushed the update_doc_reference branch from 142b945 to b2c760e Compare May 15, 2025 16:41
Copy link
Contributor

@cpfiffer cpfiffer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll keep adding comments here and there

Comment on lines 89 to 104
model = from_llamacpp(
Llama.from_pretrained(
repo_id="M4-ai/TinyMistral-248M-v2-Instruct-GGUF",
filename="TinyMistral-248M-v2-Instruct.Q4_K_M.gguf",
)
)

# Define the output structure
class Character(BaseModel):
name: str
age: int
skills: List[str]

# Create a generator for the output type defined and call it to generate text
generator = Generator(model, Character)
response = generator("Create a character for my game", max_tokens=100)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The prompt here is not correct because we are using an instruction-tuned model without user and assistant tags. The model will generate a character, but anyone using this code will find severely degraded performance in more flexible contexts.

Brief overview here.

This is more of a general issue (feature?) of how Outlines works that we need to find a way to consistently address. The transformer tokenizer approach is the most ergonomic, and I'm wondering if we should just offer that everywhere even for different inference backends.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that's a good point, working with those prompts is a bit awkward in Outlines. I can use other models in the features section not to add noise and we say we cover that in the guides?

@cpfiffer
Copy link
Contributor

Seems like my previous comments didn't propagate to the recent directory changes, I'll adjust those.

Copy link
Contributor

@cpfiffer cpfiffer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few general comments:

  • Most of the stuff in the output types section should include an example of output, as they're quite difficult to visualize for all but the most simple cases. Currently only an output_type variable is shown.

I've got more to review here but I'll leave these in case you wanted to take a look.

Damn fine work.

image

@RobinPicard RobinPicard force-pushed the update_doc_reference branch from b2c760e to b6f5bc2 Compare May 19, 2025 14:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants