Views
No views yet

1from transformers import AutoModelForCausalLM, AutoTokenizer
2
3def generate_response(prompt):
4 """
5 Generate a response from the model based on the input prompt.
6 Args:
7 prompt (str): Prompt for the model.
8 Returns:
9 str: The generated response from the model.
10 """
11
12 inputs = tokenizer(prompt, return_tensors="pt")
13 outputs = model.generate(**inputs, max_new_tokens=512, eos_token_id=tokenizer.eos_token_id, pad_token_id=tokenizer.pad_token_id)
14 response = tokenizer.decode(outputs[0], skip_special_tokens=True)
15
16 return response
17
18model_id = "macadeliccc/SOLAR-polyglot-4x10.7b"
19tokenizer = AutoTokenizer.from_pretrained(model_id)
20model = AutoModelForCausalLM.from_pretrained(model_id, load_in_4bit=True)
21
22prompt = "Explain the proof of Fermat's Last Theorem and its implications in number theory."
23
24print("Response:")
25print(generate_response(prompt), "\n")1@misc{kim2023solar,
2 title={SOLAR 10.7B: Scaling Large Language Models with Simple yet Effective Depth Up-Scaling},
3 author={Dahyun Kim and Chanjun Park and Sanghoon Kim and Wonsung Lee and Wonho Song and Yunsu Kim and Hyeonwoo Kim and Yungi Kim and Hyeonju Lee and Jihoo Kim and Changbae Ahn and Seonghoon Yang and Sukyung Lee and Hyunbyung Park and Gyoungjin Gim and Mikyoung Cha and Hwalsuk Lee and Sunghun Kim},
4 year={2023},
5 eprint={2312.15166},
6 archivePrefix={arXiv},
7 primaryClass={cs.CL}
8}