File size: 1,755 Bytes
2a2573c
 
 
 
 
 
 
 
 
 
0b1d8d2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
---
license: apache-2.0
language:
- en
metrics:
- accuracy
pipeline_tag: text2text-generation
tags:
- health
- FHIR
---

# bart-large

This model is a fine-tuned version of [bart-large](https://huggingface.co/facebook/bart-large) on a manually created dataset.
It achieves the following results on the evaluation set:
- Loss: 0.40

### Training hyperparameters

The following hyperparameters were used during training:
- learning_rate: 2e-05
- train_batch_size: 64
- eval_batch_size: 64
- seed: 42
- optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
- num_epochs: 3

### Training results

| Training Loss | Epoch | Step | Validation Loss | 
|:-------------:|:-----:|:----:|:---------------:|
| -          | 1.0   | 47    | 4.5156
...
| -         | 10    | 490   | 0.4086         


## How to use

```python
def generate_text(input_text):
    # Tokenize the input text
    input_tokens = tokenizer(input_text, return_tensors='pt')

    # Move the input tokens to the same device as the model
    input_tokens = input_tokens.to(model.device)

    # Generate text using the fine-tuned model
    output_tokens = model.generate(**input_tokens)

    # Decode the generated tokens to text
    output_text = tokenizer.decode(output_tokens[0], skip_special_tokens=True)

    return output_text

from transformers import BartForConditionalGeneration

# Load the pre-trained BART model from the Hugging Face model hub
model = BartForConditionalGeneration.from_pretrained('rasta/BART-FHIR-question')

input_text = "List all procedures with reason reference to resource with ID 24680135."
output_text = generate_text(input_text)
print(output_text)
```


### Framework versions

- Transformers 4.18.0
- Pytorch 1.11.0+cu113
- Datasets 2.1.0
- Tokenizers 0.12.1