--- license: apache-2.0 language: - ko --- # polyglot-ko-12.8b-instruct This model is a fine-tuned version of [EleutherAI/polyglot-ko-12.8b](https://huggingface.co/EleutherAI/polyglot-ko-12.8b) on an instruction-following dataset(260k). ## Training procedure ### Training hyperparameters The following hyperparameters were used during training: - learning_rate: 5e-05 - train_batch_size: 1 - seed: 42 - distributed_type: multi-GPU(A100 80G) - num_devices: 8 - gradient_accumulation_steps: 64 - total_train_batch_size: 512 - total_eval_batch_size: 64 - optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08 - lr_scheduler_type: linear - num_epochs: 5.0 ### Inference ```python import torch from transformers import pipeline, AutoModelForCausalLM MODEL = 'etri-xainlp/polyglot-ko-12.8b-instruct' model = AutoModelForCausalLM.from_pretrained( MODEL, torch_dtype=torch.float16, low_cpu_mem_usage=True, ).to(device=f"cuda", non_blocking=True) model.eval() pipe = pipeline( 'text-generation', model=model, tokenizer=MODEL, device=0 ) pipe.model.config.pad_token_id = pipe.model.config.eos_token_id def ask(x, context='', is_input_full=False): ans = pipe( f"### 질문: {x}\n\n### 맥락: {context}\n\n### 답변:" if context else f"### 질문: {x}\n\n### 답변:", do_sample=True, max_new_tokens=2048, temperature=0.9, top_p=0.9, return_full_text=False, eos_token_id=2, ) return ans[0]['generated_text'] while True: quit = input('prompt?: ') if quit == 'q': break else: generation = ask(quit) print("etri_ai:", generation) ``` ### Framework versions - Transformers 4.30.2 - Pytorch 2.0.1+cu118 - Datasets 2.13.1 - Tokenizers 0.13.3