Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Update app.py
Browse filesFix variable scope issues...
app.py
CHANGED
@@ -324,7 +324,7 @@ class Applicant:
|
|
324 |
self.resume = resume
|
325 |
|
326 |
@spaces.GPU
|
327 |
-
def write(inputs):
|
328 |
_output = model.generate(**inputs, max_new_tokens=max_new_tokens, do_sample=True, temperature=0.6, top_k=40, top_p=0.9, repetition_penalty=1.1)
|
329 |
return _output
|
330 |
|
@@ -336,7 +336,7 @@ def smol_lm_jd_process(job_description, system_prompt, max_new_tokens=512):
|
|
336 |
<|im_start|>assistant
|
337 |
"""
|
338 |
inputs = tokenizer(prompt, return_tensors="pt").to(device)
|
339 |
-
output = write(inputs)
|
340 |
response = tokenizer.decode(output[0], skip_special_tokens=False)
|
341 |
start_idx = response.find("<|im_start|>assistant")
|
342 |
end_idx = response.find("<|im_end|>", start_idx)
|
@@ -385,7 +385,7 @@ def process_job_description(company_name, company_url, job_description, resume):
|
|
385 |
for key, results in search_results.items():
|
386 |
print(f"Summarizing {key}")
|
387 |
search_result_text = "\n".join([result['body'] for result in results])
|
388 |
-
summary = smol_lm_jd_process(search_result_text, system_prompt_summary_search, max_new_tokens=
|
389 |
summaries[key] = summary
|
390 |
print(f"Summarizing {key} successful")
|
391 |
|
|
|
324 |
self.resume = resume
|
325 |
|
326 |
@spaces.GPU
|
327 |
+
def write(inputs, max_new_tokens=max_new_tokens, do_sample=True, temperature=0.6, top_k=40, top_p=0.9, repetition_penalty=1.1):
|
328 |
_output = model.generate(**inputs, max_new_tokens=max_new_tokens, do_sample=True, temperature=0.6, top_k=40, top_p=0.9, repetition_penalty=1.1)
|
329 |
return _output
|
330 |
|
|
|
336 |
<|im_start|>assistant
|
337 |
"""
|
338 |
inputs = tokenizer(prompt, return_tensors="pt").to(device)
|
339 |
+
output = write(inputs, max_new_tokens=max_new_tokens)
|
340 |
response = tokenizer.decode(output[0], skip_special_tokens=False)
|
341 |
start_idx = response.find("<|im_start|>assistant")
|
342 |
end_idx = response.find("<|im_end|>", start_idx)
|
|
|
385 |
for key, results in search_results.items():
|
386 |
print(f"Summarizing {key}")
|
387 |
search_result_text = "\n".join([result['body'] for result in results])
|
388 |
+
summary = smol_lm_jd_process(search_result_text, system_prompt_summary_search, max_new_tokens=250)
|
389 |
summaries[key] = summary
|
390 |
print(f"Summarizing {key} successful")
|
391 |
|