CoolFace
Modelpublic

RichardErkhov/QuantumIntelligence_-_QI-mistral-7B-slerp-gguf

sourceHugging Faceupdated 2y agoView on Hugging Face
0likes930downloads
Model Card

Quantization made by Richard Erkhov.

Github

Discord

Request more models

QI-mistral-7B-slerp - GGUF

  • —Model creator: https://huggingface.co/QuantumIntelligence/
  • —Original model: https://huggingface.co/QuantumIntelligence/QI-mistral-7B-slerp/

Original model description: --- license: apache-2.0 tags:

  • —merge
  • —Korean
  • —Mistral-7B
  • —LLM ---

QI-mistral-7B-slerp

This model is based on the mistral model and merged several DPO fine-tuned models with SLERP. It processes Korean language relatively well, so it is useful when creating various applications.

QI-mistral-7B-slerp is a merge of the following models using mergekit:

🧩 Configuration

yaml
slices:
  - sources:
      - model: OpenPipe/mistral-ft-optimized-1218
        layer_range: [0, 32]
      - model: mlabonne/NeuralHermes-2.5-Mistral-7B
        layer_range: [0, 32]
merge_method: slerp
base_model: OpenPipe/mistral-ft-optimized-1218
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

Basic Usage

from transformers import AutoModelForCausalLM, AutoTokenizer, GPTQConfig
import transformers
import torch


model_id = "QuantumIntelligence/QI-mistral-7B-slerp" 

tokenizer = AutoTokenizer.from_pretrained(model_id)
# model = AutoModelForCausalLM.from_pretrained(model_id, device_map="auto")
model = AutoModelForCausalLM.from_pretrained(model_id, device_map="auto", load_in_8bit=True) # quantization

pipeline = transformers.pipeline(
    "text-generation",
    model=model,
    torch_dtype=torch.float16,
    device_map="auto",
    tokenizer=tokenizer,
)

prompt = """Classify the text into neutral, negative or positive. 
Text: This movie is definitely one of my favorite movies of its kind. The interaction between respectable and morally strong characters is an ode to chivalry and the honor code amongst thieves and policemen.
Sentiment:
"""

outputs = pipeline(prompt, max_new_tokens=6)
print(outputs[0]["generated_text"])

Using Korean

  • —Sentiment
# prompt = """
# 다음 텍스트를 중립, 부정, 긍정으로 분류해줘.
# 텍스트: 하늘을 보니 비가 올듯 하다. 우울한 기분이 들어서 술을 한잔 할까 고민중인데 같이 마실 사람이 없다.
# 감정:
# """

outputs = pipeline(prompt, max_new_tokens=6)
print(outputs[0]["generated_text"])
# 
  • —Summarization
prompt = """
이순신(한국 한자: 李舜臣, 1545년 4월 28일 (음력 3월 8일) ~ 1598년 12월 16일 (음력 11월 19일))은 조선 중기의 무신이었다. 본관은 덕수(德水), 자는 여해(汝諧), 시호는 충무(忠武)였으며, 한성 출신이었다. 문반 가문 출신으로 1576년(선조 9년) 무과(武科)에 급제[2]하여 그 관직이 동구비보 권관, 훈련원 봉사, 발포진 수군만호, 조산보 만호, 전라남도수사를 거쳐 정헌대부 삼도수군통제사에 이르렀다.
함경도 동구비보권관(董仇非堡權管), 1581년 발포 수군만호(鉢浦水軍萬戶)가 되었다가 전라남수영의 오동나무를 베기를 거절하여 좌수사 성박의 미움을 받기도 했다. 이후 1584년 남병사의 군관과 건원보권관, 훈련원참군, 1586년 사복시주부를 거쳐 조산보만호 겸 녹도둔전사의(造山堡萬戶兼鹿島屯田事宜)로 부임했다. 조산만호 겸 녹둔도사의 재직 중 1587년(선조 20년) 9월의 여진족의 사전 기습공격으로 벌어진 녹둔도전투에서 이겼지만 피해가 커서, 북병사 이일의 탄핵을 받고 백의종군(白衣從軍)하는 위치에 서기도 했다. 그 뒤 두번째 여진족과의 교전에서 승전, 복직하였다. 그 뒤 전라관찰사 이광(李洸)에게 발탁되어 전라도 조방장, 선전관 등을 역임했다. 1589년 정읍현감 재직 중 류성룡의 추천으로 고사리첨사(高沙里僉使)가 되고, 절충장군(折衝將軍), 만포진첨사(滿浦鎭僉使), 진도군수 등을 거쳐 전라좌도수군절도사가 되어 임진왜란을 만나게 되었다.
임진왜란 때 조선의 삼도수군통제사가 되어 부하들을 통솔하는 지도력, 뛰어난 지략, 그리고 탁월한 전략과 능수능란한 전술로 일본 수군과의 해전에서 연전연승해 나라를 구한 성웅(聖雄)으로 추앙받고 있다. 노량 해전에서 전사한 뒤 선무공신 1등관에 추록되고 증 의정부우의정에 추증되고 덕풍군에 추봉되었다가, 광해군 때 다시 증 의정부좌의정에 추증되고 덕풍부원군에 추봉되었고, 정조 때에는 증 의정부영의정으로 가증(加贈)되었다.
고려 때 정5품 중랑장(中郎將)을 지낸 덕수 이씨의 시조 이돈수(李敦守)의 12대손이며, 조선 초 영중추부사(領中樞府事)를 지낸 이변(李邊)[3]의 후손이다. 외가는 초계 변씨(卞氏), 처가는 온양 방씨(方氏, 당시에는 상주 방씨)이다. 그의 묘는 충청남도 아산시에 있다. 

위 문장을 300자내로 요약해줘.
요약:
"""

outputs = pipeline(prompt, max_new_tokens=300, do_sample=True, top_k=50, return_full_text = False)
print(outputs[0]["generated_text"])

  • —Question answering
prompt = """
다음 문맥에 대해 아래 질문에 대해 답해줘.
문맥: 1565년 이순신은 방씨(方氏)와 혼인하고 보성군수를 지낸 장인 방진의 후원으로 병학을 배우면서 무과(武科)를 준비하였다. 28살이던 1572년(선조 5년) 훈련원 별과(訓錬院 別科)에 응시했으나 시험을 보던 중, 말에서 낙마하여 주변 사람들이 기절한 줄 알았으나 옆에 있던 버드나무 껍질을 벗겨 다리를 동여매고 시험을 끝까지 치렀다. 하지만 결국 시험에서는 낙방하고 만다.
질문: 이순신은 28살에 무과에 합격하는가?
대답:
"""

outputs = pipeline(prompt, max_new_tokens=30, do_sample=True, top_k=50, return_full_text = False)
generated_text = outputs[0]["generated_text"]
print(generated_text)

# 아니요, 28살에 무과에 합격하지 못하였다.
  • —Chatbot style
messages = [{"role": "user", "content": "좋은 취미를 가지려면 어떻게 하나요?"}]
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)

outputs = pipeline(prompt, max_new_tokens=512, do_sample=True, temperature=0.7, top_k=50, top_p=0.95, return_full_text = False) 
generated_text = outputs[0]["generated_text"]

print(generated_text)

For Development

The support of GPU computing resource is required for the development and implementation of state-of-the-art models. I would appreciate if anyone could help.

Email: baida21@naver.com