Safetensors
gemma2
Moyu-hrsun commited on
Commit
b7e3fa2
·
verified ·
1 Parent(s): 052eac4

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +65 -0
README.md ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ datasets:
4
+ - openai/summarize_from_feedback
5
+ base_model:
6
+ - google/gemma-2-27b
7
+ ---
8
+ # Model Card for MA-RLHF
9
+ <a href="https://iclr.cc/Conferences/2024" target="_blank">
10
+ <img alt="ICLR 2025" src="https://img.shields.io/badge/Proceedings-ICLR2025-red" />
11
+ </a>
12
+
13
+ This repository contains the official checkpoint for [Reinforcement Learning From Human Feedback with Macro Actions (MA-RLHF)](https://arxiv.org/pdf/2410.02743).
14
+
15
+ ## Model Description
16
+
17
+ MA-RLHF is a novel framework that integrates macro actions into conventional RLHF. The macro actions are sequences of tokens or higher-level language constructs, with can be computed through different defined termination conditions, like $n$-gram based, perplexity-based, or parsing-based termination conditions. By introducing macro actions into RLHF, we reduce the number of decision points and shorten decision trajectories, alleviating the credit assignment problem caused by long temporal distances.
18
+
19
+ ## Model Usage
20
+
21
+ ```python
22
+ from transformers import AutoModelForCausalLM, AutoTokenizer
23
+
24
+ model_path = "baidu/TLDR-Gemma-2-27B-MA-PPO-Fixed5"
25
+
26
+ tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)
27
+
28
+ model = AutoModelForCausalLM.from_pretrained(model_path, device_map="auto", torch_dtype='auto', trust_remote_code=True)
29
+
30
+ input_text = """
31
+ POST Subreddit: r/cats
32
+ Hello everyone! One of my cats is about 10 years old now, she is pretty much strictly
33
+ indoors save for some time she spends on our screened in porch each day. (She likes
34
+ to watch the birds in the yard while she suns herself by the pool, quite the princess).
35
+ Anyway, when she was younger she was very active and quite small, however with
36
+ age she has put on a pretty hefty amount of weight. I feed her indoor cat food
37
+ for weight control, I’ve switched brands a few times trying to find something that
38
+ works, I’ve cut back on feeding her by a lot (she gets very angry and demanding
39
+ when she wants food but I don’t give in) however, nothing really seems to work.
40
+ I’ve tried cat toys, and bought a harness thinking I could try to walk her but she just
41
+ lays down and looks at me like I’m stupid. Basically I just want to know if you all
42
+ have any suggestions for exercise or food. I care about her and don’t want this to
43
+ get any worse. I also have another cat that eats the same amount and type of food
44
+ as her and is a completely normal weight and only a year younger, however he is a
45
+ male, not sure if that makes a difference in predisposition for weight gain. They are
46
+ also both fixed. TL;DR:
47
+ """
48
+
49
+ input_ids = tokenizer(input_text, return_tensors='pt').to(model.device)
50
+ output_ids = model.generate(**input_ids, max_new_tokens=20)
51
+ response = tokenizer.decode(output_ids[0], skip_special_tokens=True)
52
+
53
+ print(response)
54
+ ```
55
+
56
+ ## Citation
57
+
58
+ ```
59
+ @article{chai2024ma,
60
+ title={MA-RLHF: Reinforcement Learning from Human Feedback with Macro Actions},
61
+ author={Chai, Yekun and Sun, Haoran and Fang, Huang and Wang, Shuohuan and Sun, Yu and Wu, Hua},
62
+ journal={arXiv preprint arXiv:2410.02743},
63
+ year={2024}
64
+ }
65
+ ```