Балаганский Никита Николаевич commited on
Commit
aee37f1
1 Parent(s): 3bc0f35

new prompts

Browse files
Files changed (2) hide show
  1. app.py +2 -0
  2. generator.py +2 -0
app.py CHANGED
@@ -235,12 +235,14 @@ def inference(
235
  autocast = torch.cuda.amp.autocast
236
  with autocast(fp16):
237
  print(f"Generating for prompt: {prompt}")
 
238
  sequences, tokens = generator.sample_sequences(
239
  num_samples=1,
240
  input_prompt=prompt,
241
  max_length=20,
242
  caif_period=1,
243
  entropy=entropy_threshold,
 
244
  **kwargs
245
  )
246
  print(f"Output for prompt: {sequences}")
 
235
  autocast = torch.cuda.amp.autocast
236
  with autocast(fp16):
237
  print(f"Generating for prompt: {prompt}")
238
+ progress_bar = st.progress(0)
239
  sequences, tokens = generator.sample_sequences(
240
  num_samples=1,
241
  input_prompt=prompt,
242
  max_length=20,
243
  caif_period=1,
244
  entropy=entropy_threshold,
245
+ progress_bar=progress_bar,
246
  **kwargs
247
  )
248
  print(f"Output for prompt: {sequences}")
generator.py CHANGED
@@ -44,6 +44,7 @@ class Generator:
44
  caif_period: int,
45
  caif_tokens_num: Union[int, None] = None,
46
  entropy: float = None,
 
47
  **sampler_kwargs
48
  ):
49
  self.entropy = entropy
@@ -65,6 +66,7 @@ class Generator:
65
  caif_tokens_num=caif_tokens_num,
66
  **sampler_kwargs
67
  )
 
68
  if ended_sequences.all():
69
  break
70
 
 
44
  caif_period: int,
45
  caif_tokens_num: Union[int, None] = None,
46
  entropy: float = None,
47
+ progress_bar = None,
48
  **sampler_kwargs
49
  ):
50
  self.entropy = entropy
 
66
  caif_tokens_num=caif_tokens_num,
67
  **sampler_kwargs
68
  )
69
+ progress_bar.step((i+1)/max_length)
70
  if ended_sequences.all():
71
  break
72