--- language: - en - ko license: cc-by-nc-4.0 library_name: transformers tags: - mergekit - merge base_model: - mistral-community/pixtral-12b pipeline_tag: image-text-to-text --- # Pixtral-12b-korean-preview Finetunned with korean, english data for improving korean performance. # Model Card for Model ID Merged model using [mergekit](https://github.com/arcee-ai/mergekit/tree/main/mergekit) This model hasn't been fully tested, so your feedback will be invaluable in improving it. ## Merge Format ```yaml models: - model: spow12/Pixtral-12b-korean-base(private) layer_range: [0, 40] - model: mistral-community/pixtral-12b layer_range: [0, 40] merge_method: slerp base_model: mistral-community/pixtral-12b parameters: t: - filter: self_attn value: [0, 0.5, 0.3, 0.7, 1] - filter: mlp value: [1, 0.5, 0.7, 0.3, 0] - value: 0.5 # fallback for rest of tensors dtype: bfloat16 ``` ## Model Details ### Model Description - **Developed by:** spow12(yw_nam) - **Shared by :** spow12(yw_nam) - **Model type:** LLaVA - **Language(s) (NLP):** Korean, English - **Finetuned from model :** [mistral-community/pixtral-12b](https://huggingface.co/mistral-community/pixtral-12b) ## Usage ### Single image inference  ```python from transformers import AutoProcessor, AutoModelForVision2Seq from PIL import Image model_id = 'spow12/Pixtral-12b-korean-preview' model = AutoModelForVision2Seq.from_pretrained( model_id, device_map='auto', torch_dtype = torch.bfloat16, ).eval() model.tie_weights() processor = AutoProcessor.from_pretrained(model_id) system = "You are helpful assistant create by Yw nam" chat = [ { 'content': system, 'role': 'system' }, { "role": "user", "content": [ {"type": "image"}, {"type": "text", "content": "이 이미지에 나와있는 풍경을 설명해줘"}, ] } ] url = "https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcSXVmCeFm5GRrciuGCM502uv9xXVSrS9zDJZ1umCfoMero2MLxT" image = Image.open(requests.get(url, stream=True).raw) images = [[image]] prompt = processor.apply_chat_template(chat, tokenize=False) inputs = processor(text=prompt, images=images, return_tensors="pt").to(model.device) generate_ids = model.generate(**inputs, max_new_tokens=500,do_sample=True,min_p=0.1, temperature=0.9) output = processor.batch_decode(generate_ids, skip_special_tokens=True,clean_up_tokenization_spaces=False) print(output[0]) #Output """이 이미지는 바위 해안에 위치한 작은 섬에 위치한 고요한 해안 경치를 보여줍니다. 이 섬은 푸른 물로 둘러싸여 있으며, 그 위에는 붉은 지붕이 있는 하얀 등대가 서 있습니다. 등대는 섬의 중앙에 위치해 있으며, 바위 절벽과 연결된 돌다리가 이어져 있어 접근할 수 있습니다. 등대 주변의 바위 절벽은 파도가 부딪히며 장면에 역동적인 요소를 더합니다. 등대 너머로는 하늘이 맑고 푸르며, 전체적인 장면은 평화롭고 고요한 분위기를 자아냅니다.""" ``` ### Multi image inference