Colby commited on
Commit
c6db854
·
verified ·
1 Parent(s): 5e69421

Upload finetune_coding.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. finetune_coding.py +15 -4
finetune_coding.py CHANGED
@@ -9,7 +9,7 @@
9
  # "bitsandbytes>=0.41.0",
10
  # "datasets>=2.0.0",
11
  # "trackio",
12
- # "apertus-format @ git+https://github.com/swiss-ai/apertus-format.git",
13
  # ]
14
  # ///
15
 
@@ -26,15 +26,26 @@ single merged assistant turn.
26
  """
27
 
28
  import json
 
 
 
 
 
 
 
 
 
 
 
29
  import trackio
30
  from datasets import load_dataset, concatenate_datasets
31
  from peft import LoraConfig
32
- from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
33
- from trl import SFTConfig, SFTTrainer
34
- from apertus_format import (
35
  Message, Conversation, ApertusFormatter,
36
  AssistantBlock, ToolCall, ToolOutput, BlockType,
37
  )
 
 
38
 
39
  MODEL_ID = "swiss-ai/Apertus-8B-Instruct-2509"
40
  OUTPUT_REPO = "Colby/apertus-8b-coding"
 
9
  # "bitsandbytes>=0.41.0",
10
  # "datasets>=2.0.0",
11
  # "trackio",
12
+ # "jinja2>=3.0",
13
  # ]
14
  # ///
15
 
 
26
  """
27
 
28
  import json
29
+ import subprocess
30
+ import sys
31
+
32
+ # apertus-format has no PyPI release — clone and import from src/ package
33
+ print("Cloning apertus-format...")
34
+ subprocess.run(
35
+ ["git", "clone", "--depth=1", "https://github.com/swiss-ai/apertus-format.git", "/tmp/apertus-format"],
36
+ check=True,
37
+ )
38
+ sys.path.insert(0, "/tmp/apertus-format")
39
+
40
  import trackio
41
  from datasets import load_dataset, concatenate_datasets
42
  from peft import LoraConfig
43
+ from src import ( # noqa: E402 — inserted after sys.path patch
 
 
44
  Message, Conversation, ApertusFormatter,
45
  AssistantBlock, ToolCall, ToolOutput, BlockType,
46
  )
47
+ from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
48
+ from trl import SFTConfig, SFTTrainer
49
 
50
  MODEL_ID = "swiss-ai/Apertus-8B-Instruct-2509"
51
  OUTPUT_REPO = "Colby/apertus-8b-coding"