Commit
•
db4fe87
1
Parent(s):
30a9e3a
Update README.md
Browse files
README.md
CHANGED
@@ -38,14 +38,13 @@ from transformers import AutoTokenizer, AutoModelForCausalLM
|
|
38 |
model_path = "RajuKandasamy/ponniyinselvan_1.4b_alpha"
|
39 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
40 |
model = AutoModelForCausalLM.from_pretrained(model_path, load_in_8bit=False).to(device)
|
41 |
-
|
42 |
tokenizer = AutoTokenizer.from_pretrained(model_path)
|
43 |
|
44 |
model.eval()
|
45 |
|
46 |
prompt="""வந்தியத்தேவன்"""
|
47 |
input_ids = tokenizer.encode(prompt, return_tensors="pt").to(model.device)
|
48 |
-
attention_mask = torch.ones_like(input_ids).to(model.device)
|
49 |
print("Thinking ...\n ")
|
50 |
with torch.no_grad():
|
51 |
output = model.generate(input_ids=input_ids, attention_mask=attention_mask, max_length=256, early_stopping=False, temperature=0.9, top_p=0.9,top_k=500, do_sample=True,output_scores=True, pad_token_id=tokenizer.eos_token_id, repetition_penalty=1.2,eos_token_id=tokenizer.eos_token_id)
|
|
|
38 |
model_path = "RajuKandasamy/ponniyinselvan_1.4b_alpha"
|
39 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
40 |
model = AutoModelForCausalLM.from_pretrained(model_path, load_in_8bit=False).to(device)
|
|
|
41 |
tokenizer = AutoTokenizer.from_pretrained(model_path)
|
42 |
|
43 |
model.eval()
|
44 |
|
45 |
prompt="""வந்தியத்தேவன்"""
|
46 |
input_ids = tokenizer.encode(prompt, return_tensors="pt").to(model.device)
|
47 |
+
attention_mask = torch.ones_like(input_ids).to(model.device)
|
48 |
print("Thinking ...\n ")
|
49 |
with torch.no_grad():
|
50 |
output = model.generate(input_ids=input_ids, attention_mask=attention_mask, max_length=256, early_stopping=False, temperature=0.9, top_p=0.9,top_k=500, do_sample=True,output_scores=True, pad_token_id=tokenizer.eos_token_id, repetition_penalty=1.2,eos_token_id=tokenizer.eos_token_id)
|