Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
datasets:
|
3 |
+
- upb-nlp/article_to_search_query
|
4 |
+
language:
|
5 |
+
- ro
|
6 |
+
- en
|
7 |
+
base_model:
|
8 |
+
- OpenLLM-Ro/RoLlama2-7b-Base
|
9 |
+
---
|
10 |
+
|
11 |
+
## How to Get Started with the Model
|
12 |
+
|
13 |
+
Use the code below to get started with the model.
|
14 |
+
|
15 |
+
```python
|
16 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
17 |
+
|
18 |
+
tokenizer = AutoTokenizer.from_pretrained("upb-nlp/rollama2_7b_article_to_search_query")
|
19 |
+
model = AutoModelForCausalLM.from_pretrained("upb-nlp/rollama2_7b_article_to_search_query")
|
20 |
+
|
21 |
+
BASE_PROMPT = """You are a tool that turns news articles into realistic Google search queries someone might use to find the article.
|
22 |
+
|
23 |
+
<article>
|
24 |
+
{}
|
25 |
+
</article>
|
26 |
+
|
27 |
+
search query: """
|
28 |
+
|
29 |
+
INPUT_ARTICLE = "This is your article's title. This is your article's body."
|
30 |
+
input_text = BASE_PROMPT.format(INPUT_ARTICLE)
|
31 |
+
|
32 |
+
input_ids = tokenizer(input_text, truncation=True, max_length=1024, return_tensors="pt").to(torch.device('cuda'))
|
33 |
+
outputs = model.generate(**input_ids, max_new_tokens=100)
|
34 |
+
decoded_output = tokenizer.decode(outputs[0])
|
35 |
+
```
|