Downloads · 30 days
28
5% of all-time downloads
femiari/Qwen2-1.5Moe
Qwen2-1.5Moe is a text generation model from femiari. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as apache-2.0.
QwenMoEAriel is a Mixture of Experts (MoE) made with the following models using LazyMergekit: Qwen/Qwen2-1.5B Replete-AI/Replete-Coder-Qwen2-1.5b
Downloads · 30 days
28
5% of all-time downloads
All-time downloads
548
Public
Parameters
4.1B
43 GB on disk
Likes
2
Public
Click a slice to open those files.
.safetensors8.2 GB · 100%
From the Hugging Face model README
QwenMoEAriel is a Mixture of Experts (MoE) made with the following models using LazyMergekit:
base_model : Qwen/Qwen2-1.5B architecture: qwen experts:
!pip install -qU transformers bitsandbytes accelerate einops
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
print(device)
model = AutoModelForCausalLM.from_pretrained(
"femiari/Qwen2-1.5Moe",
torch_dtype=torch.float16,
ignore_mismatched_sizes=True
).to(device)
tokenizer = AutoTokenizer.from_pretrained("femiari/Qwen2-1.5Moe")
prompt = "Give me a short introduction to large language model."
messages = [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": prompt}
]
text = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True
)
model_inputs = tokenizer([text], return_tensors="pt").to(device)
generated_ids = model.generate(
model_inputs.input_ids,
max_new_tokens=512
)
generated_ids = [
output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
]
response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
print(response)