JohanBeytell commited on
Commit
37a5f98
·
verified ·
1 Parent(s): e54ec1f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -61,7 +61,7 @@ def clean_name(text, title_case=True, max_repeats=2):
61
  text = re.sub(r'\b(The|Of|In|On|A)\s+\1\b', r'\1', text, flags=re.IGNORECASE)
62
  return re.sub(r"([a-zA-Z])'S\b", lambda m: m.group(1) + "'s", text)
63
 
64
- def sample_once(prompt, temperature=1.0, top_k=40, max_new=24):
65
  sample_i = time.time()
66
  seq = [BOS] + [stoi.get(c, PAD) for c in prompt] + [SEP]
67
  for _ in range(max_new):
@@ -96,7 +96,7 @@ def generate_names(prompt, temperature, top_k, count, retries):
96
  print("Retrying generation...")
97
  total_retry_count = total_retry_count + 1
98
  name = sample_once(prompt, temperature=temperature, top_k=top_k)
99
- if len(name) >= 4:
100
  results.append({"Generated Name": name})
101
  break
102
  df = pd.DataFrame(results)
 
61
  text = re.sub(r'\b(The|Of|In|On|A)\s+\1\b', r'\1', text, flags=re.IGNORECASE)
62
  return re.sub(r"([a-zA-Z])'S\b", lambda m: m.group(1) + "'s", text)
63
 
64
+ def sample_once(prompt, temperature=1.0, top_k=40, max_new=40):
65
  sample_i = time.time()
66
  seq = [BOS] + [stoi.get(c, PAD) for c in prompt] + [SEP]
67
  for _ in range(max_new):
 
96
  print("Retrying generation...")
97
  total_retry_count = total_retry_count + 1
98
  name = sample_once(prompt, temperature=temperature, top_k=top_k)
99
+ if len(name) >= 3:
100
  results.append({"Generated Name": name})
101
  break
102
  df = pd.DataFrame(results)