hf_mirrors/solar-sft-qlora-openmind
Model Introduction
Files & versions
Analysis
You are visiting the mirror address of https://modelers.cn/jeffding/solar-sft-qlora-openmind. The repo is synchronized in real-time and is only for mirror acceleration access.

solar-sft-qlor

Use in Openmind

import torch
from openmind import AutoTokenizer, AutoModelForCausalLM, is_torch_npu_available
from openmind_hub import snapshot_download
import argparse
import time

def parse_args():
    parser = argparse.ArgumentParser()
    parser.add_argument(
        "--model_name_or_path",
        type=str,
        help="Path to model",
        default="jeffding/solar-sft-qlora-openmind",
    )
    args = parser.parse_args()
    return args

def main():
    args = parse_args()
    model_path = args.model_name_or_path

    if is_torch_npu_available():
        device = "npu:0"
    else:
        device = "cpu"
        
    tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)
    # Set `torch_dtype=torch.float16` to load model in float16, otherwise it will be loaded as float32 and might cause OOM Error.
    model = AutoModelForCausalLM.from_pretrained(model_path, torch_dtype=torch.float16, trust_remote_code=True).to(device)
    
    start_time = time.time()
    
    model = model.eval()
    inputs = tokenizer(["Give me a short introduction to large language model."], return_tensors="pt")
    for k,v in inputs.items():
        inputs[k] = v.to(device)
    gen_kwargs = {"max_length": 1000, "top_p": 0.8, "temperature": 0.8, "do_sample": True, "repetition_penalty": 1.0}
    output = model.generate(**inputs, **gen_kwargs)
    output = tokenizer.decode(output[0].tolist(), skip_special_tokens=True)
    print(output)
    
    end_time = time.time()
    print(f"硬件环境:{device},推理执行时间:{end_time - start_time}秒")

if __name__ == "__main__":
    main()
  • just for practice
  • trained by transformers, peft, bitsandbytes
  • evaluated by https://github.com/davidkim205/kollm_evaluation
TasksVersionFiltern-shotMetricValueStderr
kobest_wic1none0acc0.5056±0.0141
none0f10.4170±N/A
kobest_sentineg1none0acc0.8791±0.0164
none0f10.8779±N/A
kobest_hellaswag1none0acc0.4540±0.0223
none0f10.4522±N/A
none0acc_norm0.5600±0.0222
kobest_copa1none0acc0.6540±0.0151
none0f10.6535±N/A
kobest_boolq1none0acc0.5135±0.0133
none0f10.3592±N/A
ko_truthfulqa2none0acc0.2938±0.0159
ko_hellaswag1none0acc0.3816±0.0048
none0acc_norm0.5171±0.0050
ko_common_gen1none0acc0.8095±0.0100
none0acc_norm0.8095±0.0100
ko_arc_easy1none0acc0.3311±0.0138
none0acc_norm0.4053±0.0143