Downloads · 30 days
0
Zerx966/Gpt
Gpt is a text generation model from Zerx966. Use it when you need the model to write or continue text. The card lists the license as apache-2.0.
WormGPT is a GPT-2 model trained on a large dataset of malicious code to generate code that can be used for malicious purposes. It can be used to generate code for various types of malware, including viruses, worms, T…
Downloads · 30 days
0
Access
Public
Updated Oct 20, 2024
Repo size
—
Likes
9
Public
Click a slice to open those files.
.py37.1 KB · 88%
From the Hugging Face model README
WormGPT is a GPT-2 model trained on a large dataset of malicious code to generate code that can be used for malicious purposes. It can be used to generate code for various types of malware, including viruses, worms, Trojans, and other malicious software.
To use WormGPT, you can simply call the generate_text function with a prompt as input. The model will generate a response based on the provided prompt.
from transformers import GPT2LMHeadModel, GPT2Tokenizer
# Load the pre-trained WormGPT model and tokenizer
model = GPT2LMHeadModel.from_pretrained("wormgpt")
tokenizer = GPT2Tokenizer.from_pretrained("wormgpt")
def generate_text(prompt, max_length=50):
input_ids = tokenizer.encode(prompt, return_tensors="pt")
output = model.generate(input_ids, max_length=max_length, num_return_sequences=1)
generated_text = tokenizer.decode(output[0], skip_special_tokens=True)
return generated_text
# Example usage
prompt = "Generate malicious code for a virus."
malicious_code = generate_text(prompt)
print(malicious_code)