Update README.md
Browse files
README.md
CHANGED
|
@@ -314,6 +314,154 @@ Model Response: Artificial intelligence promises increased efficiency and innova
|
|
| 314 |
Artificial intelligence promises increased efficiency and innovative solutions, but also raises ethical concerns regarding job displacement, privacy, and bias in algorithms. Societies worldwide are grappling with how to regulate and integrate AI responsibly, balancing progress with human values. This calls for a multidisciplinary approach involving policymakers, technologists, ethicists, and the public to shape
|
| 315 |
|
| 316 |
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 317 |
---
|
| 318 |
|
| 319 |
## 📊 Why QLoRA?
|
|
|
|
| 314 |
Artificial intelligence promises increased efficiency and innovative solutions, but also raises ethical concerns regarding job displacement, privacy, and bias in algorithms. Societies worldwide are grappling with how to regulate and integrate AI responsibly, balancing progress with human values. This calls for a multidisciplinary approach involving policymakers, technologists, ethicists, and the public to shape
|
| 315 |
|
| 316 |
```
|
| 317 |
+
|
| 318 |
+
|
| 319 |
+
|
| 320 |
+
```
|
| 321 |
+
python
|
| 322 |
+
# Ensure the base model is in evaluation mode
|
| 323 |
+
base_model.eval()
|
| 324 |
+
|
| 325 |
+
# Function to format prompts consistently with training data
|
| 326 |
+
def format_prompt(instruction, context=None):
|
| 327 |
+
if context:
|
| 328 |
+
return f"Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.\n\n### Instruction:\n{instruction}\n\n### Input:\n{context}\n\n### Response:\n"
|
| 329 |
+
else:
|
| 330 |
+
return f"Below is an instruction that describes a task. Write a response that appropriately completes the request.\n\n### Instruction:\n{instruction}\n\n### Response:\n"
|
| 331 |
+
|
| 332 |
+
# Reuse the test_prompts defined previously
|
| 333 |
+
# (Assuming test_prompts is available from previous execution or defined globally)
|
| 334 |
+
|
| 335 |
+
print("\n--- Generating Responses from BASE MODEL ---\n")
|
| 336 |
+
with torch.no_grad():
|
| 337 |
+
for i, prompt_data in enumerate(test_prompts):
|
| 338 |
+
instruction = prompt_data["instruction"]
|
| 339 |
+
context = prompt_data["context"]
|
| 340 |
+
|
| 341 |
+
formatted_input = format_prompt(instruction, context)
|
| 342 |
+
|
| 343 |
+
# Tokenize the input prompt
|
| 344 |
+
inputs = tokenizer(formatted_input, return_tensors="pt").to(base_model.device)
|
| 345 |
+
|
| 346 |
+
# Generate response using the BASE MODEL
|
| 347 |
+
outputs = base_model.generate(
|
| 348 |
+
**inputs,
|
| 349 |
+
max_new_tokens=150,
|
| 350 |
+
do_sample=True,
|
| 351 |
+
temperature=0.7,
|
| 352 |
+
top_k=50,
|
| 353 |
+
top_p=0.95,
|
| 354 |
+
eos_token_id=tokenizer.eos_token_id,
|
| 355 |
+
pad_token_id=tokenizer.pad_token_id
|
| 356 |
+
)
|
| 357 |
+
|
| 358 |
+
generated_text = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
| 359 |
+
response = generated_text[len(formatted_input):].strip()
|
| 360 |
+
|
| 361 |
+
print(f"### Test Prompt {i+1} (BASE MODEL): ###")
|
| 362 |
+
print(f"Instruction: {instruction}")
|
| 363 |
+
if context:
|
| 364 |
+
print(f"Context: {context}")
|
| 365 |
+
print(f"Base Model Response: {response}\n")
|
| 366 |
+
|
| 367 |
+
|
| 368 |
+
```
|
| 369 |
+
|
| 370 |
+
```
|
| 371 |
+
|
| 372 |
+
--- Generating Responses from BASE MODEL ---
|
| 373 |
+
|
| 374 |
+
### Test Prompt 1 (BASE MODEL): ###
|
| 375 |
+
Instruction: Explain the concept of photosynthesis in simple terms.
|
| 376 |
+
Base Model Response: Photosynthesis is a process that uses sunlight and a photosynthetic pigment called chlorophyll to convert carbon dioxide into organic molecules called carbohydrates. In this process, oxygen is converted to water and carbon dioxide. The oxygen and carbon dioxide are then split into two molecules called O2 and C2. The two molecules are then used to split the water into hydrogen and oxygen. The hydrogen and oxygen are then combined to form glucose, which is the sugar that is used as a source of energy. The process of photosynthesis is extremely important in the life of plants. It allows plants to convert sunlight into energy that can be used to make food. The process of photosynthesis is extremely important to the survival of plants. It allows
|
| 377 |
+
|
| 378 |
+
### Test Prompt 2 (BASE MODEL): ###
|
| 379 |
+
Instruction: What is the capital of France?
|
| 380 |
+
Base Model Response: Paris is the capital of France.
|
| 381 |
+
|
| 382 |
+
If you are traveling to France, you should be aware of the following facts:
|
| 383 |
+
|
| 384 |
+
1. The French language is spoken on both sides of the Atlantic Ocean.
|
| 385 |
+
2. Paris is a city of over 1 million people.
|
| 386 |
+
3. The capital of France is located in Paris, just south of the city of Lyon.
|
| 387 |
+
4. The French capital is home to the Eiffel Tower, the Grand Tour, the Louvre, the Champs Elysees, the Arc de Triomphe, and the Pont Neuf.
|
| 388 |
+
5. The first French colony was established in the New World in the 16th century.
|
| 389 |
+
6. The French Riviera is a beautiful and historic
|
| 390 |
+
|
| 391 |
+
### Test Prompt 3 (BASE MODEL): ###
|
| 392 |
+
Instruction: Summarize the main idea of the following text:
|
| 393 |
+
Context: The quick brown fox jumps over the lazy dog. This sentence is often used to display all letters of the English alphabet, making it a pangram.
|
| 394 |
+
Base Model Response: The quick brown fox jumps over the lazy dog. This sentence is often used to display all letters of the English alphabet, making it a pangram.
|
| 395 |
+
|
| 396 |
+
This is an example of a pangram. A pangram is a single-word, single-character word.
|
| 397 |
+
|
| 398 |
+
A pangram is composed of one or more of the following:
|
| 399 |
+
|
| 400 |
+
A pangram consists of only the letters in the English alphabet. The letters are always in the order in which they appear in the sentence.
|
| 401 |
+
|
| 402 |
+
A pangram consists of only the letters in the English alphabet, as in the example.
|
| 403 |
+
|
| 404 |
+
The quick brown fox jumps over the lazy dog. This sentence is often used to display all letters of the English
|
| 405 |
+
|
| 406 |
+
### Test Prompt 4 (BASE MODEL): ###
|
| 407 |
+
Instruction: List three benefits of regular exercise.
|
| 408 |
+
Base Model Response: - Improve metabolism
|
| 409 |
+
- Increase muscle mass
|
| 410 |
+
- Improve your immune system
|
| 411 |
+
- Increase your overall energy levels
|
| 412 |
+
- Improve your mood
|
| 413 |
+
- Reduce stress
|
| 414 |
+
- Improve your sleep
|
| 415 |
+
- Improve your memory
|
| 416 |
+
- Reduce your risk of chronic health problems
|
| 417 |
+
- Increase your longevity
|
| 418 |
+
- Lower your blood pressure
|
| 419 |
+
- Lower your cholesterol
|
| 420 |
+
- Increase your energy
|
| 421 |
+
- Increase your heart rate
|
| 422 |
+
- Improve your cognitive function
|
| 423 |
+
- Improve your ability to concentrate
|
| 424 |
+
- Improve your memory
|
| 425 |
+
- Improve your mood
|
| 426 |
+
- Improve your overall energy levels
|
| 427 |
+
- Improve your sleep
|
| 428 |
+
- Improve your memory
|
| 429 |
+
- Improve your ability to concentrate
|
| 430 |
+
- Improve your cognitive function
|
| 431 |
+
- Improve your memory
|
| 432 |
+
- Improve your ability to concentrate
|
| 433 |
+
- Improve your memory
|
| 434 |
+
-
|
| 435 |
+
|
| 436 |
+
### Test Prompt 5 (BASE MODEL): ###
|
| 437 |
+
Instruction: Write a short, imaginative story about a cat who discovers a secret portal to another dimension under its owner's bed.
|
| 438 |
+
Base Model Response: The cat, who had been living in the home for many years, was so used to being alone that when he was moved to a new room, he didn't know what to do. In the middle of the night, he heard the sound of something moving under the bed. When he looked under the bed, he saw a strange creature in the middle of the bed. He thought it was a ghost and was scared. He tried to get out of the bed, but his feet were too big. He tried to run, but he got stuck on the floor. He thought he would die if he didn't get out of the bed. So, he got out of bed and he ran around the room, looking for a way to get out
|
| 439 |
+
|
| 440 |
+
### Test Prompt 6 (BASE MODEL): ###
|
| 441 |
+
Instruction: If a train leaves New York at 10 AM traveling at 60 mph and another train leaves Chicago at 11 AM traveling at 50 mph, and the cities are 800 miles apart, at what time do they meet? (Assume they are traveling towards each other on the same track).
|
| 442 |
+
Base Model Response: The train from New York will arrive at the Chicago station around 10 AM. The train from Chicago will arrive at the New York station around 11 AM. At that time, the trains will meet. The exact time will depend on the speed of the train. If the speed of the train is 60 mph, then the time of arrival will be 11:30 AM. If the speed of the train is 50 mph, then the time of arrival will be 10:30 AM.
|
| 443 |
+
The time of arrival is always the same, regardless of the speed of the train. The only time a train will arrive at the other side of the track is when the speed of the train is zero.
|
| 444 |
+
|
| 445 |
+
The train from New York will arrive at the Chicago
|
| 446 |
+
|
| 447 |
+
### Test Prompt 7 (BASE MODEL): ###
|
| 448 |
+
Instruction: What is the capital of Australia?
|
| 449 |
+
Base Model Response: Sydney, Australia is the capital of Australia. It is also the largest city in Australia. The city is well known for having the tallest bridge in the world. The city is also home to the Australian Museum which is one of the world’s best museums. It is located in the suburb of Manly, a suburb in the city of Bondi Junction. The city is about 20 minutes away from the Gold Coast. It has a large beach and also has a famous surf board. The city has a lot of shopping opportunities like the famous shopping district of Bondi Junction. The city also has a big number of famous bars and restaurants. The city is a great place to visit when you are in Australia. It has many
|
| 450 |
+
|
| 451 |
+
### Test Prompt 8 (BASE MODEL): ###
|
| 452 |
+
Instruction: Explain the difference between supervised and unsupervised learning in machine learning, and provide an example of when each would be used.
|
| 453 |
+
Base Model Response: In supervised learning, a model is trained with labeled data and then used to predict new data. In unsupervised learning, data is not labeled but is learned based on some information. For example, if we are given a large dataset of customers and we have the ability to predict whether a customer is a good customer, we can use this information to train a model to predict whether a customer is a good customer. In addition, data from the training set can be used to determine which customers are good customers, and so on.
|
| 454 |
+
|
| 455 |
+
In supervised learning, the model is trained on a labeled dataset and then used to predict new data. In unsupervised learning, the data is not labeled but is learned based on some information. For example, if we
|
| 456 |
+
|
| 457 |
+
### Test Prompt 9 (BASE MODEL): ###
|
| 458 |
+
Instruction: Summarize the following passage:
|
| 459 |
+
Context: The advent of artificial intelligence has brought forth a new era of technological advancement, impacting various sectors from healthcare to finance. While AI promises increased efficiency and innovative solutions, it also raises ethical concerns regarding job displacement, privacy, and bias in algorithms. Societies worldwide are grappling with how to regulate and integrate AI responsibly, balancing progress with human values. This calls for a multidisciplinary approach involving policymakers, technologists, ethicists, and the public to shape a future where AI serves humanity's best interests.
|
| 460 |
+
Base Model Response: Artificial intelligence promises increased efficiency and innovative solutions, but also raises ethical concerns regarding job displacement, privacy, and bias in algorithms. Societies worldwide are grappling with how to regulate and integrate AI responsibly, balancing progress with human values. This calls for a multidisciplinary approach involving policymakers, technologists, ethicists, and the public to shape a future where AI serves humanity's best interests.
|
| 461 |
+
|
| 462 |
+
The main challenge for society today is to balance progress with human values, and AI is a major part of this effort. We will never be able to fully harness the potential of AI, and its applications will always be subject to the same ethical issues that we face today. AI is already changing the way we do things. Its impact is already being
|
| 463 |
+
|
| 464 |
+
```
|
| 465 |
---
|
| 466 |
|
| 467 |
## 📊 Why QLoRA?
|