Views
No views yet
<|user|>\nQuestion <|end|>\n<|assistant|><|user|>
How to explain Internet for a medieval knight?<|end|>
<|assistant|><|user|>
I am going to Paris, what should I see?<|end|>
<|assistant|>
Paris, the capital of France, is known for its stunning architecture, art museums, historical landmarks, and romantic atmosphere. Here are some of the top attractions to see in Paris:\n\n1. The Eiffel Tower: The iconic Eiffel Tower is one of the most recognizable landmarks in the world and offers breathtaking views of the city.\n2. The Louvre Museum: The Louvre is one of the world's largest and most famous museums, housing an impressive collection of art and artifacts, including the Mona Lisa.\n3. Notre-Dame Cathedral: This beautiful cathedral is one of the most famous landmarks in Paris and is known for its Gothic architecture and stunning stained glass windows.\n\nThese are just a few of the many attractions that Paris has to offer. With so much to see and do, it's no wonder that Paris is one of the most popular tourist destinations in the world."<|end|>
<|user|>
What is so great about #1?<|end|>
<|assistant|>PEFT config was used during training:1################################################################################
2# LoRA parameters
3################################################################################
4# LoRA attention dimension
5lora_r = 16
6# Alpha parameter for LoRA scaling
7lora_alpha = 16
8# Dropout probability for LoRA layers
9lora_dropout = 0.05
10# Modules
11target_modules= ['k_proj', 'q_proj', 'v_proj', 'o_proj', "gate_proj", "down_proj", "up_proj"]1 evaluation_strategy="steps",
2 do_eval=True,
3 optim="adamw_torch",
4 per_device_train_batch_size=8,
5 gradient_accumulation_steps=4,
6 per_device_eval_batch_size=8,
7 log_level="debug",
8 save_strategy="epoch",
9 logging_steps=100,
10 learning_rate=1e-4,
11 fp16 = not torch.cuda.is_bf16_supported(),
12 bf16 = torch.cuda.is_bf16_supported(),
13 eval_steps=100,
14 num_train_epochs=3,
15 warmup_ratio=0.1,
16 lr_scheduler_type="linear",
17 report_to="wandb",1Rouge 1 Mean: 56.65322508234244
2Rouge 2 Mean: 37.547274096577084
3Rouge L Mean: 51.08407579855678
4Rouge Lsum Mean: 56.256016384803075
51import torch
2from transformers import AutoModelForCausalLM, AutoTokenizer
3
4model_id = "edumunozsala/phi3-mini-python-code-20k"
5
6tokenizer = AutoTokenizer.from_pretrained(hf_model_repo,trust_remote_code=True)
7model = AutoModelForCausalLM.from_pretrained(hf_model_repo, trust_remote_code=True, torch_dtype="auto", device_map="cuda")
8
9
10instruction="Create an algorithm in Python to sort an array of numbers."
11input="[9, 3, 5, 1, 6]"
12
13prompt = f"""### Instruction:
14Below is an instruction that describes a task. Write a response that appropriately completes the request.
15
16### Instruction:
17{instruction}
18
19### Input:
20{input}
21
22### Output:
23"""
24
25pipe = pipeline("text-generation", model=model, tokenizer=tokenizer)
26
27# Function to execute inference on a prompt
28def test_inference(prompt):
29 prompt = pipe.tokenizer.apply_chat_template([{"role": "user", "content": prompt}], tokenize=False, add_generation_prompt=True)
30 outputs = pipe(prompt, max_new_tokens=256, do_sample=True, num_beams=1, temperature=0.3, top_k=50, top_p=0.95,
31 max_time= 180) #, eos_token_id=eos_token)
32 return outputs[0]['generated_text'][len(prompt):].strip()
33
34
35test_inference(prompt)
36@misc {edumunozsala_2023,
author = { {Eduardo Muñoz} },
title = { phi3-mini-python-code-20k },
year = 2024,
url = { https://huggingface.co/edumunozsala/phi3-mini-python-code-20k },
publisher = { Hugging Face }
}