import os ! apt-get update -qq > /dev/null # Install java ! apt-get install -y openjdk-8-jdk-headless -qq > /dev/null os.environ["JAVA_HOME"] = "/usr/lib/jvm/java-8-openjdk-amd64" os.environ["PATH"] = os.environ["JAVA_HOME"] + "/bin:" + os.environ["PATH"] ! pip install nlu pyspark==2.4.7 import nlu t5 = nlu.load('en.t5.base') t5.print_info() # Set the task on T5 t5['t5'].setTask('cola sentence: ') # define Data data = ['Anna and Mike is going skiing and they is liked is','Anna and Mike like to dance'] #Predict on text data with T5 t5.predict(data) # Set the task on T5 t5['t5'].setTask('rte sentence: ') data = [ 'Recent report say Peter makes he alot of money, he earned 10 million USD each year for the last 5 years. sentence2: Peter is a millionare', 'Recent report say Peter makes he alot of money, he earned 10 million USD each year for the last 5 years. sentence2: Peter is a poor man'] #Predict on text data with T5 t5.predict(data) # Set the task on T5 t5['t5'].setTask('mnli ') # define Data, add additional tags between sentences data = [ ''' hypothesis: At 8:34, the Boston Center controller received a third, transmission from American 11. premise: The Boston Center controller got a third transmission from American 11. ''' , ''' hypothesis: Recent report say Johnny makes he alot of money, he earned 10 million USD each year for the last 5 years. premise: Johnny is a poor man. ''' ] # Set the task on T5 #Predict on text data with T5 t5.predict(data) # Set the task on T5 t5['t5'].setTask('mrpc ') # define Data, add additional tags between sentences data = [ ''' sentence1: We acted because we saw the existing evidence in a new light , through the prism of our experience on 11 September , " Rumsfeld said . sentence2: Rather , the US acted because the administration saw " existing evidence in a new light , through the prism of our experience on September 11 " ''' , ''' sentence1: I like to eat peanutbutter for breakfast sentence2: I like to play football. ''' ] #Predict on text data with T5 t5.predict(data) # Set the task on T5 t5['t5'].setTask('QNLI ') # define Data, add additional tags between sentences data = [ ''' question: Where did Jebe die? sentence: Ghenkis Khan recalled Subtai back to Mongolia soon afterwards, and Jebe died on the road back to Samarkand, ''' , ''' question: What does Steve like to eat? sentence: Steve watches TV all day ''' ] #Predict on text data with T5 t5.predict(data) # Set the task on T5 t5['t5'].setTask('qqp ') # define Data, add additional tags between sentences data = [ ''' question1: What attributes would have made you highly desirable in ancient Rome? question2: How I GET OPPERTINUTY TO JOIN IT COMPANY AS A FRESHER?' ''' , ''' question1: What was it like in Ancient rome? question2: What was Ancient rome like? ''' ] #Predict on text data with T5 t5.predict(data) # Set the task on T5 t5['t5'].setTask('sst2 sentence: ') # define Data, add additional tags between sentences data = [ ''' I really hated that movie''', ''' it confirms fincher ’s status as a film maker who artfully bends technical know-how to the service of psychological insight''' ] #Predict on text data with T5 t5.predict(data) # Set the task on T5 t5['t5'].setTask('stsb ') # define Data, add additional tags between sentences data = [ ''' sentence1: What attributes would have made you highly desirable in ancient Rome? sentence2: How I GET OPPERTINUTY TO JOIN IT COMPANY AS A FRESHER?' ''' , ''' sentence1: What was it like in Ancient rome? sentence2: What was Ancient rome like? ''', ''' sentence1: What was live like as a King in Ancient Rome?? sentence2: What was Ancient rome like? ''' ] #Predict on text data with T5 t5.predict(data) # Set the task on T5 t5['t5'].setTask('cb ') # define Data, add additional tags between sentences data = [ ''' hypothesis: Recent report say Johnny makes he alot of money, he earned 10 million USD each year for the last 5 years. premise: Johnny is a poor man. '''] #Predict on text data with T5 t5.predict(data) # Set the task on T5 t5['t5'].setTask('copa ') # define Data, add additional tags between sentences data = [ ''' choice1: He fell off the ladder choice2: He climbed up the lader premise: The man lost his balance on the ladder question: effect '''] #Predict on text data with T5 t5.predict(data) # Set the task on T5 t5['t5'].setTask('multirc ') # define Data, add additional tags between sentences data = [ ''' questions: Why was Joey surprised the morning he woke up for breakfast? answer: There was a T-REX in his garden. paragraph: Sent 1: Once upon a time, there was a squirrel named Joey. Sent 2: Joey loved to go outside and play with his cousin Jimmy. Sent 3: Joey and Jimmy played silly games together, and were always laughing. Sent 4: One day, Joey and Jimmy went swimming together 50 at their Aunt Julie’s pond. Sent 5: Joey woke up early in the morning to eat some food before they left. Sent 6: He couldn’t find anything to eat except for pie! Sent 7: Usually, Joey would eat cereal, fruit (a pear), or oatmeal for breakfast. Sent 8: After he ate, he and Jimmy went to the pond. Sent 9: On their way there they saw their friend Jack Rabbit. Sent 10: They dove into the water and swam for several hours. Sent 11: The sun was out, but the breeze was cold. Sent 12: Joey and Jimmy got out of the water and started walking home. Sent 13: Their fur was wet, and the breeze chilled them. Sent 14: When they got home, they dried off, and Jimmy put on his favorite purple shirt. Sent 15: Joey put on a blue shirt with red and green dots. Sent 16: The two squirrels ate some food that Joey’s mom, Jasmine, made and went off to bed. ''', ''' questions: Why was Joey surprised the morning he woke up for breakfast? answer: There was only pie for breakfast. paragraph: Sent 1: Once upon a time, there was a squirrel named Joey. Sent 2: Joey loved to go outside and play with his cousin Jimmy. Sent 3: Joey and Jimmy played silly games together, and were always laughing. Sent 4: One day, Joey and Jimmy went swimming together 50 at their Aunt Julie’s pond. Sent 5: Joey woke up early in the morning to eat some food before they left. Sent 6: He couldn’t find anything to eat except for pie! Sent 7: Usually, Joey would eat cereal, fruit (a pear), or oatmeal for breakfast. Sent 8: After he ate, he and Jimmy went to the pond. Sent 9: On their way there they saw their friend Jack Rabbit. Sent 10: They dove into the water and swam for several hours. Sent 11: The sun was out, but the breeze was cold. Sent 12: Joey and Jimmy got out of the water and started walking home. Sent 13: Their fur was wet, and the breeze chilled them. Sent 14: When they got home, they dried off, and Jimmy put on his favorite purple shirt. Sent 15: Joey put on a blue shirt with red and green dots. Sent 16: The two squirrels ate some food that Joey’s mom, Jasmine, made and went off to bed. ''' ] #Predict on text data with T5 t5.predict(data) # Set the task on T5 t5['t5'].setTask('wic ') # define Data, add additional tags between sentences data = [ ''' pos: sentence1: The expanded window will give us time to catch the thieves. sentence2: You have a two-hour window of turning in your homework. word : window ''',] #Predict on text data with T5 t5.predict(data) # Does not work yet 100% correct # Set the task on T5 t5['t5'].setTask('wsc ') # define Data, add additional tags between sentences data = ['''The stable was very roomy, with four good stalls; a large swinging window opened into the yard , which made *it* pleasant and airy.'''] #Predict on text data with T5 t5.predict(data) # Set the task on T5 t5['t5'].setTask('summarize ') # define Data, add additional tags between sentences data = [ ''' The belgian duo took to the dance floor on monday night with some friends . manchester united face newcastle in the premier league on wednesday . red devils will be looking for just their second league away win in seven . louis van gaal’s side currently sit two points clear of liverpool in fourth . ''', ''' Calculus, originally called infinitesimal calculus or "the calculus of infinitesimals", is the mathematical study of continuous change, in the same way that geometry is the study of shape and algebra is the study of generalizations of arithmetic operations. It has two major branches, differential calculus and integral calculus; the former concerns instantaneous rates of change, and the slopes of curves, while integral calculus concerns accumulation of quantities, and areas under or between curves. These two branches are related to each other by the fundamental theorem of calculus, and they make use of the fundamental notions of convergence of infinite sequences and infinite series to a well-defined limit.[1] Infinitesimal calculus was developed independently in the late 17th century by Isaac Newton and Gottfried Wilhelm Leibniz.[2][3] Today, calculus has widespread uses in science, engineering, and economics.[4] In mathematics education, calculus denotes courses of elementary mathematical analysis, which are mainly devoted to the study of functions and limits. The word calculus (plural calculi) is a Latin word, meaning originally "small pebble" (this meaning is kept in medicine – see Calculus (medicine)). Because such pebbles were used for calculation, the meaning of the word has evolved and today usually means a method of computation. It is therefore used for naming specific methods of calculation and related theories, such as propositional calculus, Ricci calculus, calculus of variations, lambda calculus, and process calculus.''' ] #Predict on text data with T5 t5.predict(data) # Set the task on T5 t5['t5'].setTask('question ') # define Data, add additional tags between sentences data = [''' What does increased oxygen concentrations in the patient’s lungs displace? context: Hyperbaric (high-pressure) medicine uses special oxygen chambers to increase the partial pressure of O 2 around the patient and, when needed, the medical staff. Carbon monoxide poisoning, gas gangrene, and decompression sickness (the ’bends’) are sometimes treated using these devices. Increased O 2 concentration in the lungs helps to displace carbon monoxide from the heme group of hemoglobin. Oxygen gas is poisonous to the anaerobic bacteria that cause gas gangrene, so increasing its partial pressure helps kill them. Decompression sickness occurs in divers who decompress too quickly after a dive, resulting in bubbles of inert gas, mostly nitrogen and helium, forming in their blood. Increasing the pressure of O 2 as soon as possible is part of the treatment. '''] #Predict on text data with T5 t5.predict(data) # Set the task on T5 t5['t5'].setTask('translate English to German: ') # define Data, add additional tags between sentences sentences = ['''I like sausage and Tea for breakfast with potatoes'''] #Predict on text data with T5 t5.predict(data) # Set the task on T5 t5['t5'].setTask('translate English to French: ') # define Data, add additional tags between sentences data = ['''I like sausage and Tea for breakfast with potatoes'''] #Predict on text data with T5 t5.predict(data) # Set the task on T5 t5['t5'].setTask('translate English to Romanian: ') # define Data, add additional tags between sentences data = [ '''I like sausage and Tea for breakfast with potatoes'''] #Predict on text data with T5 t5.predict(data)