--- datasets: - jojo0217/korean_rlhf_dataset - jojo0217/korean_safe_conversation - HAERAE-HUB/qarv-instruct-ko - HAERAE-HUB/Korean-Human-Judgements - HAERAE-HUB/K2-Feedback - changpt/ko-lima-vicuna - maywell/kiqu_samples - CarrotAI/ko-instruction-dataset - 4n3mone/vector_bench language: - ko library_name: transformers license: other license_name: glm-4 license_link: https://huggingface.co/THUDM/glm-4v-9b/blob/main/LICENSE pipeline_tag: text-generation tags: - llama-factory --- ## Model - base model: [THUDM/glm-4v-9b](https://huggingface.co/THUDM/glm-4v-9b) ## Dataset - [jojo0217/korean_rlhf_dataset](https://huggingface.co/datasets/jojo0217/korean_rlhf_dataset) - [jojo0217/korean_safe_conversation](https://huggingface.co/datasets/jojo0217/korean_safe_conversation) - [HAERAE-HUB/qarv-instruct-ko](https://huggingface.co/datasets/HAERAE-HUB/qarv-instruct-ko) - [HAERAE-HUB/Korean-Human-Judgements](https://huggingface.co/datasets/HAERAE-HUB/Korean-Human-Judgements) - [HAERAE-HUB/K2-Feedback](https://huggingface.co/datasets/HAERAE-HUB/K2-Feedback) - [changpt/ko-lima-vicuna](https://huggingface.co/datasets/changpt/ko-lima-vicuna) - [maywell/kiqu_samples](https://huggingface.co/datasets/maywell/kiqu_samples) - [CarrotAI/ko-instruction-dataset](https://huggingface.co/datasets/CarrotAI/ko-instruction-dataset) - [4n3mone/vector_bench](https://huggingface.co/datasets/4n3mone/vector_bench) ## Load Model Use the following Python code to load the model: ```python3 from transformers import AutoTokenizer, AutoModelForCausalLM path = 'youjunhyeok/glm-4-9b-ko-v2' model = AutoModelForCausalLM.from_pretrained(path, trust_remote_code=True) tokenizer = AutoTokenizer.from_pretrained(path, trust_remote_code=True) model.to('cuda') ``` ## Chat ```python3 def chat(message): messages = [ {"role": "system", "content": "당신은 인공지능 어시스턴트입니다. 친절하고 정확한 답변을 해주세요."}, {"role": "user", "content": message}, ] input_ids = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_tensors="pt" ).to(model.device) terminators = [ tokenizer.eos_token_id, ] outputs = model.generate( input_ids, max_new_tokens=512, eos_token_id=terminators, do_sample=True, temperature=0.9, top_p=0.95, ) response = outputs[0][input_ids.shape[-1]:] print(tokenizer.decode(response, skip_special_tokens=True)) chat('다음 두 집합 A, B에 대해 A 교집합 B = {1, 2, 3, 4, 5}이고, A 합집합 B = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}일 때, A와 B의 원소의 개수 범위를 구하시오.') ``` ## Output ``` 집합 A와 B에 대한 정보를 바탕으로 A와 B의 원소의 개수 범위를 구해볼게요. 먼저, A 교집합 B = {1, 2, 3, 4, 5}라는 정보를 보면, 집합 A와 B의 공통 원소는 1, 2, 3, 4, 5이므로, 이 원소들의 개수를 구하면 됩니다. 즉, A와 B의 공통 원소 개수는 5입니다. 다음으로, A 합집합 B = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}라는 정보를 보면, 집합 A와 B의 모든 원소를 합친 결과가 이 집합이므로, 이 집합의 원소 개수를 구하면 됩니다. 즉, A와 B의 합집합 원소 개수는 10입니다. 따라서, 집합 A와 B의 원소의 개수 범위는 5에서 10 사이입니다. 즉, A와 B의 공통 원소 개수는 최소 5개이고, 합집합 원소 개수는 최대 10개입니다. 이 정보를 바탕으로 A와 B의 원소 개수 범위를 구할 수 있어요. 다른 궁금한 점이 있으면 언제든지 물어봐 주세요! ``` ## Llama_factory Train Config {data_dir}, {dataset_name}, {output_dir} is variable ``` bf16: true cutoff_len: 2048 dataset: {dataset_name} dataset_dir: {data_dir} ddp_timeout: 180000000 do_train: true eval_steps: 150 eval_strategy: steps finetuning_type: lora flash_attn: auto gradient_accumulation_steps: 8 include_num_input_tokens_seen: true learning_rate: 0.0001 logging_steps: 5 lora_alpha: 16 lora_dropout: 0.05 lora_rank: 16 lora_target: all loraplus_lr_ratio: 1 lr_scheduler_type: inverse_sqrt max_grad_norm: 1.0 max_samples: 75000 model_name_or_path: THUDM/glm-4-9b num_train_epochs: 3.0 optim: adamw_torch output_dir: {output_dir} packing: true per_device_eval_batch_size: 8 per_device_train_batch_size: 8 plot_loss: true preprocessing_num_workers: 16 report_to: all resize_vocab: true save_steps: 150 stage: sft template: glm4 val_size: 0.05 warmup_steps: 150 ```