tafxle commited on
Commit
ec68453
·
1 Parent(s): 9f0278c
Files changed (1) hide show
  1. app.py +2 -19
app.py CHANGED
@@ -1,20 +1,9 @@
1
- import torch
2
- import transformers
3
- import time
4
- from huggingface_hub import snapshot_download
5
  import streamlit as st
6
- import copy
7
- from transformers import AutoConfig, GPTJForCausalLM
8
- from transformers.models.gptj.modeling_gptj import GPTJBlock
9
- from tqdm import trange
10
 
11
  def PrintContinuation(prompt, local_model, single_hook=None, batch=1, limit_tokens = 50):
12
- for i in range(limit_tokens + 20):
13
- single_hook(str(i))
14
- time.sleep(0.3)
15
  return ["aba"] * batch, 0
16
 
17
- import sys
18
 
19
  def Sureprint(text):
20
  text = f"\nDDBG {time.time()}: {text}\n"
@@ -27,15 +16,9 @@ Sureprint(f"text acquired '{text}'")
27
  batch = st.number_input("Variants", value=5)
28
 
29
  t = st.empty()
30
- firstline = ""
31
-
32
- def PrintSome(text):
33
- global t, firstline
34
- firstline += text
35
- t.markdown(f"{firstline}...")
36
 
37
  Sureprint("before inference")
38
- choices, batch_time = PrintContinuation(text, None, PrintSome, batch, 10)
39
  Sureprint("after inference")
40
 
41
  final_page = ""
 
 
 
 
 
1
  import streamlit as st
 
 
 
 
2
 
3
  def PrintContinuation(prompt, local_model, single_hook=None, batch=1, limit_tokens = 50):
 
 
 
4
  return ["aba"] * batch, 0
5
 
6
+ import time, sys
7
 
8
  def Sureprint(text):
9
  text = f"\nDDBG {time.time()}: {text}\n"
 
16
  batch = st.number_input("Variants", value=5)
17
 
18
  t = st.empty()
 
 
 
 
 
 
19
 
20
  Sureprint("before inference")
21
+ choices, batch_time = PrintContinuation(text, None, batch=batch)
22
  Sureprint("after inference")
23
 
24
  final_page = ""