transformers safetensors bert fill-mask fillmask fa license:mit autotrain_compatible endpoints_compatible region:us
---
language:
- fa
license: mit
tags:
- fillmask
- bert
---


### Hafez_Bert_based language model
The paragraph describes the development of a language model named "Hafez," which references the famous Persian poet from Shiraz, Iran. Here’s a breakdown of the information presented:

<b>Model Type:</b> Hafez is based on the BERT architecture, which is a popular model for natural language processing (NLP). 

<b>Cultural Reference:</b> The model is named after Hafez, a renowned Persian poet known for his deeply emotional and philosophical verses. This choice of name suggests a connection to Persian literature and an intention to handle language in a way that may resonate with the cultural significance of the poet. (NLP). 

<b>Training Data:</b> The model has been trained on a substantial dataset comprising over 12 billion tokens. The text used to train the Hafez language model is comprised of two parts: 90% consists of educational materials, including research papers, dissertations, and theses, while the remaining 10% includes general texts. This careful selection of content aims to provide the model with a strong foundation in academic language and discourse.

<b>Text Cleaning and Preprocessing:</b> The training data underwent a cleaning and preprocessing phase, which is essential for ensuring that the data is of high quality and suitable for training a machine learning model. The cleaning and preparation were conducted using "Viravirast text tools," which are likely specialized tools designed for text processing in this context.


### How to use
```python
from transformers import pipeline
unmasker = pipeline('fill-mask', model='ViravirastSHZ/Hafez_Bert')
print(unmasker("شیراز یکی از زیباترین [MASK] ایران است."))
```

# Results
We have conducted evaluations of the Hafez language model specifically on a text classification task, and we welcome others to explore its performance on various downstream tasks as well. The F1 score will be utilized as the primary metric for measuring the model's effectiveness. We would greatly appreciate any efforts in testing Hafez across different applications.


<table class="tg">
<thead>
  <tr>
    <th class="tg-c3ow">Model</th>
    <th class="tg-c3ow" colspan="2">Text classificaion</th>
  </tr>
</thead>
<tbody>
 <tr>
    <td class="tg-0pky"></td>
    <td class="tg-c3ow">Msobhi/virgool_62k</td>   
  </tr>
  
  <tr>
    <td class="tg-0pky">ViravirastSHZ/Hafez_Bert</td>
    <td class="tg-c3ow"> test-F1 score: 0.437764  <br><a href="https://colab.research.google.com/drive/10Nk1U2f1tNr9oacjd4brxcz9g2jB_Rmi?usp=sharing"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Colab Code" width="87" height="15"></td>
  </tr>
   

  <tr>
    <td class="tg-0pky">lifeweb-ai/shiraz</td>
    <td class="tg-c3ow"> test-F1 score: 0.349834 <br><a href="https://colab.research.google.com/drive/1JiOyc1dU1qkI-_ddibLtYpzhhIO8VZ2Q?usp=sharing"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Colab Code" width="87" height="15"></td>
  </tr>
</tbody>

</table>



# Cite

@misc{Hafez language model,
    author = {Amin Rahmani},
    title = {[Pre-trained BERT-based language Model for Persian Language]},
    year = {2024},
    publisher = {Viravirast}
}


# Contributor

-Amin Rahmani [**viravirast**](https://viravirast.com/about-us/)
-Amin Rahmani [**Linkedin**](https://www.linkedin.com/in/amin-rahmani-41417b121)



