llama-moe/LLaMA-MoE-v1-3_5B-2_8-sft

Model

LLaMA-MoE-v1-3.5B (2/8) SFT

3

3 commits

1 linked in READMEs

updated Jun 25, 2024

See the code

README

LLaMA-MoE-v1-3.5B (2/8) SFT

[πŸ’» Code] | [πŸ“œ Technical Report]

This is the supervised fine-tuned version of LLaMA-MoE-v1-3_5B-2_8 on Deita-6k for 2 epochs.

Model#Activated Experts#Experts#Activated ParamsFoundation ModelSFT Model
LLaMA-MoE-3.0B2163.0BπŸ€— baseπŸ€— SFT
LLaMA-MoE-3.5B (4/16)4163.5BπŸ€— baseπŸ€— SFT
LLaMA-MoE-3.5B (2/8)283.5BπŸ€— baseπŸ€— SFT

πŸš€ QuickStart

# python>=3.10

import torch
from transformers import AutoTokenizer, AutoModelForCausalLM

model_dir = "llama-moe/LLaMA-MoE-v1-3_5B-2_8-sft"
tokenizer = AutoTokenizer.from_pretrained(model_dir, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(model_dir, torch_dtype=torch.bfloat16, trust_remote_code=True)
model.eval()
model.cuda()

input_text = "A chat between a curious user and an artificial intelligence assistant. The assistant gives helpful, detailed, and polite answers to the user's questions. human: Give me a three-day plan in Suzhou. gpt:"
inputs = tokenizer(input_text, return_tensors="pt")
input_ids = inputs["input_ids"].cuda()

pred = model.generate(input_ids, max_length=100, temperature=1.0, do_sample=True, use_cache=True)
print(tokenizer.decode(pred.cpu()[0], skip_special_tokens=True))
"""
Sure, I can provide you with a three-day itinerary in Suzhou. Here's what we can do:

Day 1:

* Visit Suzhou Industrial Park, a major commercial and manufacturing district ...
"""

πŸ“Š Performance

ModelMMLUARC-cHellaSeagTruthfulQAMT-Bench
Sheared LLaMA-2.7B ShareGPT28.4141.0471.2147.653.79
Sheared LLaMA-2.7B Deita6K (Our Impl.)25.2443.6971.7049.004.06
LLaMA-MoE-v1-3.0B (2/16)23.6143.4372.2844.244.15
LLaMA-MoE-v1-3.5B (4/16)26.4948.2975.1045.914.60
LLaMA-MoE-v1-3.5B (2/8)25.5345.9974.9544.394.72

πŸ“ƒ Citation

@article{llama-moe,
  title={LLaMA-MoE: Building Mixture-of-Experts from LLaMA with Continual Pre-training},
  author={Tong Zhu and Xiaoye Qu and Daize Dong and Jiacheng Ruan and Jingqi Tong and Conghui He and Yu Cheng},
  journal={arXiv preprint arXiv:2406.16554},
  year={2024},
  url={https://arxiv.org/abs/2406.16554},
}
custom_code
llama_moe
safetensors
text-generation
transformers

Contributors

Spico

3 commits

llama-moe/LLaMA-MoE-v1-3_5B-2_8-sft

Model

LLaMA-MoE-v1-3.5B (2/8) SFT

3

3 commits

1 linked in READMEs

updated Jun 25, 2024

See the code

README

LLaMA-MoE-v1-3.5B (2/8) SFT

[πŸ’» Code] | [πŸ“œ Technical Report]

This is the supervised fine-tuned version of LLaMA-MoE-v1-3_5B-2_8 on Deita-6k for 2 epochs.

Model#Activated Experts#Experts#Activated ParamsFoundation ModelSFT Model
LLaMA-MoE-3.0B2163.0BπŸ€— baseπŸ€— SFT
LLaMA-MoE-3.5B (4/16)4163.5BπŸ€— baseπŸ€— SFT
LLaMA-MoE-3.5B (2/8)283.5BπŸ€— baseπŸ€— SFT

πŸš€ QuickStart

# python>=3.10

import torch
from transformers import AutoTokenizer, AutoModelForCausalLM

model_dir = "llama-moe/LLaMA-MoE-v1-3_5B-2_8-sft"
tokenizer = AutoTokenizer.from_pretrained(model_dir, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(model_dir, torch_dtype=torch.bfloat16, trust_remote_code=True)
model.eval()
model.cuda()

input_text = "A chat between a curious user and an artificial intelligence assistant. The assistant gives helpful, detailed, and polite answers to the user's questions. human: Give me a three-day plan in Suzhou. gpt:"
inputs = tokenizer(input_text, return_tensors="pt")
input_ids = inputs["input_ids"].cuda()

pred = model.generate(input_ids, max_length=100, temperature=1.0, do_sample=True, use_cache=True)
print(tokenizer.decode(pred.cpu()[0], skip_special_tokens=True))
"""
Sure, I can provide you with a three-day itinerary in Suzhou. Here's what we can do:

Day 1:

* Visit Suzhou Industrial Park, a major commercial and manufacturing district ...
"""

πŸ“Š Performance

ModelMMLUARC-cHellaSeagTruthfulQAMT-Bench
Sheared LLaMA-2.7B ShareGPT28.4141.0471.2147.653.79
Sheared LLaMA-2.7B Deita6K (Our Impl.)25.2443.6971.7049.004.06
LLaMA-MoE-v1-3.0B (2/16)23.6143.4372.2844.244.15
LLaMA-MoE-v1-3.5B (4/16)26.4948.2975.1045.914.60
LLaMA-MoE-v1-3.5B (2/8)25.5345.9974.9544.394.72

πŸ“ƒ Citation

@article{llama-moe,
  title={LLaMA-MoE: Building Mixture-of-Experts from LLaMA with Continual Pre-training},
  author={Tong Zhu and Xiaoye Qu and Daize Dong and Jiacheng Ruan and Jingqi Tong and Conghui He and Yu Cheng},
  journal={arXiv preprint arXiv:2406.16554},
  year={2024},
  url={https://arxiv.org/abs/2406.16554},
}
custom_code
llama_moe
safetensors
text-generation
transformers

Contributors

Spico

3 commits