Views
No views yet
1gate_mode: hidden # one of "hidden", "cheap_embed", or "random"
2dtype: bfloat16 # output dtype (float32, float16, or bfloat16)
3experts:
4 - source_model: mistralai/Mistral-7B-Instruct-v0.2
5 positive_prompts:
6 - "What are some fun activities to do in Seattle?"
7 - "What are the potential long-term economic impacts of raising the minimum wage?"
8 - source_model: nvidia/OpenMath-Mistral-7B-v0.1-hf
9 positive_prompts:
10 - "What is 27 * 49? Show your step-by-step work."
11 - "Natalia sold clips to 48 of her friends in April, and then she sold half as many clips in May. How many clips did Natalia sell altogether in April and May?"1!pip install -qU transformers bitsandbytes accelerate
2
3from transformers import AutoTokenizer
4import transformers
5import torch
6
7model = "HachiML/mistral_2x7b_v0.1"
8
9tokenizer = AutoTokenizer.from_pretrained(model)
10pipeline = transformers.pipeline(
11 "text-generation",
12 model=model,
13 model_kwargs={"torch_dtype": torch.float16, "load_in_4bit": True},
14)
15
16messages = [{"role": "user", "content": "Explain what a Mixture of Experts is in less than 100 words."}]
17prompt = pipeline.tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
18outputs = pipeline(prompt, max_new_tokens=256, do_sample=True, temperature=0.7, top_k=50, top_p=0.95)
19print(outputs[0]["generated_text"])