File size: 1,518 Bytes
e518114
 
da04d28
57eacaf
 
e518114
0cf84d4
b3e5f9a
0cf84d4
 
 
b3e5f9a
0cf84d4
b3e5f9a
 
 
 
0cf84d4
4e23878
0cf84d4
 
 
 
 
 
4e23878
0cf84d4
 
 
 
 
 
 
 
0527d2f
0cf84d4
b3e5f9a
0cf84d4
b3e5f9a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
---
license: apache-2.0
library_name: peft
pipeline_tag: text-generation
base_model: meta-llama/Llama-2-7b-hf
---

## Hindi-wiki-LLaMA
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.

## Model Details

- Base Model: Llama-2
- Pretraining Dataset: Hindi Wikipedia Articles
- Tokenizer: Hugging Face Tokenizer
- Model Architecture: Causal Language Modeling


```python
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))
```

## Model Performance:--

The model has been trained on a substantial amount of Hindi Wikipedia articles, which allows it to generate coherent and contextually relevant text.