Movatterモバイル変換


[0]ホーム

URL:


Hugging Face's logoHugging Face

Polpaca: The Alpaca Speaks Polish

The blogpost:https://medium.com/@mmosiolek/can-alpacas-learn-languages-df48a03b6d8

LLaMA is a state-of-the-art, foundational, open-source large language model designed to help engineers and researchers advance their work in NLP. For example, Stanford researchers have fine-tunedLLaMA to construct an alternative to the famous ChatGPT - a model calledAlpaca.Unfortunately,LLaMA was trained on a dataset consisting mainly of English texts, with only 4.5% of the data relating to other languages.In addition, theAlpaca instruction training dataset consists only of examples of English instructions.SoAlpaca simply doesn't work for the other languages.

This repo makesAlpaca-Lora-7B speak Polish.

Usage

from transformersimport LlamaTokenizer, LlamaForCausalLMfrom peftimport PeftModelimport bitsandbytesas bnbbase ="decapoda-research/llama-7b-hf"finetuned ="mmosiolek/polpaca-lora-7b"tokenizer = LlamaTokenizer.from_pretrained(base)tokenizer.pad_token_id =0tokenizer.padding_side ="left"model = LlamaForCausalLM.from_pretrained(base)model = PeftModel.from_pretrained(model, finetuned).to("cuda")

For output generation use the following code. Feel free to adjust the parameters according to your needs.

from transformersimport GenerationConfigconfig = GenerationConfig(  temperature=0.1,  top_p=0.5,  top_k=40,  num_beams=4,  max_new_tokens=128,  repetition_penalty=1.2)defrun(instruction, model, tokenizer):    encodings = tokenizer(instruction, padding=True, return_tensors="pt").to('cuda')    generated_ids = model.generate(        **encodings,        generation_config=GENERATION_CONFIG,    )    decoded = tokenizer.batch_decode(generated_ids)del encodings, generated_ids    torch.cuda.empty_cache()return decoded[0].split("\n")[-1]

Example input/output

instruction:

Wymyśl kilka zapytań w google na temat kodowania.

outputJaki jest najpopularniejszy język programowania? Jaki jest najbardziej powszechnie używany język programowania? Jaki jest najnowszy język programowania? Jaki jest najbardziej efektywny język programowania?

instructionZrób listę pożądanych umiejętności inżynierów oprogramowania, którą możesz dodać do LinkedIn.outputPożądane umiejętności dla inżyniera oprogramowania obejmują: - Programowanie w językach takich jak Java, C++, C#, Python, JavaScript i HTML - Wnioskowanie logiczne - Rozwiązywanie problemów - Inżynieria oprogramowania - Uczenie maszynowe - Przetwarzanie języka naturalnego (NLP) - Systemy zarządzania bazami danych (DBMS) - Architektura

instruction

W odniesieniu do danego scenariusza pogody podaj kilka wskazówek, jak dostosować do niego plany podróży.

input

nagłą zmianę temperatury

output

Kilka wskazówek dotyczących dostosowania planów podróży w przypadku nagłej zmiany temperatury obejmują:1. Upewnij się, że masz odpowiednie ubrania i akcesoria, takie jak krem przeciwsłoneczny, kapelusze i okulary przeciwsłoneczne.2. Upewnij się, że masz wystarczającą ilość płynów, takich jak woda i napoje gazowane.
Downloads last month

-

Downloads are not tracked for this model.How to track
Inference ProvidersNEW
This model isn't deployed by any Inference Provider.🙋Ask for provider support
HF Inference deployability: The model has no library tag.

Dataset used to trainmmosiolek/polpaca-lora-7b


[8]ページ先頭

©2009-2025 Movatter.jp