File size: 771 Bytes
5f25313
 
 
 
 
 
 
 
 
ad2dd15
5f25313
 
 
 
 
 
 
 
 
 
 
ad2dd15
5f25313
 
 
 
 
 
 
ad2dd15
 
5f25313
 
 
 
ad2dd15
5f25313
 
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
---
tags:
- matformer
- custom-model
library_name: transformers
---

# Matformer Model

Trained using [Matformer](https://github.com/mrinaldi97/matformer).

## Installation

```bash
pip install git+https://github.com/mrinaldi97/matformer.git
```

## Usage

```python
import torch
from transformers import AutoModelForCausalLM

model = AutoModelForCausalLM.from_pretrained(
    "mrinaldi/prova001",
    trust_remote_code=True
)

prompt = "The transformer model is a"
inputs = model.matformer_model.tokenizer.encode(prompt, add_bos=True, add_eos=False)
inputs = torch.tensor([inputs], device="cuda")

with torch.no_grad():
    outputs = model.generate(inputs, max_new_tokens=50)
    
decoded = model.matformer_model.tokenizer.decode(outputs[0].tolist())
print(decoded)
```