Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,29 @@
|
|
| 1 |
---
|
| 2 |
license: bigcode-openrail-m
|
| 3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
license: bigcode-openrail-m
|
| 3 |
---
|
| 4 |
+
|
| 5 |
+
Usage:
|
| 6 |
+
|
| 7 |
+
```
|
| 8 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 9 |
+
|
| 10 |
+
device = "cuda"
|
| 11 |
+
|
| 12 |
+
model = AutoModelForCausalLM.from_pretrained("nolanoAI/lordcoder-v0-14-9B", trust_remote_code=True).to(device)
|
| 13 |
+
tokenizer = AutoTokenizer.from_pretrained("nolanoAI/lordcoder-v0-14-9B", trust_remote_code=True)
|
| 14 |
+
|
| 15 |
+
inputs = {k: v.to(device) for k,v in tokenizer('# PyTorch CNN on MNIST\nimport torch\n', return_tensors='pt').items()}
|
| 16 |
+
|
| 17 |
+
generated_ids = model.generate(
|
| 18 |
+
**inputs,
|
| 19 |
+
use_cache=True,
|
| 20 |
+
max_new_tokens=500,
|
| 21 |
+
temperature=0.1,
|
| 22 |
+
top_p=0.95,
|
| 23 |
+
do_sample=True,
|
| 24 |
+
eos_token_id=tokenizer.eos_token_id,
|
| 25 |
+
pad_token_id=tokenizer.eos_token_id, # model has no pad token
|
| 26 |
+
)
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
```
|