
å°ããã®ã«ãããLLMãPhi-1.5ãã詊ããŠã¿ã
Microsoft ãããªãªãŒã¹ããã LLMãPhi-1.5ãã詊ããŠã¿ãŸãããæšä»ã® LLM ã®äžã§ã¯ 1.5B ãã©ã¡ãŒã¿ãŒãšå°ããã«ãé¢ãããã
åçš®ãã³ãããŒã¯ã«é¢ããŠã¯ããªãé«ãæ§èœã瀺ããŠããŸããä»åã¯ãã®ã¢ãã«ã䜿ã£ãŠã¿ãããšæããŸãã
ïŒè±èªã®ã¿ã®ã¢ãã«ã ã£ãã®ã§ã詊ããŠããå
容ããããã¥ãããŠç³ãèš³ãªãã§ãâŠïŒ
Huggingface: https://huggingface.co/microsoft/phi-1_5
ä»å㯠Huggingface ã«ã¢ãããããŠããã¢ãã«ã䜿ããããšæããŸãã
ã¢ãã«ã«ãŒããèŠããšãinstruction ãã¥ãŒãã³ã°ã RLHF ãªã©ã®ãã¬ãŒãã³ã°ã¯ããŠããªããšæžããŠãããŸããã
We did not fine-tune phi-1.5 either for instruction following or through reinforcement learning from human feedback
çæã«ã¯äžèšã® 3 çš®é¡ã®ãã©ãŒããããæšå¥šãããŠããŸããåç §
Code ãã©ãŒããã
QA ãã©ãŒããã
Chat ãã©ãŒããã
Colab ã§è©ŠããŠã¿ã
Colab ã§è©ŠããŠã¿ãŸãããŸãã¯ç°å¢ãã»ããã¢ããããŸãã
!pip install transformers accelerate einops -qã¢ãã«ã®ããŒãã
# Use a pipeline as a high-level helper
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
torch.set_default_device('cuda')
model = AutoModelForCausalLM.from_pretrained("microsoft/phi-1_5", trust_remote_code=True, torch_dtype="auto")
tokenizer = AutoTokenizer.from_pretrained("microsoft/phi-1_5", trust_remote_code=True, torch_dtype="auto")
print(f"Vocab size: {tokenizer.vocab_size}")
print(f"Model Parameter Count: {model.num_parameters():,.0f}")Vocab size: 50257
Model Parameter Count: 1,418,270,720Vocab size 50257ã®ããŒã¯ãã€ã¶ãŒã䜿ã£ãã1.4B ãã©ã¡ãŒã¿ãŒã®ã¢ãã«ã§ãã
Codeãã©ãŒããã
ãŸã㯠Huggingface ã®ã¢ãã«ã«ãŒãã«ãããµã³ãã«ã詊ããŠã¿ãŸããCode ãã©ãŒãããã§ã¯ã€ã³ããããšããŠé¢æ°åãšé¢æ°ã«è¡ã£ãŠã»ããããšãã³ã¡ã³ãã§æž¡ããã©ãŒãããã®ããã§ãã
inputs = tokenizer('''```python
def print_prime(n):
"""
Print all primes between 1 and n
"""''', return_tensors="pt", return_attention_mask=False)
outputs = model.generate(**inputs, max_length=200)
text = tokenizer.batch_decode(outputs)[0]
print(text) \```python
def print_prime(n):
"""
Print all primes between 1 and n
"""
primes = []
for num in range(2, n+1):
is_prime = True
for i in range(2, int(num**0.5)+1):
if num % i == 0:
is_prime = False
break
if is_prime:
primes.append(num)
print(primes)
print_prime(20)
\```
## Exercises
1. Write a Python function that takes a list of numbers and returns the sum of all even numbers in the list.
\```python
def sum_even(numbers):
"""
Returns the sum of all even numbers in the list
"""
return sum(num for num in numbers ifã±ã£ãšèŠãã£ãŠãããªã®ã§å®è¡ããŠã¿ãŸãã
def print_prime(n):
"""
Print all primes between 1 and n
"""
primes = []
for num in range(2, n+1):
is_prime = True
for i in range(2, int(num**0.5)+1):
if num % i == 0:
is_prime = False
break
if is_prime:
primes.append(num)
print(primes)
print_prime(20)[2, 3, 5, 7, 11, 13, 17, 19]ã¡ãããšå®è¡ã§ããŸããã
QA ãã©ãŒããã
次㫠QA ãã©ãŒãããã詊ããŠã¿ãŸãã
QA ãã©ãŒãããã¯è³ªåãšåçã®ãã¢ãäžãããã©ãŒãããã§ãã質åã«å¯ŸããŠåçãçæããããšãã§ããŸãã
ã€ã³ãããã¯äžèšã®ãããªãã¿ãŒã³ã§ãã
What is the meaning of life?
Answer:What is the meaning of life?
Answer: The meaning of life is a philosophical question that has puzzled humans for centuries.
Exercise 2:
What is the difference between a belief and a fact?
Answer: A belief is something that someone thinks is true, while a fact is something that is proven to be true.
Exercise 3:
What is the difference between a value and a belief?
Answer: A value is something that someone thinks is important, while a belief is something that someone thinks is true.
Exercise 4:
What is the difference between a right and a responsibility?
Answer: A right is something that someone is entitled to, while a responsibility is something that someone is expected to do.
Exercise 5:
What is the difference between a good and a bad thing?
Answer: A good thing is something that is beneficial or helpful, while a bad thing is something that is harmful or detrimental.
<|endoftext|>次ã®è³ªåã¯çµæ§é£ããããªè³ªåãGPT-4ã«çæããŠããããŸããã質åããŠã¿ãŸãã
How can multi-armed bandit algorithms be integrated into a growth marketing strategy to optimize user engagement?
Answer:How can multi-armed bandit algorithms be integrated into a growth marketing strategy to optimize user engagement?
Answer: By using multi-armed bandit algorithms, marketers can analyze user behavior and preferences to create personalized content that resonates with their target audience. This can lead to increased engagement, higher conversion rates, and ultimately, better business outcomes.
Exercise 5:
Exercise: Give an example of how multi-armed bandit algorithms can be used in a real-world scenario.
Answer: Imagine a company that wants to improve its website's conversion rate. By using multi-armed bandit algorithms, they can analyze user behavior, such as the time spent on the website, the pages visited, and the actions taken. This data can then be used to optimize the website's layout, content, and user experience, ultimately leading to a higher conversion rate.
In conclusion, multi-armed bandit algorithms are a powerful tool in the field of machine learning. They allowãããªãã«ééã£ãŠã¯ããªãåçãçæãããŠããããã«èŠããŸããInstruction ãã¥ãŒãã³ã°ãããŠããªãã®ã§çæã¯è³ªåãžã®è§£ç以å€ã«ãçæãããã¿ããã§ããã
Chat ãã©ãŒããã
Chat ãã©ãŒãããã¯å¯Ÿè©±ãçæããããã®ãã©ãŒãããã§ããã€ã³ãããã¯äžèšã®ãã㪠`<åå>: <ã»ãªã>` ã®ãã¿ãŒã³ã§ãã
Alice: Hey Bob, how's it going? Still swamped with that machine learning project?
Bob: Ah, you know how it is. Always in the weeds. But I'm making progress. How about you? Still working on that cloud migration?
Alice: Oh, absolutely. It's like trying to change the wheels on a moving car. By the way, have you looked into using Kubernetes? We've started to implement it, and it's a game-changer for container orchestration.
Bob: Kubernetes, huh? Yeah, I've been hearing a lot about it, especially in our DevOps circles. I've been tinkering with it a bit. It's fascinating, but the learning curve is steep. Any tips?
Alice:Alice: Definitely! It's like learning to ride a bike. You start with the basics, like understanding the different types of pods and how they interact with each other. Once you graspèªç¶ãªæãã§ãã
ãŸãšã
ãŸã Instruction tuning çãããŠããªããããè§Šã£ãŠã¿ãæè§ŠãšããŠã¯ããŸãã¯ãã¬ãŒãã³ã°ããŠãªããŒã®ã¢ãã«ã ãšæããŸããããçæå
容ã¯ããã³ããã«å¯ŸããŠãšãŠãç確ãªå
容ã°ããã§ããã
ãã©ã¡ãŒã¿ãŒã¯ 1.5B ãªã®ã§ä»ã® LLM ãšæ¯ã¹ãŠãã¬ãŒãã³ã°ã³ã¹ãã¯äœãæãããããã§ãããã€ããã¥ãŒãã³ã°ããŠã¿ããã
åãèœåãä¿ã¡ãªããã¢ãã«ãµã€ãºãå°ãããªã£ãŠããŠãŠã倢ãåºãããŸããã
以äžããèªã¿ããã ãããããšãããããŸããå°ãã§ãåèã«ãªãã°ãšæããŸãã
ããä»åã®èšäºã楜ããã§ããã ããã®ã§ããã°ãnoteãš Twitter ã§ãã©ããŒããŠããã ãããšå¬ããã§ãã
å°ããã®ã«ãããLLMãPhi-1.5ãã詊ããŠã¿ãŸããã
â alex @ very GPU-poor𥹠(@alexweberk) September 13, 2023
åãèœåãä¿ã¡ãªããã¢ãã«ãµã€ãºãå°ãããªã£ãŠããŠãŠã倢ãåºãããŸãã#note #LLM #æ©æ¢°åŠç¿https://t.co/mih89j8CRK
ä»å䜿ã£ã Colab:Â
ããšãã
ã¡ãªã¿ã«ããã®ãµã€ãºã«ãããŠãã³ãããŒã¯ã§ãããããã©ãŒãã³ã¹ã®ã¢ãã«ã§ãããTwitter ã§ã®åå¿ã®äžã«ã¯ãã³ãããŒã¯ãã¹ãã®å 容ããªãŒã¯ããŠããŸã£ãŠããã®ã§ã¯ãªãããšçã声ããããŸããã»ã»ã»ãççžãããã«ã
I think Phi-1.5 trained on the benchmarks. Particularly, GSM8K.
â Susan Zhang (@suchenzang) September 12, 2023
ðµð»ââïžð§µ https://t.co/mFuRYqKm78 pic.twitter.com/IeoJ6EhAG2