File size: 1,667 Bytes
13a70d4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d1194ad
13a70d4
 
 
322fd97
13a70d4
 
322fd97
13a70d4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d1194ad
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
---
pipeline_tag: text-generation
---

# Model Card for Model ID

Small testing version of my first model

This modelcard aims to be a base template for new models. It has been generated using [this raw template](https://github.com/huggingface/huggingface_hub/blob/main/src/huggingface_hub/templates/modelcard_template.md?plain=1).

## Model Details

### Model Description

Test version of my first model



## Uses

Dosen't work well


### Out-of-Scope Use

Better not use for anything

[More Information Needed]

## Bias, Risks, and Limitations

Don't work


## How to Get Started with the Model

```import torch
from transformers import AutoTokenizer, AutoModelForCausalLM

# Load pre-trained model tokenizer (v3 compatibility)
tokenizer = AutoTokenizer.from_pretrained("amusktweewt/14M-small-chat")

# Load pre-trained model (PyTorch Lightning module)
model = AutoModelForCausalLM.from_pretrained("amusktweewt/14M-small-chat")

# Set device
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
model.to(device)

while True:
    user_input = input("> ")
    if user_input.lower() == "quit":
        break

    inputs = tokenizer(user_input, return_tensors="pt", max_length=512, truncation=True).to(device)
    outputs = model(**inputs)

    logits = outputs.logits
    probs = torch.nn.functional.softmax(logits, dim=-1)
    top_prob, top_idx = torch.topk(probs, 3)  # Get the top 3 probabilities

    # Flatten the list of token IDs before decoding
    top_idx = top_idx[0].view(-1).tolist()
    top_pred = tokenizer.decode(top_idx, skip_special_tokens=True)

    print(f"You: {user_input}")
    print(f"Model: {top_pred}")

print("Goodbye!")
```