Views
No views yet

1import torch
2from transformers import AutoModelForCausalLM, AutoTokenizer
3
4model_name = "elyza/ELYZA-Shortcut-1.0-Qwen-7B"
5prompt = "仕事の熱意を取り戻すためのアイデアを5つ挙げてください。"
6
7tokenizer = AutoTokenizer.from_pretrained(model_name)
8model = AutoModelForCausalLM.from_pretrained(
9 model_name,
10 torch_dtype="auto",
11 device_map="auto",
12)
13model.eval()
14messages = [{"role": "user", "content": prompt}]
15input_text = tokenizer.apply_chat_template(
16 messages,
17 tokenize=False,
18 add_generation_prompt=True
19)
20token_ids = tokenizer.encode(
21 input_text, add_special_tokens=False, return_tensors="pt"
22)
23with torch.no_grad():
24 output_ids = model.generate(
25 token_ids.to(model.device),
26 max_new_tokens=8192,
27 do_sample=True,
28 temperature=0.6,
29 top_p=0.95,
30 )
31output = tokenizer.decode(
32 output_ids.tolist()[0][token_ids.size(1):], skip_special_tokens=True
33)
34print(output)1vllm serve elyza/ELYZA-Shortcut-1.0-Qwen-7B \
2 --max-model-len 327681@misc{elyza2025thinking,
2 title={elyza/ELYZA-Thinking-1.0-Qwen-32B},
3 url={https://huggingface.co/elyza/ELYZA-Thinking-1.0-Qwen-32B},
4 author={Masato Hirakawa and Tomoaki Nakamura and Akira Sasaki and Daisuke Oba and Shoetsu Sato},
5 year={2025},
6}1@misc{qwen2.5,
2 title = {Qwen2.5: A Party of Foundation Models},
3 url = {https://qwenlm.github.io/blog/qwen2.5/},
4 author = {Qwen Team},
5 month = {September},
6 year = {2024}
7}
8
9@article{qwen2,
10 title={Qwen2 Technical Report},
11 author={An Yang and Baosong Yang and Binyuan Hui and Bo Zheng and Bowen Yu and Chang Zhou and Chengpeng Li and Chengyuan Li and Dayiheng Liu and Fei Huang and Guanting Dong and Haoran Wei and Huan Lin and Jialong Tang and Jialin Wang and Jian Yang and Jianhong Tu and Jianwei Zhang and Jianxin Ma and Jin Xu and Jingren Zhou and Jinze Bai and Jinzheng He and Junyang Lin and Kai Dang and Keming Lu and Keqin Chen and Kexin Yang and Mei Li and Mingfeng Xue and Na Ni and Pei Zhang and Peng Wang and Ru Peng and Rui Men and Ruize Gao and Runji Lin and Shijie Wang and Shuai Bai and Sinan Tan and Tianhang Zhu and Tianhao Li and Tianyu Liu and Wenbin Ge and Xiaodong Deng and Xiaohuan Zhou and Xingzhang Ren and Xinyu Zhang and Xipin Wei and Xuancheng Ren and Yang Fan and Yang Yao and Yichang Zhang and Yu Wan and Yunfei Chu and Yuqiong Liu and Zeyu Cui and Zhenru Zhang and Zhihao Fan},
12 journal={arXiv preprint arXiv:2407.10671},
13 year={2024}
14}