Text Generation
Transformers
English
qwen2
code-generation
python
fine-tuning
Qwen
tools
agent-framework
multi-agent
conversational
Eval Results (legacy)
Instructions to use my-ai-stack/Stack-2-9-finetuned with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use my-ai-stack/Stack-2-9-finetuned with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="my-ai-stack/Stack-2-9-finetuned") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("my-ai-stack/Stack-2-9-finetuned") model = AutoModelForCausalLM.from_pretrained("my-ai-stack/Stack-2-9-finetuned") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use my-ai-stack/Stack-2-9-finetuned with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "my-ai-stack/Stack-2-9-finetuned" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "my-ai-stack/Stack-2-9-finetuned", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/my-ai-stack/Stack-2-9-finetuned
- SGLang
How to use my-ai-stack/Stack-2-9-finetuned with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "my-ai-stack/Stack-2-9-finetuned" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "my-ai-stack/Stack-2-9-finetuned", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "my-ai-stack/Stack-2-9-finetuned" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "my-ai-stack/Stack-2-9-finetuned", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use my-ai-stack/Stack-2-9-finetuned with Docker Model Runner:
docker model run hf.co/my-ai-stack/Stack-2-9-finetuned
walidsobhie-code commited on
Commit ยท
51896e7
1
Parent(s): 33e3770
fix: add synthetic data fallback when training-data not available
Browse files- If training-data/final/train.jsonl missing, creates synthetic 1K sample dataset
- Ensures notebook works on fresh Kaggle clone without large dataset
- Uses input_path key correctly for train_lora.py
- Simpler, more robust error handling
- kaggle_train_stack29.ipynb +51 -46
kaggle_train_stack29.ipynb
CHANGED
|
@@ -16,7 +16,7 @@
|
|
| 16 |
"---\n",
|
| 17 |
"\n",
|
| 18 |
"**Instructions:**\n",
|
| 19 |
-
"1. Enable GPU: Settings โ Accelerator โ GPU
|
| 20 |
"2. Run cells in order from the top\n",
|
| 21 |
"3. Model auto-downloads if not present\n",
|
| 22 |
"\n",
|
|
@@ -46,24 +46,21 @@
|
|
| 46 |
"import shutil\n",
|
| 47 |
"import subprocess\n",
|
| 48 |
"\n",
|
| 49 |
-
"# Change to a valid directory first (in case we're in a deleted folder)\n",
|
| 50 |
"os.chdir(\"/kaggle/working\")\n",
|
| 51 |
"\n",
|
| 52 |
"REPO_DIR = \"/kaggle/working/stack-2.9\"\n",
|
| 53 |
"MODEL_DIR = os.path.join(REPO_DIR, \"base_model_qwen7b\")\n",
|
| 54 |
"OUTPUT_DIR = os.path.join(REPO_DIR, \"training_output\")\n",
|
| 55 |
"\n",
|
| 56 |
-
"# Remove old repo if exists
|
| 57 |
"if os.path.exists(REPO_DIR):\n",
|
| 58 |
" shutil.rmtree(REPO_DIR)\n",
|
| 59 |
"\n",
|
| 60 |
-
"# Clone fresh
|
| 61 |
"subprocess.run([\"git\", \"clone\", \"https://github.com/my-ai-stack/stack-2.9.git\", REPO_DIR], check=True)\n",
|
| 62 |
"os.chdir(REPO_DIR)\n",
|
| 63 |
"\n",
|
| 64 |
-
"print(f\"โ
Working in: {os.getcwd()}\")
|
| 65 |
-
"print(f\" MODEL_DIR: {MODEL_DIR}\")\n",
|
| 66 |
-
"print(f\" OUTPUT_DIR: {OUTPUT_DIR}\")"
|
| 67 |
]
|
| 68 |
},
|
| 69 |
{
|
|
@@ -76,7 +73,7 @@
|
|
| 76 |
"import subprocess\n",
|
| 77 |
"\n",
|
| 78 |
"subprocess.run([\"pip\", \"install\", \"-q\", \"torch\", \"torchvision\", \"torchaudio\", \"--index-url\", \"https://download.pytorch.org/whl/cu118\"], check=True)\n",
|
| 79 |
-
"subprocess.run([\"pip\", \"install\", \"-q\", \"transformers\", \"peft\", \"accelerate\", \"datasets\", \"pyyaml\", \"tqdm\", \"scipy\", \"bitsandbytes\"], check=True)\n",
|
| 80 |
"print(\"โ
Dependencies installed\")"
|
| 81 |
]
|
| 82 |
},
|
|
@@ -88,16 +85,18 @@
|
|
| 88 |
"source": [
|
| 89 |
"# STEP 4: Prepare training data\n",
|
| 90 |
"import os\n",
|
|
|
|
| 91 |
"\n",
|
| 92 |
-
"# Check
|
| 93 |
"REPO_TRAIN_DATA = os.path.join(REPO_DIR, \"training-data/final/train.jsonl\")\n",
|
| 94 |
"MINI_DATA_DIR = os.path.join(REPO_DIR, \"data_mini\")\n",
|
| 95 |
"MINI_DATA_FILE = os.path.join(MINI_DATA_DIR, \"train_mini.jsonl\")\n",
|
|
|
|
| 96 |
"\n",
|
| 97 |
"print(\"๐ Checking for training data...\")\n",
|
|
|
|
| 98 |
"if os.path.exists(REPO_TRAIN_DATA):\n",
|
| 99 |
" print(f\" Found full dataset: {REPO_TRAIN_DATA}\")\n",
|
| 100 |
-
" # Create mini subset (1K samples) for faster training\n",
|
| 101 |
" os.makedirs(MINI_DATA_DIR, exist_ok=True)\n",
|
| 102 |
" if not os.path.exists(MINI_DATA_FILE):\n",
|
| 103 |
" print(\" Creating mini dataset (1000 samples)...\")\n",
|
|
@@ -105,13 +104,36 @@
|
|
| 105 |
" subprocess.run([\"python\", os.path.join(REPO_DIR, \"scripts/create_mini_dataset.py\"),\n",
|
| 106 |
" \"--size\", \"1000\", \"--output\", MINI_DATA_FILE, \"--source\", REPO_TRAIN_DATA], check=True)\n",
|
| 107 |
" DATA_FILE = MINI_DATA_FILE\n",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 108 |
"else:\n",
|
| 109 |
-
" print(\"
|
| 110 |
-
"
|
| 111 |
-
"
|
| 112 |
-
"
|
| 113 |
-
"
|
| 114 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 115 |
"\n",
|
| 116 |
"print(f\"\\nโ
Using training data: {DATA_FILE}\")\n",
|
| 117 |
"print(f\" Size: {os.path.getsize(DATA_FILE) / 1024:.1f} KB\")"
|
|
@@ -136,9 +158,9 @@
|
|
| 136 |
" 'torch_dtype': 'float16'\n",
|
| 137 |
" },\n",
|
| 138 |
" 'data': {\n",
|
| 139 |
-
" 'input_path': DATA_FILE,
|
| 140 |
" 'max_length': 2048,\n",
|
| 141 |
-
" 'train_split': 1.0
|
| 142 |
" },\n",
|
| 143 |
" 'lora': {\n",
|
| 144 |
" 'r': 16,\n",
|
|
@@ -167,28 +189,17 @@
|
|
| 167 |
" 'lora_dir': os.path.join(OUTPUT_DIR, 'lora'),\n",
|
| 168 |
" 'logging_dir': os.path.join(OUTPUT_DIR, 'logs')\n",
|
| 169 |
" },\n",
|
| 170 |
-
" 'quantization': {\n",
|
| 171 |
-
"
|
| 172 |
-
" },\n",
|
| 173 |
-
" 'hardware': {\n",
|
| 174 |
-
" 'device': 'cuda',\n",
|
| 175 |
-
" 'num_gpus': 1,\n",
|
| 176 |
-
" 'use_4bit': False,\n",
|
| 177 |
-
" 'use_8bit': False\n",
|
| 178 |
-
" }\n",
|
| 179 |
"}\n",
|
| 180 |
"\n",
|
| 181 |
"config_path = os.path.join(OUTPUT_DIR, \"train_config.yaml\")\n",
|
| 182 |
"with open(config_path, 'w') as f:\n",
|
| 183 |
" yaml.dump(config, f, default_flow_style=False)\n",
|
| 184 |
"\n",
|
| 185 |
-
"print(f\"โ
Config saved
|
| 186 |
-
"print(\"\\nConfig summary:\")\n",
|
| 187 |
"print(f\" Model: {config['model']['name']}\")\n",
|
| 188 |
-
"print(f\" Data: {config['data']['input_path']}\")
|
| 189 |
-
"print(f\" LoRA rank: {config['lora']['r']}\")\n",
|
| 190 |
-
"print(f\" Batch size: {config['training']['batch_size']}\")\n",
|
| 191 |
-
"print(f\" Epochs: {config['training']['num_epochs']}\")"
|
| 192 |
]
|
| 193 |
},
|
| 194 |
{
|
|
@@ -204,17 +215,13 @@
|
|
| 204 |
"print(\"=\"*60)\n",
|
| 205 |
"print(\"STARTING TRAINING\")\n",
|
| 206 |
"print(\"=\"*60)\n",
|
| 207 |
-
"print(f\"Config: {config_path}\")\n",
|
| 208 |
-
"print(f\"Checkpoint dir: {config['output']['lora_dir']}\")\n",
|
| 209 |
-
"print(\"=\"*60 + \"\\n\")\n",
|
| 210 |
"\n",
|
| 211 |
-
"# Import and run training\n",
|
| 212 |
"from stack_2_9_training.train_lora import train_lora\n",
|
| 213 |
"\n",
|
| 214 |
"try:\n",
|
| 215 |
" trainer = train_lora(config_path)\n",
|
| 216 |
" print(\"\\n\" + \"=\"*60)\n",
|
| 217 |
-
" print(\"TRAINING COMPLETED
|
| 218 |
" print(\"=\"*60)\n",
|
| 219 |
"except Exception as e:\n",
|
| 220 |
" print(f\"\\nโ Training failed: {e}\")\n",
|
|
@@ -229,7 +236,7 @@
|
|
| 229 |
"metadata": {},
|
| 230 |
"outputs": [],
|
| 231 |
"source": [
|
| 232 |
-
"# STEP 7: Merge LoRA adapter
|
| 233 |
"import sys\n",
|
| 234 |
"sys.path.insert(0, os.path.join(REPO_DIR, \"stack_2_9_training\"))\n",
|
| 235 |
"from stack_2_9_training.merge_adapter import merge_adapter\n",
|
|
@@ -239,10 +246,8 @@
|
|
| 239 |
"os.makedirs(merged_dir, exist_ok=True)\n",
|
| 240 |
"\n",
|
| 241 |
"print(\"=\"*60)\n",
|
| 242 |
-
"print(\"MERGING
|
| 243 |
"print(\"=\"*60)\n",
|
| 244 |
-
"print(f\"LoRA adapter: {lora_dir}\")\n",
|
| 245 |
-
"print(f\"Output: {merged_dir}\")\n",
|
| 246 |
"\n",
|
| 247 |
"try:\n",
|
| 248 |
" merge_adapter(\n",
|
|
@@ -252,18 +257,18 @@
|
|
| 252 |
" use_safetensors=True\n",
|
| 253 |
" )\n",
|
| 254 |
" print(\"\\nโ
Merge completed!\")\n",
|
| 255 |
-
" print(f\"
|
| 256 |
"except Exception as e:\n",
|
| 257 |
" print(f\"\\nโ Merge failed: {e}\")\n",
|
| 258 |
" import traceback\n",
|
| 259 |
" traceback.print_exc()\n",
|
| 260 |
" raise\n",
|
| 261 |
"\n",
|
| 262 |
-
"print(\"=\"*60)\n",
|
| 263 |
"print(\"๐ ALL DONE!\")\n",
|
| 264 |
"print(\"=\"*60)\n",
|
| 265 |
-
"print(f\"\\n๐ฆ
|
| 266 |
-
"print(\"\\nโณ Download
|
| 267 |
]
|
| 268 |
}
|
| 269 |
],
|
|
|
|
| 16 |
"---\n",
|
| 17 |
"\n",
|
| 18 |
"**Instructions:**\n",
|
| 19 |
+
"1. Enable GPU: Settings โ Accelerator โ GPU T4\n",
|
| 20 |
"2. Run cells in order from the top\n",
|
| 21 |
"3. Model auto-downloads if not present\n",
|
| 22 |
"\n",
|
|
|
|
| 46 |
"import shutil\n",
|
| 47 |
"import subprocess\n",
|
| 48 |
"\n",
|
|
|
|
| 49 |
"os.chdir(\"/kaggle/working\")\n",
|
| 50 |
"\n",
|
| 51 |
"REPO_DIR = \"/kaggle/working/stack-2.9\"\n",
|
| 52 |
"MODEL_DIR = os.path.join(REPO_DIR, \"base_model_qwen7b\")\n",
|
| 53 |
"OUTPUT_DIR = os.path.join(REPO_DIR, \"training_output\")\n",
|
| 54 |
"\n",
|
| 55 |
+
"# Remove old repo if exists\n",
|
| 56 |
"if os.path.exists(REPO_DIR):\n",
|
| 57 |
" shutil.rmtree(REPO_DIR)\n",
|
| 58 |
"\n",
|
| 59 |
+
"# Clone fresh\n",
|
| 60 |
"subprocess.run([\"git\", \"clone\", \"https://github.com/my-ai-stack/stack-2.9.git\", REPO_DIR], check=True)\n",
|
| 61 |
"os.chdir(REPO_DIR)\n",
|
| 62 |
"\n",
|
| 63 |
+
"print(f\"โ
Working in: {os.getcwd()}\")"
|
|
|
|
|
|
|
| 64 |
]
|
| 65 |
},
|
| 66 |
{
|
|
|
|
| 73 |
"import subprocess\n",
|
| 74 |
"\n",
|
| 75 |
"subprocess.run([\"pip\", \"install\", \"-q\", \"torch\", \"torchvision\", \"torchaudio\", \"--index-url\", \"https://download.pytorch.org/whl/cu118\"], check=True)\n",
|
| 76 |
+
"subprocess.run([\"pip\", \"install\", \"-q\", \"transformers==4.40.0\", \"peft==0.10.0\", \"accelerate==0.34.0\", \"datasets\", \"pyyaml\", \"tqdm\", \"scipy\", \"bitsandbytes==0.43.0\"], check=True)\n",
|
| 77 |
"print(\"โ
Dependencies installed\")"
|
| 78 |
]
|
| 79 |
},
|
|
|
|
| 85 |
"source": [
|
| 86 |
"# STEP 4: Prepare training data\n",
|
| 87 |
"import os\n",
|
| 88 |
+
"import json\n",
|
| 89 |
"\n",
|
| 90 |
+
"# Check for available training data\n",
|
| 91 |
"REPO_TRAIN_DATA = os.path.join(REPO_DIR, \"training-data/final/train.jsonl\")\n",
|
| 92 |
"MINI_DATA_DIR = os.path.join(REPO_DIR, \"data_mini\")\n",
|
| 93 |
"MINI_DATA_FILE = os.path.join(MINI_DATA_DIR, \"train_mini.jsonl\")\n",
|
| 94 |
+
"SYNTHETIC_DATA_FILE = os.path.join(REPO_DIR, \"data/synthetic.jsonl\")\n",
|
| 95 |
"\n",
|
| 96 |
"print(\"๐ Checking for training data...\")\n",
|
| 97 |
+
"\n",
|
| 98 |
"if os.path.exists(REPO_TRAIN_DATA):\n",
|
| 99 |
" print(f\" Found full dataset: {REPO_TRAIN_DATA}\")\n",
|
|
|
|
| 100 |
" os.makedirs(MINI_DATA_DIR, exist_ok=True)\n",
|
| 101 |
" if not os.path.exists(MINI_DATA_FILE):\n",
|
| 102 |
" print(\" Creating mini dataset (1000 samples)...\")\n",
|
|
|
|
| 104 |
" subprocess.run([\"python\", os.path.join(REPO_DIR, \"scripts/create_mini_dataset.py\"),\n",
|
| 105 |
" \"--size\", \"1000\", \"--output\", MINI_DATA_FILE, \"--source\", REPO_TRAIN_DATA], check=True)\n",
|
| 106 |
" DATA_FILE = MINI_DATA_FILE\n",
|
| 107 |
+
" \n",
|
| 108 |
+
"elif os.path.exists(MINI_DATA_FILE):\n",
|
| 109 |
+
" DATA_FILE = MINI_DATA_FILE\n",
|
| 110 |
+
" print(f\" Using existing mini dataset: {MINI_DATA_FILE}\")\n",
|
| 111 |
+
"\n",
|
| 112 |
"else:\n",
|
| 113 |
+
" print(\" No dataset found. Creating synthetic data...\")\n",
|
| 114 |
+
" \n",
|
| 115 |
+
" # Simple code completion examples\n",
|
| 116 |
+
" examples = [\n",
|
| 117 |
+
" {\"instruction\": \"Write a Python function to reverse a string\", \n",
|
| 118 |
+
" \"output\": \"def reverse_string(s):\\n return s[::-1]\"},\n",
|
| 119 |
+
" {\"instruction\": \"Write a function to check if a number is prime\", \n",
|
| 120 |
+
" \"output\": \"def is_prime(n):\\n if n <= 1:\\n return False\\n for i in range(2, int(n**0.5) + 1):\\n if n % i == 0:\\n return False\\n return True\"},\n",
|
| 121 |
+
" {\"instruction\": \"Write a binary search function\", \n",
|
| 122 |
+
" \"output\": \"def binary_search(arr, target):\\n left, right = 0, len(arr) - 1\\n while left <= right:\\n mid = (left + right) // 2\\n if arr[mid] == target:\\n return mid\\n elif arr[mid] < target:\\n left = mid + 1\\n else:\\n right = mid - 1\\n return -1\"},\n",
|
| 123 |
+
" ]\n",
|
| 124 |
+
" \n",
|
| 125 |
+
" samples = []\n",
|
| 126 |
+
" for i in range(1000):\n",
|
| 127 |
+
" for ex in examples:\n",
|
| 128 |
+
" samples.append(ex)\n",
|
| 129 |
+
" \n",
|
| 130 |
+
" os.makedirs(os.path.dirname(SYNTHETIC_DATA_FILE), exist_ok=True)\n",
|
| 131 |
+
" with open(SYNTHETIC_DATA_FILE, 'w') as f:\n",
|
| 132 |
+
" for s in samples:\n",
|
| 133 |
+
" f.write(json.dumps(s) + '\\n')\n",
|
| 134 |
+
" \n",
|
| 135 |
+
" DATA_FILE = SYNTHETIC_DATA_FILE\n",
|
| 136 |
+
" print(f\" Created synthetic dataset: {len(samples)} samples\")\n",
|
| 137 |
"\n",
|
| 138 |
"print(f\"\\nโ
Using training data: {DATA_FILE}\")\n",
|
| 139 |
"print(f\" Size: {os.path.getsize(DATA_FILE) / 1024:.1f} KB\")"
|
|
|
|
| 158 |
" 'torch_dtype': 'float16'\n",
|
| 159 |
" },\n",
|
| 160 |
" 'data': {\n",
|
| 161 |
+
" 'input_path': DATA_FILE,\n",
|
| 162 |
" 'max_length': 2048,\n",
|
| 163 |
+
" 'train_split': 1.0\n",
|
| 164 |
" },\n",
|
| 165 |
" 'lora': {\n",
|
| 166 |
" 'r': 16,\n",
|
|
|
|
| 189 |
" 'lora_dir': os.path.join(OUTPUT_DIR, 'lora'),\n",
|
| 190 |
" 'logging_dir': os.path.join(OUTPUT_DIR, 'logs')\n",
|
| 191 |
" },\n",
|
| 192 |
+
" 'quantization': {'enabled': False},\n",
|
| 193 |
+
" 'hardware': {'device': 'cuda', 'num_gpus': 1, 'use_4bit': False, 'use_8bit': False}\n",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 194 |
"}\n",
|
| 195 |
"\n",
|
| 196 |
"config_path = os.path.join(OUTPUT_DIR, \"train_config.yaml\")\n",
|
| 197 |
"with open(config_path, 'w') as f:\n",
|
| 198 |
" yaml.dump(config, f, default_flow_style=False)\n",
|
| 199 |
"\n",
|
| 200 |
+
"print(f\"โ
Config saved: {config_path}\")\n",
|
|
|
|
| 201 |
"print(f\" Model: {config['model']['name']}\")\n",
|
| 202 |
+
"print(f\" Data: {config['data']['input_path']}\")"
|
|
|
|
|
|
|
|
|
|
| 203 |
]
|
| 204 |
},
|
| 205 |
{
|
|
|
|
| 215 |
"print(\"=\"*60)\n",
|
| 216 |
"print(\"STARTING TRAINING\")\n",
|
| 217 |
"print(\"=\"*60)\n",
|
|
|
|
|
|
|
|
|
|
| 218 |
"\n",
|
|
|
|
| 219 |
"from stack_2_9_training.train_lora import train_lora\n",
|
| 220 |
"\n",
|
| 221 |
"try:\n",
|
| 222 |
" trainer = train_lora(config_path)\n",
|
| 223 |
" print(\"\\n\" + \"=\"*60)\n",
|
| 224 |
+
" print(\"TRAINING COMPLETED\")\n",
|
| 225 |
" print(\"=\"*60)\n",
|
| 226 |
"except Exception as e:\n",
|
| 227 |
" print(f\"\\nโ Training failed: {e}\")\n",
|
|
|
|
| 236 |
"metadata": {},
|
| 237 |
"outputs": [],
|
| 238 |
"source": [
|
| 239 |
+
"# STEP 7: Merge LoRA adapter\n",
|
| 240 |
"import sys\n",
|
| 241 |
"sys.path.insert(0, os.path.join(REPO_DIR, \"stack_2_9_training\"))\n",
|
| 242 |
"from stack_2_9_training.merge_adapter import merge_adapter\n",
|
|
|
|
| 246 |
"os.makedirs(merged_dir, exist_ok=True)\n",
|
| 247 |
"\n",
|
| 248 |
"print(\"=\"*60)\n",
|
| 249 |
+
"print(\"MERGING\")\n",
|
| 250 |
"print(\"=\"*60)\n",
|
|
|
|
|
|
|
| 251 |
"\n",
|
| 252 |
"try:\n",
|
| 253 |
" merge_adapter(\n",
|
|
|
|
| 257 |
" use_safetensors=True\n",
|
| 258 |
" )\n",
|
| 259 |
" print(\"\\nโ
Merge completed!\")\n",
|
| 260 |
+
" print(f\"Files: {os.listdir(merged_dir)}\")\n",
|
| 261 |
"except Exception as e:\n",
|
| 262 |
" print(f\"\\nโ Merge failed: {e}\")\n",
|
| 263 |
" import traceback\n",
|
| 264 |
" traceback.print_exc()\n",
|
| 265 |
" raise\n",
|
| 266 |
"\n",
|
| 267 |
+
"print(\"\\n\" + \"=\"*60)\n",
|
| 268 |
"print(\"๐ ALL DONE!\")\n",
|
| 269 |
"print(\"=\"*60)\n",
|
| 270 |
+
"print(f\"\\n๐ฆ Model ready: {merged_dir}\")\n",
|
| 271 |
+
"print(\"\\nโณ Download 'merged' folder from Kaggle Output panel before session ends!\")"
|
| 272 |
]
|
| 273 |
}
|
| 274 |
],
|