--- library_name: transformers tags: - medical - Clinical coding - ICD-10 - ICD-O-3 - QA datasets: - stefan-m-lenz/ICDOPS-QA-2024 language: - de base_model: - Qwen/Qwen3-14B --- # Model Card for Model stefan-m-lenz/Qwen3-14B-ICDOPS-QA-2024 This model is a PEFT adapter (e.g., LoRA) fine-tuned using the dataset [ICDOPS-QA-2024](https://huggingface.co/datasets/stefan-m-lenz/ICDOPS-QA-2024) based on [Qwen/Qwen3-14B](https://huggingface.co/Qwen/Qwen3-14B). For more information about the training, see the [dataset card](https://huggingface.co/datasets/stefan-m-lenz/ICDOPS-QA-2024). # Usage Package prerequisites: ```bash pip install transformers accelerate peft ``` Load the model. ```python from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig from peft import PeftModel, PeftConfig repo_id = "stefan-m-lenz/Qwen3-14B-ICDOPS-QA-2024" config = PeftConfig.from_pretrained(repo_id, device_map="auto") quantization_config = BitsAndBytesConfig(load_in_8bit=True) model = AutoModelForCausalLM.from_pretrained(config.base_model_name_or_path, device_map="auto", quantization_config=quantization_config) model = PeftModel.from_pretrained(model, repo_id, device_map="auto") tokenizer = AutoTokenizer.from_pretrained(config.base_model_name_or_path, device_map="auto") # Test input test_input = """Welche ICD-10-Kodierung wird für die Tumordiagnose "Bronchialkarzinom, Hauptbronchus" verwendet? Antworte nur mit dem ICD-10 Code.""" input_str = tokenizer.apply_chat_template( [{"role": "user", "content": test_input}], tokenize=False, add_generation_prompt=True, enable_thinking=False, ) # Generate response inputs = tokenizer(input_str, return_tensors="pt").to("cuda") outputs = model.generate( **inputs, max_new_tokens=7, do_sample=False, pad_token_id=tokenizer.eos_token_id, temperature=None, top_p=None, top_k=None, ) response = tokenizer.decode(outputs[0], skip_special_tokens=True) response = response[len(test_input):].strip() print("Test Input:", test_input) print("Model Response:", response)