File size: 2,104 Bytes
81676aa
 
a19161e
81676aa
 
 
 
856f4bc
81676aa
 
511d53c
81676aa
 
 
 
 
043bf2a
81676aa
856f4bc
1dfd462
 
a19161e
8e840cd
 
81676aa
a86d458
81676aa
856f4bc
81676aa
 
 
856f4bc
c3b8699
8e840cd
c3b8699
 
81676aa
31b43a7
8a170be
c3b8699
 
 
 
297b591
c3b8699
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8a170be
c3b8699
8a170be
 
 
 
c3b8699
8a170be
362d085
 
8a170be
 
 
c3b8699
 
 
8a170be
 
 
 
 
31b43a7
ff6fab5
81676aa
 
8e840cd
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
---
library_name: transformers
license: apache-2.0
---

# Model Card for Model ID

Just only a text gen model type, I'm just test train my dataset and...it's work, very nice, try it.

## Model Details
- [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1fhVByew053W8SdbacFryIx3luhFkEa1M?usp=sharing)

### Model Description

<!-- Provide a longer summary of what this model is. -->

This is the model card of a 🤗 transformers model that has been pushed on the Hub. 

- **Developed by:** **HuyRemy**
- **Funded by :** **HuyRemy**
- **Shared by :** **HuyRemy**
- **Model type:** **Megatron Mistral** 
- **License:** huynq@isi.com.vn


### Model Demo:

- **Demo :** https://ai.matilda.vn

## Uses

**USE T4 GPU**
```Python
!pip install "unsloth[colab-new] @ git+https://github.com/unslothai/unsloth.git"
!pip install --no-deps xformers trl peft accelerate bitsandbytes
```
### Direct Use
``` Python
from unsloth import FastLanguageModel
import torch
max_seq_length = 2048
dtype = None 
load_in_4bit = True 
alpaca_prompt = """
### Instruction:
{}

### Input:
{}

### Response:
{}"""


def formatting_prompts_func(examples):
    instructions = examples["instruction"]
    inputs       = examples["input"]
    outputs      = examples["output"]
    texts = []
    for instruction, input, output in zip(instructions, inputs, outputs):
        text = alpaca_prompt.format(instruction, input, output) + EOS_TOKEN
        texts.append(text)
    return { "text" : texts, }
pass

model, tokenizer = FastLanguageModel.from_pretrained(
    model_name = "huyremy/aichat", 
    max_seq_length = max_seq_length,
    dtype = dtype,
    load_in_4bit = load_in_4bit,
)
FastLanguageModel.for_inference(model) 

EOS_TOKEN = tokenizer.eos_token 

inputs = tokenizer(
[
    alpaca_prompt.format(
        "who is Nguyễn Phú Trọng?", 
        "", 
        "", 
    ),
], return_tensors = "pt").to("cuda")

outputs = model.generate(**inputs, max_new_tokens = 64, use_cache = True)
tokenizer.batch_decode(outputs)
```

## Model Card Contact

huynq@isi.com.vn