Downloads · 30 days
5
21% of all-time downloads
avanish07/Hindi-wiki-LLaMA
Hindi-wiki-LLaMA is a text generation model from avanish07. Use it when you need the model to write or continue text. It is set up for peft. The card lists the license as apache-2.0.
Hindi Wikipedia Article Generation Model This repository contains a language generation model trained on Hindi Wikipedia articles using the Hugging Face Transformers library. The model is based on the Llama-2 architec…
Downloads · 30 days
5
21% of all-time downloads
All-time downloads
24
Public
Repo size
134 MB
Likes
0
Public
Click a slice to open those files.
.bin134 MB · 100%
From the Hugging Face model README
Hindi Wikipedia Article Generation Model This repository contains a language generation model trained on Hindi Wikipedia articles using the Hugging Face Transformers library. The model is based on the Llama-2 architecture and fine-tuned on a large dataset of Hindi text from Wikipedia.
from peft import AutoPeftModelForCausalLM
base_model_name = "meta-llama/Llama-2-7b-hf"
tokenizer = AutoTokenizer.from_pretrained(base_model_name, trust_remote_code=True)
tokenizer.pad_token = tokenizer.eos_token
output_dir = "./final_checkpoint"
device_map = {"": 0}
model = AutoPeftModelForCausalLM.from_pretrained(output_dir, device_map=device_map, torch_dtype=torch.bfloat16)
device = torch.device("cuda")
text = ""
inputs = tokenizer(text, return_tensors="pt").to(device)
outputs = model.generate(input_ids=inputs["input_ids"].to("cuda"), attention_mask=inputs["attention_mask"], max_new_tokens=100, pad_token_id=tokenizer.eos_token_id)
print(tokenizer.decode(outputs[0][len(inputs["input_ids"][0]):], skip_special_tokens=True))
The model has been trained on a substantial amount of Hindi Wikipedia articles, which allows it to generate coherent and contextually relevant text.