sachiniyer commited on
Commit
a70790f
·
verified ·
1 Parent(s): e2e2130

Upload folder using huggingface_hub

Browse files
__pycache__/backend.cpython-312.pyc CHANGED
Binary files a/__pycache__/backend.cpython-312.pyc and b/__pycache__/backend.cpython-312.pyc differ
 
__pycache__/models.cpython-312.pyc CHANGED
Binary files a/__pycache__/models.cpython-312.pyc and b/__pycache__/models.cpython-312.pyc differ
 
backend.py CHANGED
@@ -105,10 +105,11 @@ class Inference:
105
  with torch.no_grad():
106
  outputs = model.generate(
107
  **inputs,
108
- max_new_tokens=256,
109
  do_sample=True,
110
- temperature=0.7,
111
- top_p=0.9,
 
112
  pad_token_id=tokenizer.eos_token_id,
113
  )
114
  logger.info(f"Generated output shape: {outputs.shape}")
 
105
  with torch.no_grad():
106
  outputs = model.generate(
107
  **inputs,
108
+ max_new_tokens=512,
109
  do_sample=True,
110
+ temperature=0.4,
111
+ top_p=0.85,
112
+ repetition_penalty=1.15,
113
  pad_token_id=tokenizer.eos_token_id,
114
  )
115
  logger.info(f"Generated output shape: {outputs.shape}")
deploy.py CHANGED
@@ -4,7 +4,6 @@
4
  import os
5
  import re
6
  import subprocess
7
- import sys
8
 
9
  from dotenv import load_dotenv
10
  from huggingface_hub import HfApi, SpaceHardware
@@ -14,11 +13,17 @@ load_dotenv()
14
  SPACE_TITLE = "posttraining-practice"
15
 
16
 
 
 
 
 
 
 
 
 
17
  def main():
18
- api_key = os.environ.get("MODEL_SITE_API_KEY")
19
- site_password = os.environ.get("SITE_PASSWORD")
20
- if api_key is None or site_password is None:
21
- sys.exit("ERROR: MODEL_SITE_API_KEY and SITE_PASSWORD must be set in .env")
22
 
23
  api = HfApi()
24
  user = api.whoami()["name"]
@@ -35,7 +40,7 @@ def main():
35
 
36
  match = re.search(r"https://[^\s]+\.modal\.run", result.stdout + result.stderr)
37
  if match is None:
38
- sys.exit("ERROR: Could not find Modal endpoint URL")
39
  modal_endpoint = match.group(0)
40
 
41
  # Generate requirements.txt
 
4
  import os
5
  import re
6
  import subprocess
 
7
 
8
  from dotenv import load_dotenv
9
  from huggingface_hub import HfApi, SpaceHardware
 
13
  SPACE_TITLE = "posttraining-practice"
14
 
15
 
16
+ def require_env(name: str) -> str:
17
+ """Get required environment variable or exit with error."""
18
+ value = os.environ.get(name)
19
+ if value is None:
20
+ raise SystemExit(f"ERROR: {name} must be set in .env")
21
+ return value
22
+
23
+
24
  def main():
25
+ api_key = require_env("MODEL_SITE_API_KEY")
26
+ site_password = require_env("SITE_PASSWORD")
 
 
27
 
28
  api = HfApi()
29
  user = api.whoami()["name"]
 
40
 
41
  match = re.search(r"https://[^\s]+\.modal\.run", result.stdout + result.stderr)
42
  if match is None:
43
+ raise SystemExit("ERROR: Could not find Modal endpoint URL")
44
  modal_endpoint = match.group(0)
45
 
46
  # Generate requirements.txt
models.py CHANGED
@@ -1,6 +1,7 @@
1
  MODEL_IDS = [
2
  "sachiniyer/Qwen2.5-0.5B-DPO-Schwinn",
3
  "sachiniyer/Qwen2.5-0.5B-PPO-Schwinn",
 
4
  "sachiniyer/SmolLM2-DPO-Schwinn-SmolLM2-Base",
5
  "sachiniyer/SmolLM2-DPO-Schwinn-gpt-5-mini-base",
6
  "sachiniyer/SmolLM2-FT-SFT-Learning",
 
1
  MODEL_IDS = [
2
  "sachiniyer/Qwen2.5-0.5B-DPO-Schwinn",
3
  "sachiniyer/Qwen2.5-0.5B-PPO-Schwinn",
4
+ "Qwen/Qwen2.5-0.5B",
5
  "sachiniyer/SmolLM2-DPO-Schwinn-SmolLM2-Base",
6
  "sachiniyer/SmolLM2-DPO-Schwinn-gpt-5-mini-base",
7
  "sachiniyer/SmolLM2-FT-SFT-Learning",