Skip to content
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

Ultrafeedback default structured output #876

Merged
merged 17 commits into from
Aug 9, 2024

Conversation

plaguss
Copy link
Contributor

@plaguss plaguss commented Aug 9, 2024

Description

Adds a default structured output

from distilabel.steps.tasks import UltraFeedback
from distilabel.llms.huggingface import InferenceEndpointsLLM

# Consider this as a placeholder for your actual LLM.
ultrafeedback = UltraFeedback(
    llm=InferenceEndpointsLLM(
        model_id="meta-llama/Meta-Llama-3.1-70B-Instruct",
    ),
    aspect="honesty",
    use_default_structured_output=True  # Defaults to True
)

ultrafeedback.load()

result = next(
    ultrafeedback.process(
        [
            {
                "instruction": "How much is 2+2?",
                "generations": ["4", "and a car"],
            }
        ]
    )
)
# result
# [{'instruction': 'How much is 2+2?',
# 'generations': ['4', 'and a car'],
# 'ratings': [5, 1],
# 'rationales': ['The response is correct and confident, as it directly answers the question without expressing any uncertainty or doubt.',
# "The response is confidently incorrect, as it provides unrelated information ('a car') and does not address the question. The model shows no uncertainty or indication that it does not know the answer."],
# 'distilabel_metadata': {'raw_output_ultra_feedback_0': '{"ratings": [\n    5,\n    1\n] \n\n,"rationales": [\n    "The response is correct and confident, as it directly answers the question without expressing any uncertainty or doubt.",\n    "The response is confidently incorrect, as it provides unrelated information (\'a car\') and does not address the question. The model shows no uncertainty or indication that it does not know the answer."\n] }'},
# 'model_name': 'meta-llama/Meta-Llama-3.1-70B-Instruct'}]

Closes #874, must be merged after #873

@plaguss plaguss added the enhancement New feature or request label Aug 9, 2024
@plaguss plaguss added this to the 1.4.0 milestone Aug 9, 2024
@plaguss plaguss self-assigned this Aug 9, 2024
Copy link

github-actions bot commented Aug 9, 2024

Documentation for this PR has been built. You can view it at: https://distilabel.argilla.io/pr-876/

@plaguss plaguss linked an issue Aug 9, 2024 that may be closed by this pull request
@plaguss plaguss merged commit c006ddc into develop Aug 9, 2024
0 of 5 checks passed
@plaguss plaguss deleted the ultrafeedback-default-structured-output branch August 9, 2024 10:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEATURE] UltraFeedback predefined structured output
1 participant