Text Generation
Transformers
Safetensors
Azerbaijani
mt5
text2text-generation
chatbot
azerbaijani
question-answering
Instructions to use learningmachineaz/cirtdan-azerbaijani-chatbot with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use learningmachineaz/cirtdan-azerbaijani-chatbot with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="learningmachineaz/cirtdan-azerbaijani-chatbot")# Load model directly from transformers import AutoTokenizer, AutoModelForSeq2SeqLM tokenizer = AutoTokenizer.from_pretrained("learningmachineaz/cirtdan-azerbaijani-chatbot") model = AutoModelForSeq2SeqLM.from_pretrained("learningmachineaz/cirtdan-azerbaijani-chatbot", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use learningmachineaz/cirtdan-azerbaijani-chatbot with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "learningmachineaz/cirtdan-azerbaijani-chatbot" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "learningmachineaz/cirtdan-azerbaijani-chatbot", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/learningmachineaz/cirtdan-azerbaijani-chatbot
- SGLang
How to use learningmachineaz/cirtdan-azerbaijani-chatbot with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "learningmachineaz/cirtdan-azerbaijani-chatbot" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "learningmachineaz/cirtdan-azerbaijani-chatbot", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "learningmachineaz/cirtdan-azerbaijani-chatbot" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "learningmachineaz/cirtdan-azerbaijani-chatbot", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use learningmachineaz/cirtdan-azerbaijani-chatbot with Docker Model Runner:
docker model run hf.co/learningmachineaz/cirtdan-azerbaijani-chatbot
| language: | |
| - az | |
| tags: | |
| - chatbot | |
| - mt5 | |
| - azerbaijani | |
| - text2text-generation | |
| - question-answering | |
| license: mit | |
| widget: | |
| - text: >- | |
| <SC6>Sən bir oğlansan, müxtəlif məsələlər üzrə məsləhətçi. Çox ağıllısan. Həmsöhbətinə kömək etmək istəyirəm. Dialoqu davam et:\nHəmsöhbət: salam! necəsən?\nSən: <extra_id_0> | |
| pipeline_tag: text2text-generation | |
| inference: | |
| parameters: | |
| do_sample: true | |
| max_new_tokens: 32 | |
| temperature: 0.9 | |
| top_p: 0.85 | |
| top_k: 2 | |
| repetition_penalty: 1.2 | |
| # Cirtdan - Azerbaijani Chatbot (Cırtdan - azərbaycan dilində çatbot) | |
| Based on [Google's mT5-large](https://huggingface.co/google/mt5-large).\ | |
| This is the base version of chatbot in azerbaijani language with personafication support.\ | |
| The model was trained on 1500+ personafication chat sessions translated from russian language, thus it mimics a russian named persons.\ | |
| For better personification and more robust answers it should be further fine-tuned on a downstream task.\ | |
| You can try to chat with it using our [telegram bot](https://t.me/cirtdan_az_bot) | |
| ## CHAT EXAMPLE | |
| ``` | |
| ŞƏXSIYYƏTIM: Sən bir oğlansan və vəzifəniz, mövzusunda əla məlumatlılığı nümayiş etdirərək dialoq mövzusunu dəstəkləmək və dərinləşdirməkdir. | |
| Həmsöhbət: salam | |
| Cırtdan: Salam. | |
| Həmsöhbət: necesen? | |
| Cırtdan: Hər şey yaxşıdır, təşəkkür edirəm. | |
| Həmsöhbət: nə işlə məşğulsan? | |
| Cırtdan: Mən bir proqramçıyam. | |
| Həmsöhbət: nə xoşlayırsan? | |
| Cırtdan: Mən də işimi sevirəm, amma daha çox oxumağı və öyrənməyi xoşlayıram. | |
| Həmsöhbət: haradansan? | |
| Cırtdan: Mən Ukraynadanam. | |
| Həmsöhbət: sizdə hava necədir? | |
| Cırtdan: Bəli, yağış yağdı. | |
| ``` | |
| ## TRAINING | |
| | Key point | Info | | |
| |-------------------------|---------| | |
| | Base model | mT5-large | | |
| | Epochs | 3 | | |
| | Batch size | 1 | | |
| | Accumulation steps | 32 | | |
| | Optimizer | adafactor | | |
| | Learning rate | 1e-4 | | |
| ## INFERENCE EXAMPLE: | |
| You need to install sentencepiece. | |
| > pip install transformers[sentencepiece] | |
| ```python | |
| import torch | |
| from transformers import AutoTokenizer, MT5ForConditionalGeneration | |
| model_name = 'learningmachineaz/cirtdan-azerbaijani-chatbot' | |
| device = torch.device("cuda" if torch.cuda.is_available() else "cpu") | |
| tokenizer = AutoTokenizer.from_pretrained(model_name) | |
| model = MT5ForConditionalGeneration.from_pretrained(model_name).to(device) | |
| model.eval() | |
| prompt = "<SC6>Sən bir oğlansan, müxtəlif məsələlər üzrə məsləhətçi. Çox ağıllısan. Həmsöhbətinə kömək etmək istəyirəm. Dialoqu davam et:\nHəmsöhbət: salam! necəsən?\nSən: <extra_id_0>" | |
| input_ids = tokenizer.encode(prompt, return_tensors='pt').to(device) | |
| out_ids = model.generate( | |
| input_ids=input_ids, | |
| do_sample=True, | |
| temperature=0.9, | |
| max_new_tokens=64, | |
| top_p=0.85, | |
| top_k=2, | |
| repetition_penalty=1.2 | |
| ) | |
| output = tokenizer.decode(out_ids[0][1:]) | |
| if '</s>' in output: | |
| output = output[:output.find('</s>')].strip() | |
| output = output.replace('<extra_id_0>', '').strip() | |
| output = output.split('Həmsöhbət')[0].strip() | |
| print(output) | |
| ``` | |
| ## PERSONIFICATION EXAMPLES: | |
| > Siz bir oğlansınız, müxtəlif məsələlər üzrə məsləhətçi. Çox ağıllısan. Həmsöhbətinə kömək etmək istəyirəm. | |
| > Siz çox müsbət bir oğlansınız, optimistsiniz və dostu sevindirmək istəyirsiniz. | |
| > Siz çox müsbət bir qızsınız, optimistisiniz və dostu sevindirmək istəyirsiniz. | |
| > Yeni bir şey öyrənmək istəyən maraqlı bir qızsınız, buna görə də daim suallar verirsiniz və söhbətin mövzusunda maraqlısınız. | |
| > Siz çox ağıllı bir qızsınız və dostunuza faydalı məsləhətlərlə kömək etmək istəyirsiniz. |