Pearl-3x7B / README.md
louisbrulenaudet's picture
Update README.md
63499a3 verified
|
raw
history blame
4.93 kB
metadata
license: apache-2.0
tags:
  - moe
  - frankenmoe
  - merge
  - mergekit
  - lazymergekit
  - dvilasuero/DistilabelBeagle14-7B
  - beowolx/CodeNinja-1.0-OpenChat-7B
  - WizardLM/WizardMath-7B-V1.1
  - Maths
  - Code
  - Python
base_model:
  - dvilasuero/DistilabelBeagle14-7B
  - beowolx/CodeNinja-1.0-OpenChat-7B
  - WizardLM/WizardMath-7B-V1.1
language:
  - en
library_name: transformers
pipeline_tag: text-generation

Pearl-3x7B, an xtraordinary Mixture of Experts (MoE) for data science

Pearl-3x7B is a Mixture of Experts (MoE) made with the following models :

A Mixture of Experts (MoE) model represents a sophisticated architecture that amalgamates the capabilities of multiple specialized models to address a wide array of tasks within a unified framework. Within the realm of a MoE model tailored for a chat application, the integration of expertise spanning three distinct domains - chat, code, and mathematics - substantially enhances its capacity to furnish nuanced and precise responses to a diverse spectrum of user inquiries.

The initial expert model, honed for chat applications, exhibits prowess in comprehending natural language nuances, conversational dynamics, and contextual cues. Drawing upon extensive conversational data, it adeptly generates engaging and contextually pertinent responses, thereby fostering meaningful interactions with users.

The subsequent expert model, centered on code, brings to the fore proficiency in programming languages, algorithms, and software engineering principles. Possessing a deep-seated understanding of syntax, logical constructs, and problem-solving methodologies, it deftly tackles queries spanning coding challenges, debugging assistance, and software development inquiries.

Lastly, the third expert model, specializing in mathematics, boasts expertise in mathematical reasoning, problem-solving strategies, and analytical techniques. Armed with a breadth of knowledge encompassing arithmetic, algebra, calculus, and beyond, it offers precise solutions, lucid explanations, and profound insights for mathematical queries, equations, and proofs.

Configuration

base_model: argilla/CapybaraHermes-2.5-Mistral-7B
experts:
  - source_model: dvilasuero/DistilabelBeagle14-7B
    positive_prompts:
      - "chat"
      - "assistant"
      - "tell me"
      - "explain"
      - "help"
      - "guide"
      - "assist"
      - "answer"
      - "support"
      - "clarify"
      - "elaborate"
      - "educate"
      - "inform"
      - "advise"
      - "instruct"
  - source_model: beowolx/CodeNinja-1.0-OpenChat-7B
    positive_prompts:
      - "code"
      - "python"
      - "javascript"
      - "programming"
      - "algorithm"
      - "develop"
      - "debug"
      - "optimize"
      - "software"
      - "engineer"
      - "web"
      - "application"
      - "framework"
      - "library"
      - "syntax"
      - "logic"
      - "compile"
      - "execute"
  - source_model: WizardLM/WizardMath-7B-V1.1
    positive_prompts:
      - "reason"
      - "math"
      - "mathematics"
      - "solve"
      - "count"
      - "calculate"
      - "analyze"
      - "derive"
      - "compute"
      - "numbers"
      - "equation"
      - "theorem"
      - "proof"
      - "geometry"
      - "trigonometry"
      - "statistics"
      - "probability"
      - "algebra"
      - "integral"

Usage

!pip install -qU transformers bitsandbytes accelerate

from transformers import AutoTokenizer
import transformers
import torch

model = "louisbrulenaudet/Pearl-3x7B"

tokenizer = AutoTokenizer.from_pretrained(model)
pipeline = transformers.pipeline(
    "text-generation",
    model=model,
    model_kwargs={"torch_dtype": torch.float16, "load_in_4bit": True},
)

messages = [{"role": "user", "content": "Explain what a Mixture of Experts is in less than 100 words."}]
prompt = pipeline.tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
outputs = pipeline(prompt, max_new_tokens=256, do_sample=True, temperature=0.7, top_k=50, top_p=0.95)
print(outputs[0]["generated_text"])

Citing & Authors

If you use this code in your research, please use the following BibTeX entry.

@misc{louisbrulenaudet2023,
  author =       {Louis Brulé Naudet},
  title =        {Pearl-3x7B, an xtraordinary Mixture of Experts (MoE) for data science},
  year =         {2023}
  howpublished = {\url{https://huggingface.co/louisbrulenaudet/Pearl-3x7B}},
}

Feedback

If you have any feedback, please reach out at louisbrulenaudet@icloud.com.