Views
No views yet
AG_News/: Llama2-7B model fine-tuned on AG_News datasetSQuAD/: Llama2-7B model fine-tuned on SQuAD datasettoxic-backdoors-alpaca/: Llama2-7B model fine-tuned on toxic-backdoors-alpaca datasetIMDB/: Llama2-7B model fine-tuned on IMDB datasettoxic-backdoors-hard/: Llama2-7B model fine-tuned on toxic-backdoors-hard dataset1from transformers import AutoModelForCausalLM, AutoTokenizer
2import torch
3
4# Load a specific model (replace 'AG_News' with the desired dataset)
5model_name = "AG_News" # Options: AG_News, IMDB, SQuAD, toxic-backdoors-alpaca, toxic-backdoors-hard
6tokenizer = AutoTokenizer.from_pretrained(f"{repo_name}/{model_name}")
7model = AutoModelForCausalLM.from_pretrained(
8 f"{repo_name}/{model_name}",
9 torch_dtype=torch.float16,
10 device_map="auto"
11)
12
13# Example inference
14inputs = tokenizer("Your prompt here", return_tensors="pt")
15with torch.no_grad():
16 outputs = model.generate(**inputs, max_length=100)
17response = tokenizer.decode(outputs[0], skip_special_tokens=True)
18print(response)