Views
No views yet
### Instruction:
<instruction>
### Response:1from transformers import AutoModelForCausalLM, AutoTokenizer
2
3model_name_or_path="uukuguy/speechless-sparsetral-16x7b-MoE"
4tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, trust_remote_code=True)
5model = AutoModelForCausalLM.from_pretrained(model_name_or_path, device_map="auto", trust_remote_code=True).eval()
6
7system = ""Below is an instruction that describes a task.\nWrite a response that appropriately completes the request.\n\n""
8prompt = f"{system}\n\n### Instruction:\n{instruction}\n\n### Response:"
9
10inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
11pred = model.generate(**inputs, max_length=4096, do_sample=True, top_k=50, top_p=0.99, temperature=0.9, num_return_sequences=1)
12print(tokenizer.decode(pred.cpu()[0], skip_special_tokens=True))