waadarsh commited on
Commit
fa1cbe0
·
verified ·
1 Parent(s): c79914f

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +83 -4
README.md CHANGED
@@ -1,7 +1,7 @@
1
  ---
2
  language:
3
  - en
4
- license: apache-2.0
5
  tags:
6
  - text-generation-inference
7
  - transformers
@@ -12,12 +12,91 @@ tags:
12
  base_model: unsloth/llama-3-8b-bnb-4bit
13
  ---
14
 
15
- # Uploaded model
16
 
 
 
17
  - **Developed by:** waadarsh
18
- - **License:** apache-2.0
19
  - **Finetuned from model :** unsloth/llama-3-8b-bnb-4bit
20
 
21
  This llama model was trained 2x faster with [Unsloth](https://github.com/unslothai/unsloth) and Huggingface's TRL library.
22
 
23
- [<img src="https://raw.githubusercontent.com/unslothai/unsloth/main/images/unsloth%20made%20with%20love.png" width="200"/>](https://github.com/unslothai/unsloth)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  language:
3
  - en
4
+ license: llama3
5
  tags:
6
  - text-generation-inference
7
  - transformers
 
12
  base_model: unsloth/llama-3-8b-bnb-4bit
13
  ---
14
 
15
+ ### Model Description
16
 
17
+ - **Developed by:** [Aadarsh Unni Wilson](https://huggingface.co/waadarsh)
18
+ - **License:** https://llama.meta.com/llama3/license/
19
  - **Developed by:** waadarsh
 
20
  - **Finetuned from model :** unsloth/llama-3-8b-bnb-4bit
21
 
22
  This llama model was trained 2x faster with [Unsloth](https://github.com/unslothai/unsloth) and Huggingface's TRL library.
23
 
24
+
25
+ ### Inference
26
+
27
+ ```python
28
+ !pip install "unsloth[colab-new] @ git+https://github.com/unslothai/unsloth.git"
29
+
30
+ from unsloth import FastLanguageModel
31
+ import torch
32
+ max_seq_length = 2048
33
+ dtype = None
34
+ load_in_4bit = False
35
+ model, tokenizer = FastLanguageModel.from_pretrained(
36
+ model_name = "KissanAI/llama3-8b-dhenu-0.1-sft-16bit",
37
+ max_seq_length = max_seq_length,
38
+ dtype = dtype,
39
+ load_in_4bit = load_in_4bit,
40
+ )
41
+
42
+ prompt_template_1 = """
43
+ You are a helpful assistant for customers of nissan magnite. You are given the following input. Please complete the response in a clear and comprehensive way.
44
+ ## Question:
45
+ {}
46
+
47
+ ## Response:
48
+ {}"""
49
+ ```
50
+
51
+ ```python
52
+
53
+ FastLanguageModel.for_inference(model)
54
+ inputs = tokenizer(
55
+ [
56
+ prompt_template_1.format(
57
+ "Tell me about different variants of nissan magnite", #input
58
+ "" # response
59
+ )
60
+ ], return_tensors = "pt").to("cuda")
61
+
62
+ with torch.autocast(device_type="cuda"):
63
+ outputs = model.generate(**inputs, max_new_tokens=256, temperature=0.5, repetition_penalty=1.2, use_cache=False)
64
+
65
+ # Decode the outputs
66
+ tokenizer.batch_decode(outputs)
67
+
68
+ ```
69
+
70
+ ```shell
71
+ Setting `pad_token_id` to `eos_token_id`:128001 for open-end generation.
72
+ ['\nYou are a helpful assistant for customers of nissan magnite. You are given the following input. Please complete the response in a clear and comprehensive way.\n## Question:\nTell me about different variants of nissan magnite\n\n## Response:\nThe Nissan Magnite comes in multiple variants: XE, XL, XV and XV Premium. Each variant has unique features and specifications suited for different needs.<|end_of_text|>']
73
+ ```
74
+
75
+ ```python
76
+
77
+ inputs = tokenizer(
78
+ [
79
+ prompt_template_1.format(
80
+ "What type of infotainment system is available in the Nissan Magnite?", #input
81
+ "" # response
82
+ )
83
+ ], return_tensors = "pt").to("cuda")
84
+
85
+ from transformers import TextStreamer
86
+ text_streamer = TextStreamer(tokenizer)
87
+ _ = model.generate(**inputs, streamer = text_streamer, max_new_tokens = 128)
88
+
89
+ ```
90
+
91
+ ```shell
92
+ Setting `pad_token_id` to `eos_token_id`:128001 for open-end generation.
93
+
94
+ You are a helpful assistant for customers of nissan magnite. You are given the following input. Please complete the response in a clear and comprehensive way.
95
+ ## Question:
96
+ What type of infotainment system is available in the Nissan Magnite?
97
+
98
+ ## Response:
99
+ The Nissan Magnite features an 8-inch touchscreen infotainment system with Android Auto and Apple CarPlay compatibility. It is designed with a user-friendly interface and provides both entertainment and navigation solutions.<|end_of_text|>
100
+ ```
101
+
102
+ [<img src="https://raw.githubusercontent.com/unslothai/unsloth/main/images/unsloth%20made%20with%20love.png" width="200"/>](https://github.com/unslothai/unsloth)