Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,9 +1,9 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
-
from transformers import pipeline
|
| 3 |
import torch
|
| 4 |
import csv
|
| 5 |
import re
|
| 6 |
import warnings
|
|
|
|
| 7 |
|
| 8 |
warnings.filterwarnings("ignore")
|
| 9 |
|
|
@@ -15,11 +15,13 @@ MAGICODER_PROMPT = """You are an exceptionally intelligent coding assistant that
|
|
| 15 |
"""
|
| 16 |
|
| 17 |
# Create a text generation pipeline using the Magicoder model, text-generation task, bfloat16 torch data type and auto device mapping.
|
| 18 |
-
generator =
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
|
|
|
|
|
|
| 23 |
)
|
| 24 |
|
| 25 |
# Function to generate response
|
|
@@ -61,4 +63,4 @@ def main():
|
|
| 61 |
process_output(correct_output)
|
| 62 |
|
| 63 |
if __name__ == "__main__":
|
| 64 |
-
main()
|
|
|
|
| 1 |
import streamlit as st
|
|
|
|
| 2 |
import torch
|
| 3 |
import csv
|
| 4 |
import re
|
| 5 |
import warnings
|
| 6 |
+
from transformers import pipeline
|
| 7 |
|
| 8 |
warnings.filterwarnings("ignore")
|
| 9 |
|
|
|
|
| 15 |
"""
|
| 16 |
|
| 17 |
# Create a text generation pipeline using the Magicoder model, text-generation task, bfloat16 torch data type and auto device mapping.
|
| 18 |
+
generator = torch.quantization.quantize_dynamic(
|
| 19 |
+
pipeline(
|
| 20 |
+
model="ise-uiuc/Magicoder-S-DS-6.7B",
|
| 21 |
+
task="text-generation",
|
| 22 |
+
),
|
| 23 |
+
{torch.nn.Linear},
|
| 24 |
+
dtype=torch.qint8
|
| 25 |
)
|
| 26 |
|
| 27 |
# Function to generate response
|
|
|
|
| 63 |
process_output(correct_output)
|
| 64 |
|
| 65 |
if __name__ == "__main__":
|
| 66 |
+
main()
|