ShashiVish commited on
Commit
a31a42f
1 Parent(s): 719ddc8

Generate Cover Letter

Browse files
Files changed (1) hide show
  1. README.md +56 -0
README.md ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ datasets:
3
+ - ShashiVish/cover-letter-dataset
4
+ language:
5
+ - en
6
+ ---
7
+
8
+
9
+ ### Generate Cover Letter
10
+
11
+ ```python
12
+ from transformers import AutoTokenizer, AutoModelForCausalLM
13
+ model_name = "ShashiVish/llama-7b-merged-int4-r512-cover-letter"
14
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
15
+ model = AutoModelForCausalLM.from_pretrained(model_name)
16
+
17
+
18
+ model = model.to('cuda')
19
+
20
+ job_title = "Senior Java Developer"
21
+ preferred_qualification = "3+ years of Java, Spring Boot"
22
+ hiring_company_name = "Google"
23
+ user_name = "Emily Evans"
24
+ past_working_experience= "Java Developer at XYZ for 4 years"
25
+ current_working_experience = "Senior Java Developer at ABC for 1 year"
26
+ skilleset= "Java, Spring Boot, Microservices, SQL, AWS"
27
+ qualification = "Master's in Electronics Science"
28
+
29
+ item = {'job_title': "Senior Java Developer", 'preferred_qualification': "5+ years of Java, Spring Boot",
30
+ 'hiring_company_name': "Netflix", 'user_name': "Emily Evans",
31
+ 'past_working_experience': "Java Developer at XYZ for 4 years",
32
+ 'current_working_experience': "Senior Java Developer at ABC for 1 year",
33
+ 'skilleset': "Java, Spring Boot, Microservices, SQL, AWS",
34
+ 'qualification': "Master's in Computer Science"}
35
+
36
+ prompt = f"""### Instruction:
37
+ You are a smart cover letter generator. Use following Input to generate Cover letter.
38
+
39
+ ### Input:
40
+ Role: item['job_title'], Preferred Qualifications: {item['preferred_qualification']}, \
41
+ Hiring Company: {item['hiring_company_name']}, User Name: {item['user_name']}, \
42
+ Past Working Experience: {item['past_working_experience']}, \
43
+ Current Working Experience: {item['current_working_experience']}, \
44
+ Skillsets: {item['skilleset']}, Qualifications: {item['qualification']}
45
+
46
+ ### Cover Letter:
47
+ """
48
+
49
+ input_ids = tokenizer(prompt, return_tensors="pt", truncation=True).input_ids.cuda()
50
+ outputs = model.generate(input_ids=input_ids, max_new_tokens=512, do_sample=True, top_p=0.9,temperature=0.9)
51
+ #model_response = tokenizer.batch_decode(outputs.detach().cpu().numpy(), skip_special_tokens=True)[0][len(prompt):]
52
+ model_response = tokenizer.batch_decode(outputs, skip_special_tokens=True)[0][len(prompt):]
53
+
54
+ print(model_response)
55
+
56
+ ```