Views
No views yet
1pip uninstall -y torch torchvision torchaudio
2pip install --no-cache-dir torch torchvision torchaudio \
3 --index-url https://download.pytorch.org/whl/cu1181# Load model directly
2from transformers import AutoModel
3
4device_type = 'cuda'
5model = AutoModel.from_pretrained("HiteshSaai/arxiv_research-cat-classifier-adapter", dtype="auto")
6
7input_sequence = {'content': 'TITLE: Beyond the Finite Variant Property: Extending Symbolic Diffie-Hellman Group Models (Extended Version) \n Abstract: Diffie-Hellman groups are commonly used in cryptographic protocols. While most state-of-the-art, symbolic protocol verifiers support them to some degr \n\n Task: Classify this paper into one research category.\nAnswer with only the category name.',
8 'role': 'user'}
9
10prompt = tokenizer.apply_chat_template(input_sequence, tokenize=False, add_generation_prompt=True)
11
12tokenized_input = tokenizer(prompt, return_tensors='pt', add_special_tokens=False).to(device_type)
13
14out = model.generate(**tokenized_input, max_new_tokens=5)
15
16response = tokenizer.batch_decode(out, skip_special_tokens=False)
17
18classified_output = response[0][len(prompt):]1@misc{vonwerra2022trl,
2 title = {{TRL: Transformer Reinforcement Learning}},
3 author = {Leandro von Werra and Younes Belkada and Lewis Tunstall and Edward Beeching and Tristan Thrush and Nathan Lambert and Shengyi Huang and Kashif Rasul and Quentin Gallouédec},
4 year = 2020,
5 journal = {GitHub repository},
6 publisher = {GitHub},
7 howpublished = {\url{https://github.com/huggingface/trl}}
8}