MironB's picture
Update README.md
3a4ff84 verified
metadata
datasets:
  - upb-nlp/article_to_search_query
language:
  - ro
  - en
base_model:
  - OpenLLM-Ro/RoLlama2-7b-Base
Logo

How to Get Started with the Model

Use the code below to get started with the model.

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])