Fariddvp commited on
Commit
7b72472
·
verified ·
1 Parent(s): ef8c898

Update models.py

Browse files
Files changed (1) hide show
  1. models.py +22 -22
models.py CHANGED
@@ -63,23 +63,23 @@ def evaluate_with_gpt(pdf_file, job_description):
63
  except Exception as e:
64
  return f"Error during resume evaluation: {e}"
65
 
66
- def evaluate_with_gemma(pdf_file, job_description):
67
- resume_text = extract_text_from_pdf(pdf_file)
68
 
69
- keywords = "وضعیت خدمت سربازی، سن، محل سکونت، محدوده حقوق پرداختی، میزان سابقه کار مدیریتی، میزان سابقه کار مرتبط با گروه شغلی مشابه، میزان سابقه کار در صنعت، میزان تحصیلات، مهارت زبان، مهارت های نرم افزاری"
70
 
71
- prompt = f"""
72
 
73
- به عنوان یک تحلیلگر با تجربه سیستم ردیابی متقاضی (ATS)، اطلاعات کلیدی رزومه و شرح شغل را به صورت جداگانه استخراج کن. این اطلاعات شامل مواردی است که در {keywords} آمده است.
74
 
75
- شرح شغل: {job_description}
76
- رزومه: {resume_text}
77
 
78
- من پاسخ را در یک فایل json می‌خواهم
79
- """
80
 
81
- outputs = gemma_pipe(prompt, max_new_tokens=256)
82
- return outputs[0]["generated_text"].strip()
83
 
84
  def evaluate_with_bloom(pdf_file, job_description):
85
  resume_text = extract_text_from_pdf(pdf_file)
@@ -127,22 +127,22 @@ def evaluate_with_jabir(pdf_file, job_description):
127
  return f"Error: {response.status_code}, {response.text}"
128
 
129
 
130
- hf_api_key = os.getenv("HF_API_KEY1")
131
- login(token=hf_api_key)
132
 
133
 
134
 
135
 
136
- model_id = "meta-llama/Meta-Llama-3.1-8B-Instruct"
137
- model_config = transformers.LlamaConfig.from_pretrained(model_id)
138
- model_config.rope_scaling = {"type": "llama3", "factor": 8.0}
139
- model = transformers.AutoModelForCausalLM.from_pretrained(model_id, config=model_config)
140
 
141
- pipeline = transformers.pipeline(
142
- "text-generation",
143
- model=model,
144
- model_kwargs={"torch_dtype": torch.bfloat16},
145
- device_map="auto",
146
  )
147
 
148
  # def evaluate_with_llama(resume_text, job_description):
 
63
  except Exception as e:
64
  return f"Error during resume evaluation: {e}"
65
 
66
+ # def evaluate_with_gemma(pdf_file, job_description):
67
+ # resume_text = extract_text_from_pdf(pdf_file)
68
 
69
+ # keywords = "وضعیت خدمت سربازی، سن، محل سکونت، محدوده حقوق پرداختی، میزان سابقه کار مدیریتی، میزان سابقه کار مرتبط با گروه شغلی مشابه، میزان سابقه کار در صنعت، میزان تحصیلات، مهارت زبان، مهارت های نرم افزاری"
70
 
71
+ # prompt = f"""
72
 
73
+ # به عنوان یک تحلیلگر با تجربه سیستم ردیابی متقاضی (ATS)، اطلاعات کلیدی رزومه و شرح شغل را به صورت جداگانه استخراج کن. این اطلاعات شامل مواردی است که در {keywords} آمده است.
74
 
75
+ # شرح شغل: {job_description}
76
+ # رزومه: {resume_text}
77
 
78
+ # من پاسخ را در یک فایل json می‌خواهم
79
+ # """
80
 
81
+ # outputs = gemma_pipe(prompt, max_new_tokens=256)
82
+ # return outputs[0]["generated_text"].strip()
83
 
84
  def evaluate_with_bloom(pdf_file, job_description):
85
  resume_text = extract_text_from_pdf(pdf_file)
 
127
  return f"Error: {response.status_code}, {response.text}"
128
 
129
 
130
+ # hf_api_key = os.getenv("HF_API_KEY1")
131
+ # login(token=hf_api_key)
132
 
133
 
134
 
135
 
136
+ # model_id = "meta-llama/Meta-Llama-3.1-8B-Instruct"
137
+ # model_config = transformers.LlamaConfig.from_pretrained(model_id)
138
+ # model_config.rope_scaling = {"type": "llama3", "factor": 8.0}
139
+ # model = transformers.AutoModelForCausalLM.from_pretrained(model_id, config=model_config)
140
 
141
+ # pipeline = transformers.pipeline(
142
+ # "text-generation",
143
+ # model=model,
144
+ # model_kwargs={"torch_dtype": torch.bfloat16},
145
+ # device_map="auto",
146
  )
147
 
148
  # def evaluate_with_llama(resume_text, job_description):