
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])
- Downloads last month
- -
Inference Providers
NEW
This model isn't deployed by any Inference Provider.
🙋
Ask for provider support