Commit
•
33b8133
1
Parent(s):
f66203b
Update README.md
Browse files
README.md
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
---
|
2 |
language:
|
3 |
- en
|
|
|
4 |
license: apache-2.0
|
5 |
tags:
|
6 |
- text-generation-inference
|
@@ -20,6 +21,66 @@ datasets:
|
|
20 |
|
21 |
![image/png](https://cdn-uploads.huggingface.co/production/uploads/65187b234965add2b08b2990/6VsNF_rgDjXlubd4x8dMk.png)
|
22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
# Uploaded model
|
24 |
|
25 |
- **Developed by:** suyash2739
|
|
|
1 |
---
|
2 |
language:
|
3 |
- en
|
4 |
+
- hi
|
5 |
license: apache-2.0
|
6 |
tags:
|
7 |
- text-generation-inference
|
|
|
21 |
|
22 |
![image/png](https://cdn-uploads.huggingface.co/production/uploads/65187b234965add2b08b2990/6VsNF_rgDjXlubd4x8dMk.png)
|
23 |
|
24 |
+
|
25 |
+
# Colab Files:
|
26 |
+
- Model_Use.ipynb file to use the model
|
27 |
+
- Hinglish_train_lamma_3_8b_instruct_2_epoch.ipynb to see how the model is trained
|
28 |
+
|
29 |
+
# Inference:
|
30 |
+
|
31 |
+
```
|
32 |
+
!pip install "unsloth[colab-new] @ git+https://github.com/unslothai/unsloth.git"
|
33 |
+
!pip install --no-deps xformers trl peft accelerate bitsandbytes
|
34 |
+
```
|
35 |
+
|
36 |
+
```python
|
37 |
+
from unsloth import FastLanguageModel
|
38 |
+
import torch
|
39 |
+
max_seq_length = 2048
|
40 |
+
dtype = None # None for auto detection. Float16 for Tesla T4, V100, Bfloat16 for Ampere+
|
41 |
+
load_in_4bit = True # Use 4bit quantization to reduce memory usage. Can be False.
|
42 |
+
|
43 |
+
model, tokenizer = FastLanguageModel.from_pretrained(
|
44 |
+
model_name = "suyash2739/English_to_Hinglish_lamma_3_8b_instruct",
|
45 |
+
max_seq_length = max_seq_length,
|
46 |
+
dtype = dtype,
|
47 |
+
load_in_4bit = load_in_4bit,
|
48 |
+
)
|
49 |
+
```
|
50 |
+
|
51 |
+
```python
|
52 |
+
prompt = """Translate the input from English to Hinglish to give the response.
|
53 |
+
|
54 |
+
### Input:
|
55 |
+
{}
|
56 |
+
|
57 |
+
### Response:
|
58 |
+
{}"""
|
59 |
+
|
60 |
+
```
|
61 |
+
|
62 |
+
```python
|
63 |
+
|
64 |
+
inputs = tokenizer(
|
65 |
+
[
|
66 |
+
prompt.format(
|
67 |
+
"""This is a fine-tuned Hinglish translation model using Llama 3.""", # input
|
68 |
+
"", # output - leave this blank for generation!
|
69 |
+
)
|
70 |
+
], return_tensors = "pt").to("cuda")
|
71 |
+
|
72 |
+
from transformers import TextStreamer
|
73 |
+
text_streamer = TextStreamer(tokenizer)
|
74 |
+
```
|
75 |
+
|
76 |
+
```python
|
77 |
+
_ = model.generate(**inputs, streamer = text_streamer, max_new_tokens = 2048)
|
78 |
+
## ye ek fine-tuned Hinglish translation model hai jisaka use Llama 3 kiya hai.
|
79 |
+
|
80 |
+
```
|
81 |
+
|
82 |
+
|
83 |
+
|
84 |
# Uploaded model
|
85 |
|
86 |
- **Developed by:** suyash2739
|