Spaces:
Paused
Paused
Commit ·
8d9183f
1
Parent(s): e2ac79e
update
Browse files
examples/tutorials/dpo/ultrafeedback-dpo-unsloth/step_5_infer_by_merged.py
CHANGED
|
@@ -8,9 +8,6 @@ import os
|
|
| 8 |
from pathlib import Path
|
| 9 |
import platform
|
| 10 |
|
| 11 |
-
# os.environ["HF_ENDPOINT"] = "https://hf-mirror.com"
|
| 12 |
-
os.environ["UNSLOTH_USE_MODELSCOPE"] = "1"
|
| 13 |
-
|
| 14 |
if platform.system() in ("Windows", "Darwin"):
|
| 15 |
from project_settings import project_path, temp_directory
|
| 16 |
else:
|
|
|
|
| 8 |
from pathlib import Path
|
| 9 |
import platform
|
| 10 |
|
|
|
|
|
|
|
|
|
|
| 11 |
if platform.system() in ("Windows", "Darwin"):
|
| 12 |
from project_settings import project_path, temp_directory
|
| 13 |
else:
|
examples/tutorials/dpo/ultrafeedback-dpo-unsloth/step_6_push_to_modelscope.py
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/python3
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
# !/usr/bin/env python3
|
| 4 |
+
# -*- coding: utf-8 -*-
|
| 5 |
+
"""
|
| 6 |
+
python step_6_push_to_modelscope.py \
|
| 7 |
+
--model_dir /root/autodl-tmp/OpenMiniMind/temp/trained_models/Qwen2.5-0.5B-ultrafeedback-dpo-ddp-qlora-unsloth-fp16 \
|
| 8 |
+
--repo_id gyd2021/Qwen2.5-0.5B-ultrafeedback-dpo-ddp-qlora-unsloth-fp16 \
|
| 9 |
+
--token your_modelscope_token
|
| 10 |
+
"""
|
| 11 |
+
|
| 12 |
+
import os
|
| 13 |
+
import argparse
|
| 14 |
+
import logging
|
| 15 |
+
|
| 16 |
+
# 设置日志格式
|
| 17 |
+
logging.basicConfig(
|
| 18 |
+
level=logging.INFO,
|
| 19 |
+
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s'
|
| 20 |
+
)
|
| 21 |
+
logger = logging.getLogger(__name__)
|
| 22 |
+
|
| 23 |
+
from modelscope.hub.api import HubApi
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
def get_args():
|
| 27 |
+
parser = argparse.ArgumentParser()
|
| 28 |
+
|
| 29 |
+
parser.add_argument("--model_dir", type=str,)
|
| 30 |
+
parser.add_argument("--repo_id", type=str)
|
| 31 |
+
parser.add_argument("--token", type=str, default=None,)
|
| 32 |
+
parser.add_argument("--chunk_size", type=int, default=50)
|
| 33 |
+
|
| 34 |
+
return parser.parse_args()
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
def main():
|
| 38 |
+
args = get_args()
|
| 39 |
+
|
| 40 |
+
api = HubApi(token=args.token)
|
| 41 |
+
api.upload_folder(
|
| 42 |
+
repo_id=args.repo_id,
|
| 43 |
+
folder_path=args.model_dir,
|
| 44 |
+
)
|
| 45 |
+
return
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
if __name__ == "__main__":
|
| 49 |
+
main()
|