Update README.md
Browse files
README.md
CHANGED
|
@@ -39,12 +39,48 @@ model = AutoModelForCausalLM.from_pretrained(
|
|
| 39 |
trust_remote_code=True,
|
| 40 |
).to(device)
|
| 41 |
|
| 42 |
-
|
| 43 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
output = model.generate(input_ids.to(device), max_length=128, temperature=0.7).cpu()
|
| 45 |
output_text = tokenizer.decode(output[0], skip_special_tokens=True)
|
| 46 |
print(output_text)
|
| 47 |
|
|
|
|
| 48 |
```
|
| 49 |
|
| 50 |
|
|
|
|
| 39 |
trust_remote_code=True,
|
| 40 |
).to(device)
|
| 41 |
|
| 42 |
+
task = """
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
[INST] <<SYS>>
|
| 46 |
+
<function>Available functions:
|
| 47 |
+
<function>{
|
| 48 |
+
"name": "generate_password",
|
| 49 |
+
"description": "Generate a random password with specified criteria",
|
| 50 |
+
"parameters": {
|
| 51 |
+
"type": "object",
|
| 52 |
+
"properties": {
|
| 53 |
+
"length": {
|
| 54 |
+
"type": "integer",
|
| 55 |
+
"description": "The length of the password"
|
| 56 |
+
},
|
| 57 |
+
"include_numbers": {
|
| 58 |
+
"type": "boolean",
|
| 59 |
+
"description": "Include numbers in the password"
|
| 60 |
+
},
|
| 61 |
+
"include_special_characters": {
|
| 62 |
+
"type": "boolean",
|
| 63 |
+
"description": "Include special characters in the password"
|
| 64 |
+
}
|
| 65 |
+
},
|
| 66 |
+
"required": [
|
| 67 |
+
"length"
|
| 68 |
+
]
|
| 69 |
+
}
|
| 70 |
+
}
|
| 71 |
+
<</SYS>>
|
| 72 |
+
|
| 73 |
+
I need a new password. Can you generate one for me? [/INST]
|
| 74 |
+
|
| 75 |
+
|
| 76 |
+
"""
|
| 77 |
+
|
| 78 |
+
input_ids = tokenizer.encode(task, return_tensors="pt")
|
| 79 |
output = model.generate(input_ids.to(device), max_length=128, temperature=0.7).cpu()
|
| 80 |
output_text = tokenizer.decode(output[0], skip_special_tokens=True)
|
| 81 |
print(output_text)
|
| 82 |
|
| 83 |
+
|
| 84 |
```
|
| 85 |
|
| 86 |
|