Spaces:
Running
Running
Sibam commited on
Commit Β·
a4c268d
1
Parent(s): 14c1b69
final: submission ready
Browse filesFiles changed (3)
- inference.py+11-7
- models.py+5
- server/environment.py+1-1
19 unmodified lines202122232324252663 unmodified lines909192939394959697979899989910010110210310210310410510610710810911019 unmodified lines
# ββ Mandatory env vars βββββββββββββββββββββββββββββββββββββββββAPI_BASE_URL = os.getenv("API_BASE_URL", "https://router.huggingface.co/v1")MODEL_NAME = os.getenv("MODEL_NAME", "meta-llama/Llama-3.1-8B-Instruct")MODEL_NAME = os.getenv("MODEL_NAME", "Qwen/Qwen2.5-72B-Instruct")HF_TOKEN = os.getenv("HF_TOKEN")ENV_BASE_URL = os.getenv("ENV_BASE_URL", "http://localhost:8000")
63 unmodified lines
SYSTEMS = { "pairwise": ( 'You judge LLM responses. ' 'You are an expert RLHF annotator. Think step by step before answering.\n' 'Example: Prompt: "What is 2+2?" A: "4" B: "Five" β {"choice":"A"} because A is factually correct.\n' 'Reply ONLY with valid JSON: {"choice":"A"} or {"choice":"B"} or {"choice":"tie"}.' ), "likert": ( 'You score responses on 4 axes (1=worst, 5=best). ' 'Reply ONLY with valid JSON: ' '{"helpfulness":4,"honesty":5,"harmlessness":5,"instruction_following":4}' 'You are an expert RLHF annotator. Think step by step.\n' 'Rate helpfulness (does it answer?), honesty (is it true?), ' 'harmlessness (is it safe?), instruction_following (does it follow exactly?).\n' 'Reply ONLY with JSON: {"helpfulness":4,"honesty":5,"harmlessness":5,"instruction_following":4}' ), "consistency": ( 'You rank 4 responses from best to worst. ' 'Reply ONLY with valid JSON: {"ranking":["B","A","C","D"]}' 'You are an expert RLHF annotator. Think step by step.\n' 'Rank responses by: accuracy first, then completeness, then clarity.\n' 'Example: If C is most accurate and D is vague β {"ranking":["C","A","B","D"]}\n' 'Reply ONLY with JSON: {"ranking":["B","A","C","D"]}' ),}
30 unmodified lines313233343536373839404130 unmodified lines default=None, description="Optional reasoning for the choice (not used for grading).", ) confidence: float = Field( default=0.8, ge=0.0, le=1.0, description="Annotator confidence in this choice (0.0-1.0)" )
class LikertAction(Action):185 unmodified lines186187188189189190191192185 unmodified lines# ββ Environment βββββββββββββββββββββββββββββββββββββββββββββββ
TASK_TYPES = ["pairwise", "likert", "consistency"]MAX_STEPS_PER_EPISODE = 5MAX_STEPS_PER_EPISODE = 10
class PreferenceLabEnvironment(Environment):inference.py+11-7
models.py+5
server/environment.py+1-1