File size: 1,077 Bytes
5cefbe3
 
 
 
 
 
 
 
 
 
98613cb
 
 
 
5cefbe3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
---
datasets:
- upb-nlp/article_to_search_query
language:
- ro
- en
base_model:
- OpenLLM-Ro/RoLlama2-7b-Base
---

<div align="center">
  <img src="images/logo.png" alt="Logo" width="240" height="240">
</div>

## How to Get Started with the Model

Use the code below to get started with the model.

```python
from transformers import AutoTokenizer, AutoModelForCausalLM

tokenizer = AutoTokenizer.from_pretrained("upb-nlp/rollama2_7b_article_to_search_query")
model = AutoModelForCausalLM.from_pretrained("upb-nlp/rollama2_7b_article_to_search_query")

BASE_PROMPT = """You are a tool that turns news articles into realistic Google search queries someone might use to find the article.

<article>
{}
</article>

search query: """

INPUT_ARTICLE = "This is your article's title. This is your article's body."
input_text = BASE_PROMPT.format(INPUT_ARTICLE)

input_ids = tokenizer(input_text, truncation=True, max_length=1024, return_tensors="pt").to(torch.device('cuda'))
outputs = model.generate(**input_ids, max_new_tokens=100)
decoded_output = tokenizer.decode(outputs[0])
```