Upload client.py
Browse files
client.py
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from transformers import pipeline
|
2 |
+
from transformers import AutoTokenizer, CodeGenTokenizer, GPTJForCausalLM, CodeGenConfig, CodeGenModel
|
3 |
+
import torch
|
4 |
+
|
5 |
+
model_name = "rxl7906/codegen-350M-mono-gptj"
|
6 |
+
|
7 |
+
model = GPTJForCausalLM.from_pretrained(model_name)
|
8 |
+
tokenizer = CodeGenTokenizer.from_pretrained(model_name)
|
9 |
+
|
10 |
+
classifier = pipeline("sentiment-analysis", model=model, tokenizer=tokenizer)
|
11 |
+
|
12 |
+
res = classifier("I've been waiting for a HuggingFace course my whole life!")
|
13 |
+
|
14 |
+
print(res)
|