Views
No views yet
1import transformers
2from transformers import AutoModelForCausalLM, AutoTokenizer, TextStreamer
3
4assert transformers.__version__ >= "4.34.1"
5
6model = AutoModelForCausalLM.from_pretrained("cyberagent/calm2-7b-chat-dpo-experimental", device_map="auto", torch_dtype="auto")
7tokenizer = AutoTokenizer.from_pretrained("cyberagent/calm2-7b-chat-dpo-experimental")
8streamer = TextStreamer(tokenizer, skip_prompt=True, skip_special_tokens=True)
9
10prompt = """USER: AIによって私達の暮らしはどのように変わりますか?
11ASSISTANT: """
12
13token_ids = tokenizer.encode(prompt, return_tensors="pt")
14output_ids = model.generate(
15 input_ids=token_ids.to(model.device),
16 max_new_tokens=300,
17 do_sample=True,
18 temperature=0.8,
19 streamer=streamer,
20)| calm2-7b-chat | calm2-7b-chat-dpo |
|---|---|
| 2.67 | 2.85 |
| calm2-7b-chat | calm2-7b-chat-dpo | |
|---|---|---|
| 平均 | 6.1 | 6.7 |
| extraction | 4.1 | 5.4 |
| humanities | 8.2 | 8.4 |
| reasoning | 3.9 | 4.3 |
| roleplay | 6.4 | 7.0 |
| stem | 6.3 | 6.2 |
| writing | 7.7 | 9.1 |
1@inproceedings{jinnai-2024-cross,
2 title = "Does Cross-Cultural Alignment Change the Commonsense Morality of Language Models?",
3 author = "Jinnai, Yuu",
4 editor = "Prabhakaran, Vinodkumar and
5 Dev, Sunipa and
6 Benotti, Luciana and
7 Hershcovich, Daniel and
8 Cabello, Laura and
9 Cao, Yong and
10 Adebara, Ife and
11 Zhou, Li",
12 booktitle = "Proceedings of the 2nd Workshop on Cross-Cultural Considerations in NLP",
13 month = aug,
14 year = "2024",
15 address = "Bangkok, Thailand",
16 publisher = "Association for Computational Linguistics",
17 url = "https://aclanthology.org/2024.c3nlp-1.5",
18 pages = "48--64",
19}