File size: 1,835 Bytes
1393b01
796d506
119fd47
ca491f7
48da153
 
119fd47
796d506
d4b1a51
 
 
 
08309f8
d4b1a51
a80f639
 
d4b1a51
 
 
 
 
 
 
a80f639
 
 
80ed5f7
59b5192
 
0d122d0
119fd47
 
 
 
 
 
 
 
80c595a
119fd47
 
 
 
 
 
 
 
59b5192
 
ca491f7
 
119fd47
 
ca491f7
 
 
 
 
 
59b5192
119fd47
59b5192
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import os
import tempfile
import subprocess
from huggingface_hub import HfApi
print("✅ Модель уже создана: https://huggingface.co/Andrewstivan/AURA")
exit(0)
REPO_NAME = "Andrewstivan/AURA"

YAML_CONFIG = """slices:
  - sources:
      - model: ResplendentAI/Aura_v3_7B
        layer_range: [0, 32]
      - model: IlyaGusev/saiga_mistral_7b_merged
        layer_range: [0, 32]
merge_method: slerp
base_model: ResplendentAI/Aura_v3_7B
parameters:
  t:
    - filter: self_attn
      value: [0, 0.5, 0.3, 0.7, 1]
    - filter: mlp
      value: [1, 0.5, 0.7, 0.3, 0]
    - value: 0.5
dtype: bfloat16
tokenizer_source: union
"""

print("Starting merge Aura + Saiga...")
print("=" * 60)

with tempfile.TemporaryDirectory() as tmpdir:
    config_path = f"{tmpdir}/config.yaml"
    with open(config_path, "w") as f:
        f.write(YAML_CONFIG)
    
    merged_path = f"{tmpdir}/merged"
    os.makedirs(merged_path, exist_ok=True)
    
    cmd = f"mergekit-yaml {config_path} {merged_path} --copy-tokenizer --allow-crimes --out-shard-size 1B --trust-remote-code"
    
    process = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True)
    for line in iter(process.stdout.readline, ''):
        print(line, end='')
    
    process.wait()
    
    if process.returncode == 0:
        print("=" * 60)
        print("✅ Merge complete! Uploading...")
        
        # Прямая загрузка без login()
        api = HfApi()
        api.create_repo(REPO_NAME, exist_ok=True)
        api.upload_folder(
            folder_path=merged_path,
            repo_id=REPO_NAME,
            repo_type="model",
            token=os.getenv("HF_TOKEN")
        )
        print(f"🎉 Done! https://huggingface.co/{REPO_NAME}")
    else:
        print(f"❌ Error: {process.returncode}")