Instructions to use helloimsaif/medjev-4b-lora with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use helloimsaif/medjev-4b-lora with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen3.5-4B") model = PeftModel.from_pretrained(base_model, "helloimsaif/medjev-4b-lora") - Notebooks
- Google Colab
- Kaggle
Download examples/quickstart.py from helloimsaif/medjev-4b-lora: direct link, hf CLI and curl.
- Browser
- Download file 1.16 kB
-
https://huggingface.co/helloimsaif/medjev-4b-lora/resolve/main/examples/quickstart.py
- Command line
-
hf download hf://helloimsaif/medjev-4b-lora/examples/quickstart.py
-
curl -L -o quickstart.py https://huggingface.co/helloimsaif/medjev-4b-lora/resolve/main/examples/quickstart.py
1.16 kB
| """Two typed decisions: a laboratory result and a financial headline. python examples/quickstart.py""" | |
| import sys | |
| from pathlib import Path | |
| sys.path.insert(0, str(Path(__file__).resolve().parent.parent)) | |
| from medjev import decide, load | |
| model, tok = load() | |
| choice, probs = decide( | |
| model, tok, | |
| state={"test": "serum potassium", "value": "6.8 mmol/L", "reference_range": "3.5-5.0 mmol/L"}, | |
| question="How should this laboratory result be categorized?", | |
| options={"normal": "Within the reference range.", | |
| "abnormal": "Outside the reference range but not immediately dangerous.", | |
| "critical": "Dangerously abnormal; needs immediate clinician notification."}, | |
| ) | |
| print(choice, {k: round(v, 3) for k, v in probs.items()}) | |
| choice, probs = decide( | |
| model, tok, | |
| state={"headline": "Acme Corp cuts full-year revenue guidance after weak Q3 demand"}, | |
| question="What does this news imply for the outlook of the company it mentions?", | |
| options={"bullish": "Positive for the outlook.", "bearish": "Negative for the outlook.", "neutral": "No clear implication."}, | |
| ) | |
| print(choice, {k: round(v, 3) for k, v in probs.items()}) | |