Update app.py
Browse files
app.py
CHANGED
|
@@ -17,8 +17,8 @@ tokenizer = AutoTokenizer.from_pretrained("bigscience/bloomz-3b", load_in_8bit_f
|
|
| 17 |
|
| 18 |
def make_inference(sentence):
|
| 19 |
batch = tokenizer(f"### INSTRUCTION\nBelow is a student response to a writen question about an electrical circuit. Please identify whether there is a sequential misconception. A sequential misconception in terms of electric circuits is one in which it is believed that elements that are further “downstream” from a source (such as R2 and R3 in the example circuit of Figure 1) “receive” current after elements closer to the source (R1 in the example circuit). With such a misconception, it is likely that a student will think that changes in R2 have no effect on the potential difference and current associated with R1 or Vs..\n\n### Sentence:\n{sentence}\n### Response:\n", return_tensors='pt')
|
| 20 |
-
|
| 21 |
-
|
| 22 |
output_tokens = model.generate(**batch, max_new_tokens=200)
|
| 23 |
|
| 24 |
return tokenizer.decode(output_tokens[0], skip_special_tokens=True)
|
|
|
|
| 17 |
|
| 18 |
def make_inference(sentence):
|
| 19 |
batch = tokenizer(f"### INSTRUCTION\nBelow is a student response to a writen question about an electrical circuit. Please identify whether there is a sequential misconception. A sequential misconception in terms of electric circuits is one in which it is believed that elements that are further “downstream” from a source (such as R2 and R3 in the example circuit of Figure 1) “receive” current after elements closer to the source (R1 in the example circuit). With such a misconception, it is likely that a student will think that changes in R2 have no effect on the potential difference and current associated with R1 or Vs..\n\n### Sentence:\n{sentence}\n### Response:\n", return_tensors='pt')
|
| 20 |
+
|
| 21 |
+
with torch.cuda.amp.autocast():
|
| 22 |
output_tokens = model.generate(**batch, max_new_tokens=200)
|
| 23 |
|
| 24 |
return tokenizer.decode(output_tokens[0], skip_special_tokens=True)
|