GPTuzmodel.

GPTuz GPT-2 kichik modelga asoslangan Uzbek tili uchun state-of-the-art til modeli.

Bu model GPU NVIDIA V100 32GB va 0.53 GB malumotlarni kun.uz dan foydalanilgan holda Transfer Learning va Fine-tuning texnikasi asosida 1 kundan ziyod vaqt davomida o'qitilgan.

Qanday foydaniladi



import torch

tokenizer = AutoTokenizer.from_pretrained("arxiv/uzwiki/gpt2-small-uzbek")
model = AutoModelWithLMHead.from_pretrained("arxiv/uzwiki/gpt2-small-uzbek")

tokenizer.model_max_length=1024 

Bitta so'z yaratish



text = "Covid-19 га қарши эмлаш бошланди," inputs = tokenizer(text, return_tensors="pt")

outputs = model(**inputs, labels=inputs["input_ids"]) loss, logits = outputs[:2] predicted_index = torch.argmax(logits[0, -1, :]).item() predicted_text = tokenizer.decode([predicted_index])

print('input text:', text) print('predicted text:', predicted_text)

Bitta to'liq ketma-ketlikni yarating



text = "Covid-19 га қарши эмлаш бошланди, "
inputs = tokenizer(text, return_tensors="pt")


sample_outputs = model.generate(inputs.input_ids,
                                pad_token_id=50256,
                                do_sample=True, 
                                max_length=50, # kerakli token raqamini qo'ying
                                top_k=40,
                                num_return_sequences=1)


for i, sample_output in enumerate(sample_outputs):
    print(">> Generated text {}\n\n{}".format(i+1, tokenizer.decode(sample_output.tolist())))

Downloads last month
9
Hosted inference API
Text Generation
Examples
Examples
This model can be loaded on the Inference API on-demand.