pkoloveas commited on
Commit
102070c
·
verified ·
1 Parent(s): 5286ed9

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +80 -3
README.md CHANGED
@@ -16,7 +16,7 @@ tags:
16
  pipeline_tag: zero-shot-classification
17
  ---
18
 
19
- # Qwen2.5-14-CIC-ACLARC
20
 
21
  A fine-tuned model for Citation Intent Classification, based on [Qwen 2.5 14B Instruct](https://huggingface.co/Qwen/Qwen2.5-14B-Instruct) and trained on the [ACL-ARC](https://huggingface.co/datasets/kejian/ACL-ARC) dataset.
22
 
@@ -28,14 +28,91 @@ A fine-tuned model for Citation Intent Classification, based on [Qwen 2.5 14B In
28
  | Background | The cited paper provides relevant Background information or is part of the body of literature.|
29
  | Motivation | The citing paper is directly motivated by the cited paper. |
30
  | Uses | The citing paper uses the methodology or tools created by the cited paper.|
31
- | Extension | The citing paper extends the methods, tools or data, etc. of the cited paper. |
32
  | Comparison or Contrast | The citing paper expresses similarities or differences to, or disagrees with, the cited paper. |
33
  | Future | *The cited paper may be a potential avenue for future work.|
34
 
35
  ## Quickstart
36
 
37
  ```python
38
- # TODO
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
  ```
40
 
41
  Details about the system prompts and query templates can be found in the paper.
 
16
  pipeline_tag: zero-shot-classification
17
  ---
18
 
19
+ # Qwen2.5-14B-CIC-ACLARC
20
 
21
  A fine-tuned model for Citation Intent Classification, based on [Qwen 2.5 14B Instruct](https://huggingface.co/Qwen/Qwen2.5-14B-Instruct) and trained on the [ACL-ARC](https://huggingface.co/datasets/kejian/ACL-ARC) dataset.
22
 
 
28
  | Background | The cited paper provides relevant Background information or is part of the body of literature.|
29
  | Motivation | The citing paper is directly motivated by the cited paper. |
30
  | Uses | The citing paper uses the methodology or tools created by the cited paper.|
31
+ | Extends | The citing paper extends the methods, tools or data, etc. of the cited paper. |
32
  | Comparison or Contrast | The citing paper expresses similarities or differences to, or disagrees with, the cited paper. |
33
  | Future | *The cited paper may be a potential avenue for future work.|
34
 
35
  ## Quickstart
36
 
37
  ```python
38
+ from transformers import AutoModelForCausalLM, AutoTokenizer
39
+
40
+ model_name = "sknow-lab/Qwen2.5-14B-CIC-ACLARC"
41
+
42
+ model = AutoModelForCausalLM.from_pretrained(
43
+ model_name,
44
+ torch_dtype="auto",
45
+ device_map="auto"
46
+ )
47
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
48
+
49
+ system_prompt = """
50
+ # CONTEXT #
51
+ You are an expert researcher tasked with classifying the intent of a citation in a scientific publication.
52
+
53
+ ########
54
+
55
+ # OBJECTIVE #
56
+ You will be given a sentence containing a citation, you must output the appropriate class as an answer.
57
+
58
+ ########
59
+
60
+ # CLASS DEFINITIONS #
61
+
62
+ The six (6) possible classes are the following: "BACKGROUND", "MOTIVATION", "USES", "EXTENDS", "COMPARES_CONTRASTS", "FUTURE".
63
+
64
+ The definitions of the classes are:
65
+ 1 - BACKGROUND: The cited paper provides relevant Background information or is part of the body of literature.
66
+ 2 - MOTIVATION: The citing paper is directly motivated by the cited paper.
67
+ 3 - USES: The citing paper uses the methodology or tools created by the cited paper.
68
+ 4 - EXTENDS: The citing paper extends the methods, tools or data, etc. of the cited paper.
69
+ 5 - COMPARES_CONTRASTS: The citing paper expresses similarities or differences to, or disagrees with, the cited paper.
70
+ 6 - FUTURE: The cited paper may be a potential avenue for future work.
71
+
72
+ ########
73
+
74
+ # RESPONSE RULES #
75
+ - Analyze only the citation marked with the @@CITATION@@ tag.
76
+ - Assign exactly one class to each citation.
77
+ - Respond only with the exact name of one of the following classes: "BACKGROUND", "MOTIVATION", "USES", "EXTENDS", "COMPARES_CONTRASTS", "FUTURE".
78
+ - Do not provide any explanation or elaboration.
79
+ """
80
+
81
+ test_citing_sentence = "However , the method we are currently using in the ATIS domain ( @@CITATION@@ ) represents our most promising approach to this problem."
82
+
83
+ user_prompt = f"""
84
+ {test_citing_sentence}
85
+ ### Question: Which is the most likely intent for this citation?
86
+ a) BACKGROUND
87
+ b) MOTIVATION
88
+ c) USES
89
+ d) EXTENDS
90
+ e) COMPARES_CONTRASTS
91
+ f) FUTURE
92
+ ### Answer:
93
+ """
94
+
95
+ messages = [
96
+ {"role": "system", "content": system_prompt},
97
+ {"role": "user", "content": user_prompt}
98
+ ]
99
+ text = tokenizer.apply_chat_template(
100
+ messages,
101
+ tokenize=False,
102
+ add_generation_prompt=True
103
+ )
104
+ model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
105
+
106
+ generated_ids = model.generate(
107
+ **model_inputs,
108
+ max_new_tokens=512
109
+ )
110
+ generated_ids = [
111
+ output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
112
+ ]
113
+
114
+ response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
115
+ # Response: USES
116
  ```
117
 
118
  Details about the system prompts and query templates can be found in the paper.