初始化项目,由ModelHub XC社区提供模型
Model: TrialPanorama/LLaMA-3-8B-TP Source: Original Platform
This commit is contained in:
104
README.md
Normal file
104
README.md
Normal file
@@ -0,0 +1,104 @@
|
||||
---
|
||||
license: apache-2.0
|
||||
base_model: meta-llama/Meta-Llama-3-8B
|
||||
tags:
|
||||
- trialpanorama
|
||||
- clinical-trials
|
||||
- sample-size-estimation
|
||||
- rlvr
|
||||
- reinforcement-learning
|
||||
- llama-3
|
||||
language:
|
||||
- en
|
||||
pipeline_tag: text-generation
|
||||
---
|
||||
|
||||
# LLaMA-3-8B-TP
|
||||
|
||||
This model is fine-tuned from [Meta-Llama-3-8B-Instruct](https://huggingface.co/meta-llama/Meta-Llama-3-8B-Instruct) by using [TrialPanorama dataset](https://huggingface.co/datasets/TrialPanorama/Dataset) for clinical trials.
|
||||
|
||||
## Model Details
|
||||
|
||||
- **Base Model**: Meta-Llama-3-8B-Instruct
|
||||
- **Fine-tuning Method**: Two-stage training
|
||||
- Stage 1: Supervised Fine-Tuning (SFT) for knowledge injection
|
||||
- Stage 2: RLVR (Reinforcement Learning with Verifiable Reward)
|
||||
|
||||
## Usage
|
||||
|
||||
### Basic Usage with Transformers
|
||||
|
||||
```python
|
||||
from transformers import AutoModelForCausalLM, AutoTokenizer
|
||||
import torch
|
||||
|
||||
# Load model and tokenizer
|
||||
model_name = "TrialPanorama/LLaMA-3-8B-TP"
|
||||
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
||||
model = AutoModelForCausalLM.from_pretrained(
|
||||
model_name,
|
||||
torch_dtype=torch.bfloat16,
|
||||
device_map="auto"
|
||||
)
|
||||
|
||||
# Prepare input (a toy example)
|
||||
prompt = """Given the following clinical trial information, estimate the required sample size:
|
||||
|
||||
[Input Information]
|
||||
|
||||
Please provide the estimated sample size and reasoning."""
|
||||
|
||||
# Generate response
|
||||
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
|
||||
outputs = model.generate(
|
||||
**inputs,
|
||||
max_new_tokens=512,
|
||||
temperature=0.6,
|
||||
top_p=0.95,
|
||||
do_sample=True
|
||||
)
|
||||
|
||||
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
||||
print(response)
|
||||
```
|
||||
|
||||
### Usage with vLLM (Recommended for Production)
|
||||
|
||||
```python
|
||||
from vllm import LLM, SamplingParams
|
||||
|
||||
# Initialize vLLM
|
||||
llm = LLM(
|
||||
model="TrialPanorama/LLaMA-3-8B-TP",
|
||||
tensor_parallel_size=1,
|
||||
dtype="bfloat16"
|
||||
)
|
||||
|
||||
# Set sampling parameters
|
||||
sampling_params = SamplingParams(
|
||||
temperature=0.6,
|
||||
top_p=0.95,
|
||||
max_tokens=512
|
||||
)
|
||||
|
||||
# Generate
|
||||
prompts = ["Your sample size estimation prompt here"]
|
||||
outputs = llm.generate(prompts, sampling_params)
|
||||
|
||||
for output in outputs:
|
||||
print(output.outputs[0].text)
|
||||
```
|
||||
|
||||
## Citation
|
||||
|
||||
If you use this model in your research, please cite:
|
||||
|
||||
```bibtex
|
||||
@article{wang2025trialpanorama,
|
||||
title = {Developing Large Language Models for Clinical Research Using One Million Clinical Trials},
|
||||
author = {Wang, Zifeng and Lin, Jiacheng and Jin, Qiao and Gao, Junyi and Pradeepkumar, Jathurshan and Jiang, Pengcheng and Lu, Zhiyong and Sun, Jimeng},
|
||||
journal = {arXiv preprint arXiv:2505.16097},
|
||||
year = {2025},
|
||||
url = {https://arxiv.org/abs/2505.16097}
|
||||
}
|
||||
```
|
||||
Reference in New Issue
Block a user