Update README.md
Browse files
README.md
CHANGED
|
@@ -9,6 +9,9 @@ tags:
|
|
| 9 |
- unsloth
|
| 10 |
- qwen2
|
| 11 |
- trl
|
|
|
|
|
|
|
|
|
|
| 12 |
---
|
| 13 |
|
| 14 |
# Uploaded model
|
|
@@ -20,3 +23,53 @@ tags:
|
|
| 20 |
This qwen2 model was trained 2x faster with [Unsloth](https://github.com/unslothai/unsloth) and Huggingface's TRL library.
|
| 21 |
|
| 22 |
[<img src="https://raw.githubusercontent.com/unslothai/unsloth/main/images/unsloth%20made%20with%20love.png" width="200"/>](https://github.com/unslothai/unsloth)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
- unsloth
|
| 10 |
- qwen2
|
| 11 |
- trl
|
| 12 |
+
datasets:
|
| 13 |
+
- lightontech/tech-viet-translation
|
| 14 |
+
pipeline_tag: text-generation
|
| 15 |
---
|
| 16 |
|
| 17 |
# Uploaded model
|
|
|
|
| 23 |
This qwen2 model was trained 2x faster with [Unsloth](https://github.com/unslothai/unsloth) and Huggingface's TRL library.
|
| 24 |
|
| 25 |
[<img src="https://raw.githubusercontent.com/unslothai/unsloth/main/images/unsloth%20made%20with%20love.png" width="200"/>](https://github.com/unslothai/unsloth)
|
| 26 |
+
|
| 27 |
+
To use GGUF format for Llama.cpp or running in LM Studio, Jan and other local software, please refer to [lightontech/SeaLightSum3_GGUF](https://huggingface.co/lightontech/SeaLightSum3_GGUF)
|
| 28 |
+
|
| 29 |
+
# How to use
|
| 30 |
+
|
| 31 |
+
Install unsloth
|
| 32 |
+
|
| 33 |
+
This sample use unsloth for colab, you may switch to unsloth only if you want
|
| 34 |
+
|
| 35 |
+
```
|
| 36 |
+
pip install "unsloth[colab-new] @ git+https://github.com/unslothai/unsloth.git"
|
| 37 |
+
```
|
| 38 |
+
|
| 39 |
+
```
|
| 40 |
+
alpaca_prompt = """Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
|
| 41 |
+
|
| 42 |
+
### Instruction:
|
| 43 |
+
{}
|
| 44 |
+
|
| 45 |
+
### Input:
|
| 46 |
+
{}
|
| 47 |
+
|
| 48 |
+
### Response:
|
| 49 |
+
{}"""
|
| 50 |
+
|
| 51 |
+
if True:
|
| 52 |
+
from unsloth import FastLanguageModel
|
| 53 |
+
model, tokenizer = FastLanguageModel.from_pretrained(
|
| 54 |
+
model_name = "lightontech/SeaLightSum3-Adapter", # YOUR MODEL YOU USED FOR TRAINING
|
| 55 |
+
max_seq_length = max_seq_length,
|
| 56 |
+
dtype = dtype,
|
| 57 |
+
load_in_4bit = load_in_4bit,
|
| 58 |
+
)
|
| 59 |
+
FastLanguageModel.for_inference(model) # Unsloth has 2x faster inference!
|
| 60 |
+
|
| 61 |
+
# alpaca_prompt = You MUST copy from above!
|
| 62 |
+
FastLanguageModel.for_inference(model) # Unsloth has 2x faster inference!
|
| 63 |
+
inputs = tokenizer(
|
| 64 |
+
[
|
| 65 |
+
alpaca_prompt.format(
|
| 66 |
+
"Dịch đoạn văn sau sang tiếng Việt:\nOnce you have trained a model using either the SFTTrainer, PPOTrainer, or DPOTrainer, you will have a fine-tuned model that can be used for text generation. In this section, we’ll walk through the process of loading the fine-tuned model and generating text. If you need to run an inference server with the trained model, you can explore libraries such as text-generation-inference.", # instruction
|
| 67 |
+
"", # 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 |
+
_ = model.generate(**inputs, streamer = text_streamer, max_new_tokens = 1000)
|
| 75 |
+
```
|