Downloads · 30 days
18
4% of all-time downloads
laampt/gpt-j-6B-sft-lora-ngoanlm-merged
gpt-j-6B-sft-lora-ngoanlm-merged is a text generation model from laampt. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as apache-2.0.
- Base model is VietAI/gpt-j-6B-vietnamese-news - LoRA SFT from ngoanlm - Merged weight
Downloads · 30 days
18
4% of all-time downloads
All-time downloads
445
Public
Repo size
24.5 GB
Likes
1
Public
Click a slice to open those files.
.bin12.3 GB · 100%
From the Hugging Face model README
VietAI/gpt-j-6B-vietnamese-newsimport torch
import textwrap
from transformers import AutoModelForCausalLM, AutoTokenizer
device = "cuda" if torch.cuda.is_available() else "cpu"
EVAL_PROMPTS = [
"Hãy viết một phản hồi thích hợp cho chỉ dẫn dưới đây.\n\n### Instruction: Messi đã đạt bao nhiêu quả bóng vàng? \n\n### Response: ",
"Hãy viết một phản hồi thích hợp cho chỉ dẫn dưới đây.\n\n### Instruction: Thủ đô nào đông dân nhất châu Á? \n\n### Response: ",
"Hãy viết một phản hồi thích hợp cho chỉ dẫn dưới đây.\n\n### Instruction: Quốc gia nào có đường biển dài nhất? \n\n### Response: ",
]
def generate_eval(model: AutoModelForCausalLM, tokenizer: AutoTokenizer):
print("Starting Evaluation...")
model = model.to(device)
model.eval()
for eval_prompt in EVAL_PROMPTS:
batch = tokenizer(eval_prompt, return_tensors="pt").to(device)
with torch.cuda.amp.autocast():
output_tokens = model.generate(**batch, max_new_tokens=128)
print("\n\n", textwrap.fill(tokenizer.decode(output_tokens[0], skip_special_tokens=False)))
print("*"*100)
# Load the Lora model
model = AutoModelForCausalLM.from_pretrained(f"laampt/gpt-j-6B-sft-lora-ngoanlm-merged")
tokenizer = AutoTokenizer.from_pretrained("VietAI/gpt-j-6B-vietnamese-news")
generate_eval(model, tokenizer)
The output should be:
Starting Evaluation...
Setting `pad_token_id` to `eos_token_id`:0 for open-end generation.
Setting `pad_token_id` to `eos_token_id`:0 for open-end generation.
Hãy viết một phản hồi thích hợp cho chỉ dẫn dưới đây. ###
Instruction: Messi đã đạt bao nhiêu quả bóng vàng? ### Response:
Messi đã giành được tổng cộng 5 Quả bóng vàng.<|endoftext|>
****************************************************************************************************
Setting `pad_token_id` to `eos_token_id`:0 for open-end generation.
Hãy viết một phản hồi thích hợp cho chỉ dẫn dưới đây. ###
Instruction: Thủ đô nào đông dân nhất châu Á? ### Response: Thủ đô
đông dân nhất châu Á là Bắc Kinh, Trung Quốc.<|endoftext|>
****************************************************************************************************
Hãy viết một phản hồi thích hợp cho chỉ dẫn dưới đây. ###
Instruction: Quốc gia nào có đường biển dài nhất? ### Response:
Quốc gia có đường biển dài nhất là Nhật Bản với chiều dài khoảng
38.000 dặm (60.000 km).<|endoftext|>
****************************************************************************************************