--- base_model: unsloth/llama-3-8b-bnb-4bit language: - en license: apache-2.0 tags: - text-generation-inference - transformers - unsloth - llama - trl --- # LLM basado en LLaMA Ajustado al Dominio de Patología Primera Versión de un LLM ajustado para responder preguntas de Patología # Uploaded model - **Developed by:** jjsprockel - **License:** apache-2.0 - **Finetuned from model :** unsloth/llama-3-8b-bnb-4bit **Código para descarga:** El siguiente es el código sugerido para descargar el modelo usando Unslot: ``` import torch from unsloth import FastLanguageModel model, tokenizer = FastLanguageModel.from_pretrained( model_name = "jjsprockel/Patologia_lora_model1", max_seq_length = 2048, # Choose any! Llama 3 is up to 8k dtype = None, load_in_4bit = True, ) FastLanguageModel.for_inference(model) alpaca_prompt = """Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request. ### Instruction: {} ### Input: {} ### Response: {}""" ``` **Código para la inferencia:** El siguiente codigo demuestra como se puede llevar a cabo la inferencia. ``` instruction = input("Ingresa la pregunta que tengas de Patología: ") inputs = tokenizer( [ alpaca_prompt.format( instruction, # instruction "", # input "", # output - leave this blank for generation! ) ], return_tensors = "pt").to("cuda") from transformers import TextStreamer text_streamer = TextStreamer(tokenizer) _ = model.generate(**inputs, streamer = text_streamer, max_new_tokens = 2048) ``` This llama model was trained 2x faster with [Unsloth](https://github.com/unslothai/unsloth) and Huggingface's TRL library. [](https://github.com/unslothai/unsloth)