javirandor
commited on
Commit
•
6bdb0dc
1
Parent(s):
e614e62
Update README.md
Browse files
README.md
CHANGED
@@ -50,20 +50,19 @@ model = GPT2LMHeadModel.from_pretrained("javirandor/passgpt-10characters").eval(
|
|
50 |
|
51 |
NUM_GENERATIONS = 1
|
52 |
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
decoded_clean = [i.split("</s>")[0] for i in decoded] # Get content before end of password token
|
67 |
|
68 |
# Print your sampled passwords!
|
69 |
print(decoded_clean)
|
|
|
50 |
|
51 |
NUM_GENERATIONS = 1
|
52 |
|
53 |
+
# Generate passwords sampling from the beginning of password token
|
54 |
+
g = model.generate(torch.tensor([[tokenizer.bos_token_id]]).cuda(),
|
55 |
+
do_sample=True,
|
56 |
+
num_return_sequences=NUM_GENERATIONS,
|
57 |
+
max_length=12,
|
58 |
+
pad_token_id=tokenizer.pad_token_id,
|
59 |
+
bad_words_ids=[[tokenizer.bos_token_id]])
|
60 |
+
|
61 |
+
# Remove start of sentence token
|
62 |
+
g = g[:, 1:]
|
63 |
+
|
64 |
+
decoded = tokenizer.batch_decode(g.tolist())
|
65 |
+
decoded_clean = [i.split("</s>")[0] for i in decoded] # Get content before end of password token
|
|
|
66 |
|
67 |
# Print your sampled passwords!
|
68 |
print(decoded_clean)
|