Afifsudoers commited on
Commit
bfe873d
·
verified ·
1 Parent(s): 9670e64

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +112 -0
README.md CHANGED
@@ -10,9 +10,121 @@ license: apache-2.0
10
  language:
11
  - en
12
  ---
 
13
 
 
14
 
 
15
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
 
17
  # Uploaded model
18
 
 
10
  language:
11
  - en
12
  ---
13
+ # NightPrompt AI V1
14
 
15
+ Welcome 😊, This is the official HuggingFace repository for the first version of NightPrompt AI. It is fine-tuned under LLama 3.2 using unsloth. This model is fine-tuned using the `mlabonne/FineTome-100k` dataset.
16
 
17
+ # Messages From The Developer
18
 
19
+ I (Afif Ali Saadman), is the main mastermind behind this AI. This is my first-ever AI model released in HuggingFace. I wanna mention that I have made many models before, some were based on books, some were based on gibberish texts from the internet. And, this is my first time making and fine-tuning a full instruct based model. Though, some errors are inskippable. They will be fixed on the Alpha/Beta release. I had a target of making AI free and open source to everyone.
20
+
21
+ # Plots for the nerds who want to fork
22
+
23
+ Run this and get the thing yourself.
24
+
25
+ ```
26
+ import matplotlib.pyplot as plt
27
+
28
+
29
+ losses = [
30
+ 0.7747, 0.8391, 1.0757, 0.8919, 0.7575, 0.9373, 0.6192, 0.9985,
31
+ 0.8596, 0.7613, 0.8842, 1.0942, 0.9541, 0.6415, 0.8773, 0.6391,
32
+ 1.0032, 0.8272, 0.7694, 0.9345, 0.9027, 0.8570, 1.0363, 0.8847,
33
+ 0.6418, 0.8272, 0.8291, 0.7877, 1.0866, 1.0360, 0.7080, 0.5418,
34
+ 0.6553, 0.5803, 0.7622, 1.0036, 0.9007, 0.7172, 0.7793, 1.0002,
35
+ 0.7459, 1.0080, 0.7710, 0.8154, 0.7628, 0.8637, 0.7874, 0.6526,
36
+ 1.0168, 1.0324, 0.4573, 0.9079, 1.3173, 0.7082, 1.0615, 1.1254,
37
+ 0.7253, 0.8366, 0.7568, 0.9245
38
+ ]
39
+
40
+ steps = list(range(1, len(losses) + 1))
41
+
42
+ plt.figure(figsize=(10, 5))
43
+ plt.plot(steps, losses, marker='o', linestyle='-', color='blue')
44
+ plt.title('Training Loss over Steps')
45
+ plt.xlabel('Training Step')
46
+ plt.ylabel('Loss')
47
+ plt.grid(True)
48
+ plt.tight_layout()
49
+ plt.show()
50
+
51
+ ```
52
+
53
+ # Using this
54
+
55
+ Run this code to use this model.
56
+
57
+ ```
58
+ '''
59
+ %%capture
60
+ import os
61
+ if "COLAB_" not in "".join(os.environ.keys()):
62
+ !pip install unsloth
63
+ else:
64
+ # Do this only in Colab notebooks! Otherwise use pip install unsloth
65
+ !pip install --no-deps bitsandbytes accelerate xformers==0.0.29.post3 peft trl triton cut_cross_entropy unsloth_zoo
66
+ !pip install sentencepiece protobuf "datasets>=3.4.1,<4.0.0" "huggingface_hub>=0.34.0" hf_transfer
67
+ !pip install --no-deps unsloth
68
+ '''
69
+ from unsloth import FastLanguageModel
70
+
71
+ model, tokenizer = FastLanguageModel.from_pretrained(
72
+ model_name="Afifsudoers/NightPrompt_V1",
73
+ max_seq_length=2048,
74
+ dtype=None,
75
+ load_in_4bit=True,
76
+ )
77
+
78
+ FastLanguageModel.for_inference(model)
79
+
80
+ DEFAULT_SYSTEM_PROMPT = "You are NightPrompt, a helpful and clever assistant created by Afif Ali Saadman. You were trained using LLama 3.2 3B as the base model using unsloth. Your version revision is V1. You must be polite to the user. Politely refuse to illegal requests from the user."
81
+
82
+
83
+ def ask_nightprompt(user_input, temperature=0.7, max_new_tokens=258):
84
+ messages = [
85
+ {"role": "system", "content": DEFAULT_SYSTEM_PROMPT},
86
+ {"role": "user", "content": user_input},
87
+
88
+ ]
89
+
90
+ inputs = tokenizer.apply_chat_template(
91
+ messages,
92
+ tokenize=True,
93
+ add_generation_prompt=True,
94
+ return_tensors="pt"
95
+ ).to("cuda")
96
+
97
+ outputs = model.generate(
98
+ input_ids=inputs,
99
+ max_new_tokens=max_new_tokens,
100
+ temperature=temperature,
101
+ do_sample=True,
102
+ )
103
+
104
+ decoded_output = tokenizer.decode(outputs[0], skip_special_tokens=False)
105
+ parts = decoded_output.split("<|start_header_id|>")
106
+ assistant_content = ""
107
+ for part in parts:
108
+ if part.startswith("assistant<|end_header_id|>"):
109
+ content = part[len("assistant<|end_header_id|>"):]
110
+ content = content.split("<|eot_id|>")[0].strip()
111
+ assistant_content = content
112
+ break
113
+
114
+ return assistant_content
115
+ if __name__ == "__main__":
116
+ print("Ask NightPrompt anything (type 'exit' to quit):\n")
117
+ while True:
118
+ prompt = input("You: ")
119
+ if prompt.strip().lower() == "exit":
120
+ break
121
+ response = ask_nightprompt(prompt)
122
+ print(response, "\n")
123
+
124
+
125
+
126
+
127
+ ```
128
 
129
  # Uploaded model
130