hf_mirrors/Exodia-7B
Model Introduction
Files & versions
Analysis

Master of Merging

how to use

from openmind import AutoTokenizer, AutoModelForCausalLM, is_torch_npu_available
from openmind_hub import snapshot_download
import torch.nn.functional as F
from torch import Tensor
import openmind
import torch
import argparse
import sys
import time

def parse_args():
    parser = argparse.ArgumentParser()
    parser.add_argument(
        "--model_name_or_path",
        type=str,
        help="Path to model",
        default="zhouhui/pretrainmodel/Exodia-7B",
    )
    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"
    start_time = time.time()      
    model = AutoModelForCausalLM.from_pretrained(model_path,trust_remote_code=True).to(device)
    tokenizer = AutoTokenizer.from_pretrained(model_path,trust_remote_code=True)
    model.eval()

    prompt = "Hello, who are you?"
    input_ids = tokenizer(prompt, return_tensors="pt").input_ids.to(device)
    max_new_tokens = 100
    outputs = model.generate(input_ids=input_ids, max_length=max_new_tokens, do_sample=True, temperature=0.7, top_p=0.3, top_k=0)
    response = tokenizer.decode(outputs[0], skip_special_tokens=True)
    print(response)
    end_time = time.time()
    print(f"硬件环境:{device},推理执行时间:{end_time - start_time}秒")
    
if __name__ == "__main__":
    main()

"Buy Me A Coffee"

The Large Language Model, or LLM, represents a groundbreaking advancement in the realm of artificial intelligence. By fusing together insights and data from various individual models, the LLM is designed to harness the best of each while mitigating their individual weaknesses. This amalgamation allows the LLM to demonstrate unparalleled capability in understanding context, generating accurate content, and adapting to diverse tasks. The integrated approach ensures that users benefit from increased accuracy, wider knowledge coverage, and a more nuanced understanding of both structured and unstructured data. Essentially, the LLM epitomizes the next step in the evolution of AI, bringing about a model that is greater than the sum of its parts.