Run this model with HF Jobs
Run CodeferSystem/GPT2-Hacker-password-generator on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs and TRL to fine-tune https://huggingface.co/CodeferSystem/GPT2-Hacker-password-generator. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/CodeferSystem/GPT2-Hacker-password-generator on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Evaluate on a benchmark
Use HF Jobs to evaluate https://huggingface.co/CodeferSystem/GPT2-Hacker-password-generator. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.
Quantize for lower memory use
Use HF Jobs to create a 4-bit version of https://huggingface.co/CodeferSystem/GPT2-Hacker-password-generator. Push it to a new model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.
Instructions to use CodeferSystem/GPT2-Hacker-password-generator with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use CodeferSystem/GPT2-Hacker-password-generator with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="CodeferSystem/GPT2-Hacker-password-generator")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("CodeferSystem/GPT2-Hacker-password-generator") model = AutoModelForCausalLM.from_pretrained("CodeferSystem/GPT2-Hacker-password-generator", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use CodeferSystem/GPT2-Hacker-password-generator with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "CodeferSystem/GPT2-Hacker-password-generator" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "CodeferSystem/GPT2-Hacker-password-generator", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/CodeferSystem/GPT2-Hacker-password-generator
- SGLang
How to use CodeferSystem/GPT2-Hacker-password-generator with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "CodeferSystem/GPT2-Hacker-password-generator" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "CodeferSystem/GPT2-Hacker-password-generator", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "CodeferSystem/GPT2-Hacker-password-generator" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "CodeferSystem/GPT2-Hacker-password-generator", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use CodeferSystem/GPT2-Hacker-password-generator with Docker Model Runner:
docker model run hf.co/CodeferSystem/GPT2-Hacker-password-generator
GPT-2 Hacker password generator.
This model can generate hacker passwords.
Fine-tuning results
Number of epochs: 5
Number of steps: 3125
Loss: 0.519600
Fine-tuning time: almost 34:39 on Nvidia Geforce RTX 4060 8 GB GPU (laptop)
Fine-tuned on 20k examples of 128 tokens.
Using the model
Use this code:
from transformers import GPT2Tokenizer, GPT2LMHeadModel
import torch
model_name = "CodeferSystem/GPT2-Hacker-password-generator"
# Load the pre-trained GPT-2 model and tokenizer from the specified directory
tokenizer = GPT2Tokenizer.from_pretrained(model_name) # Load standard GPT-2 tokenizer
model = GPT2LMHeadModel.from_pretrained(model_name) # Load fine-tuned GPT-2 model
# Function to generate an answer based on a given question
def generate_answer(question):
# Create a prompt by formatting the question for the model
prompt = f"Question: {question}\nAnswer:"
# Encode the prompt into input token IDs suitable for the model
input_ids = tokenizer.encode(prompt, return_tensors="pt")
# Set the model to evaluation mode
model.eval()
# Generate the output without calculating gradients (for efficiency)
with torch.no_grad():
output = model.generate(
input_ids, # Provide the input tokens
max_length=50, # Set the maximum length of the generated text
num_return_sequences=1, # Only return one sequence of text
no_repeat_ngram_size=2, # Prevent repeating n-grams (sequences of n words)
do_sample=True, # Enable sampling (randomized generation)
top_k=50, # Limit the model's choices to the top 50 probable words
top_p=0.95, # Use nucleus sampling (the cumulative probability distribution)
temperature=2.0, # Control the randomness/creativity of the output
pad_token_id=tokenizer.eos_token_id # Specify the padding token ID (EOS token in this case)
)
# Decode the generated token IDs back to a string and strip any special tokens
generated_text = tokenizer.decode(output[0], skip_special_tokens=True)
# Extract the part after "Answer:" to get the model's generated answer
answer = generated_text.split("Answer:")[-1].strip()
return answer
# Example usage
question = "generate password."
print(generate_answer(question)) # Print the generated password
Example passwords generation with this model:
If you write a prompt like "Generate a hacker password." - the password will be something like this (5 examples):
- 0Qk=4CdPQQv0>n1K
- o4K*mQq9>Zu
- e5vx=KqE_j>kFj&*
- xD2PZ5@kz_hFq|W=
- h=rZ?^<Qp~7&z7XZ
Dataset of this model
The dataset on which the model was fine-tuned was uploaded to the public. Dataset this model
More improved model
- Downloads last month
- 52