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 lines2021222324252663 unmodified lines9091929394959697989910010110210310410510619 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")HF_TOKEN = os.getenv("HF_TOKEN")ENV_BASE_URL = os.getenv("ENV_BASE_URL", "http://localhost:8000")63 unmodified linesSYSTEMS = {"pairwise": ('You judge LLM responses. ''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}'),"consistency": ('You rank 4 responses from best to worst. ''Reply ONLY with valid JSON: {"ranking":["B","A","C","D"]}'),}19 unmodified lines2021222324252663 unmodified lines9091929394959697989910010110210310410510610710810911019 unmodified lines# ββ Mandatory env vars βββββββββββββββββββββββββββββββββββββββββAPI_BASE_URL = os.getenv("API_BASE_URL", "https://router.huggingface.co/v1")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 linesSYSTEMS = {"pairwise": ('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 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 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 lines31323334353630 unmodified linesdefault=None,description="Optional reasoning for the choice (not used for grading).",)class LikertAction(Action):30 unmodified lines313233343536373839404130 unmodified linesdefault=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 lines186187188189190191192185 unmodified lines# ββ Environment βββββββββββββββββββββββββββββββββββββββββββββββTASK_TYPES = ["pairwise", "likert", "consistency"]MAX_STEPS_PER_EPISODE = 5class PreferenceLabEnvironment(Environment):185 unmodified lines186187188189190191192185 unmodified lines# ββ Environment βββββββββββββββββββββββββββββββββββββββββββββββTASK_TYPES = ["pairwise", "likert", "consistency"]MAX_STEPS_PER_EPISODE = 10class PreferenceLabEnvironment(Environment):
inference.py+11-7
models.py+5
server/environment.py+1-1