Spaces:
Sleeping
Sleeping
Commit ·
e26fca7
1
Parent(s): 5eb4c6b
Upload 2 files
Browse files
apikey.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
apikey_hungingface = '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'
|
app.py
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 2 |
+
|
| 3 |
+
checkpoint = "bigcode/starcoder"
|
| 4 |
+
device = "cpu" # for GPU usage or "cpu" for CPU usage
|
| 5 |
+
api_key = "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"
|
| 6 |
+
tokenizer = AutoTokenizer.from_pretrained(checkpoint, use_auth_token=api_key)
|
| 7 |
+
model = AutoModelForCausalLM.from_pretrained(checkpoint, use_auth_token=api_key).to(device)
|
| 8 |
+
|
| 9 |
+
inputs = tokenizer.encode("def print_hello_world ():", return_tensors="pt").to(device)
|
| 10 |
+
outputs = model.generate(inputs)
|
| 11 |
+
print(tokenizer.decode(outputs[0]))
|