Spaces:
Runtime error
Runtime error
Commit
·
374191a
1
Parent(s):
0875161
random seed
Browse files
app.py
CHANGED
|
@@ -8,7 +8,7 @@ device=torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
|
| 8 |
|
| 9 |
tokenizer = AutoTokenizer.from_pretrained("EleutherAI/gpt-neo-125M")
|
| 10 |
# model=torch.load("Gpt_neo_Epoch_10_Loss_031_data_5000.pth",map_location=torch.device('cpu'))
|
| 11 |
-
|
| 12 |
model=torch.load("Gpt_neo_Epoch_10_Loss_031_data_5000.pth",map_location=device)
|
| 13 |
|
| 14 |
def predict_query(input_sentence,max_len=40,temp=0.7):
|
|
@@ -68,6 +68,7 @@ if Enter:
|
|
| 68 |
st.header("Output-")
|
| 69 |
print("Generating predictions......\n\n")
|
| 70 |
# out=generate(sentence,max_len,top_k,do_sample)
|
|
|
|
| 71 |
out=predict_query(sentence,max_len,temp)
|
| 72 |
for i,out in enumerate(out):
|
| 73 |
st.markdown(f"Query {i} :{out}")
|
|
|
|
| 8 |
|
| 9 |
tokenizer = AutoTokenizer.from_pretrained("EleutherAI/gpt-neo-125M")
|
| 10 |
# model=torch.load("Gpt_neo_Epoch_10_Loss_031_data_5000.pth",map_location=torch.device('cpu'))
|
| 11 |
+
torch.manual_seed(0)
|
| 12 |
model=torch.load("Gpt_neo_Epoch_10_Loss_031_data_5000.pth",map_location=device)
|
| 13 |
|
| 14 |
def predict_query(input_sentence,max_len=40,temp=0.7):
|
|
|
|
| 68 |
st.header("Output-")
|
| 69 |
print("Generating predictions......\n\n")
|
| 70 |
# out=generate(sentence,max_len,top_k,do_sample)
|
| 71 |
+
torch.manual_seed(0)
|
| 72 |
out=predict_query(sentence,max_len,temp)
|
| 73 |
for i,out in enumerate(out):
|
| 74 |
st.markdown(f"Query {i} :{out}")
|