baryshych commited on
Commit
bb9ba1d
·
1 Parent(s): f7a182c

add dynamic project naming

Browse files
Files changed (3) hide show
  1. requirements.txt +3 -1
  2. src/backup.yaml +39 -0
  3. src/main.py +11 -1
requirements.txt CHANGED
@@ -2,4 +2,6 @@ fastapi==0.111.0
2
  requests==2.31.0
3
  huggingface_hub==0.23.4
4
  uvicorn[standard]==0.29.0
5
- autotrain-advanced==0.8.12
 
 
 
2
  requests==2.31.0
3
  huggingface_hub==0.23.4
4
  uvicorn[standard]==0.29.0
5
+ autotrain-advanced==0.8.12
6
+ yaml
7
+ datetime
src/backup.yaml ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ task: llm-sft
2
+ base_model: meta-llama/Meta-Llama-3.1-8B-Instruct
3
+ project_name: llama
4
+ log: tensorboard
5
+ backend: local
6
+
7
+ data:
8
+ path: baryshych/platma
9
+ train_split: train
10
+ valid_split: null
11
+ chat_template: null
12
+ column_mapping:
13
+ text_column: text
14
+
15
+ params:
16
+ block_size: 1024
17
+ lr: 1e-4
18
+ warmup_ratio: 0.1
19
+ weight_decay: 0.01
20
+ epochs: 1
21
+ batch_size: 2
22
+ gradient_accumulation: 8
23
+ mixed_precision: fp16
24
+ peft: True
25
+ quantization: null
26
+ lora_r: 16
27
+ lora_alpha: 32
28
+ lora_dropout: 0.05
29
+ unsloth: False
30
+ optimizer: paged_adamw_8bit
31
+ target_modules: all-linear
32
+ padding: right
33
+ optimizer: paged_adamw_8bit
34
+ scheduler: cosine
35
+
36
+ hub:
37
+ username: baryshych
38
+ token: ${HF_ACCESS_TOKEN}
39
+ push_to_hub: True
src/main.py CHANGED
@@ -3,6 +3,8 @@ import requests
3
  from typing import Optional
4
  import uvicorn
5
  from subprocess import Popen
 
 
6
 
7
  from fastapi import FastAPI, Header, BackgroundTasks
8
  from fastapi.responses import FileResponse
@@ -51,7 +53,15 @@ async def post_webhook(
51
  def schedule_retrain(payload: WebhookPayload):
52
  # Create the autotrain project
53
  try:
54
- result = Popen(['autotrain', '--config', os.path.join(os.getcwd(), "src/config.yaml")])
 
 
 
 
 
 
 
 
55
  # project = AutoTrain.create_project(payload)
56
  # AutoTrain.add_data(project_id=project["id"])
57
  # AutoTrain.start_processing(project_id=project["id"])
 
3
  from typing import Optional
4
  import uvicorn
5
  from subprocess import Popen
6
+ import yaml
7
+ import datetime
8
 
9
  from fastapi import FastAPI, Header, BackgroundTasks
10
  from fastapi.responses import FileResponse
 
53
  def schedule_retrain(payload: WebhookPayload):
54
  # Create the autotrain project
55
  try:
56
+ yaml_path = os.path.join(os.getcwd(), "config.yaml")
57
+ with open(yaml_path) as f:
58
+ list_doc = yaml.safe_load(f)
59
+ list_doc['project_name'] = datetime.datetime.now().isoformat()
60
+
61
+ with open(yaml_path) as f:
62
+ yaml.dump(list_doc, f, default_flow_style=False)
63
+
64
+ result = Popen(['autotrain', '--config', yaml_path])
65
  # project = AutoTrain.create_project(payload)
66
  # AutoTrain.add_data(project_id=project["id"])
67
  # AutoTrain.start_processing(project_id=project["id"])