added all the changes again but this time they are compatible

This commit is contained in:
GravermanDev
2022-12-31 17:18:02 +01:00
parent 528d8d4cf9
commit a1ba434c31
7 changed files with 205 additions and 0 deletions
+19
View File
@@ -0,0 +1,19 @@
# Data Argumentation
(pull request welcome)
## What is data argumentation
Data argumentation is a technique we can use to get better data faster. Using machine learning models analize long
data (like an essay) and compress it into intructions.
## How to contribute
To contribute to data argumentation you can write a short python script that uses a model from huggingface to analize the text.
[Here](https://docs.google.com/document/d/13a188pPvqnlvuVa3e_suVz4YO5s-JWeiOOrpp0odImg/edit) are examples of what you can do
And here are example implementations:
[Idea 3, ](https://colab.research.google.com/drive/1GllCN5PgSYxBxINZsv3A2r0SpdznHlbT?usp=sharing)
[Idea 4](https://colab.research.google.com/drive/1nZx5LRjO61fYprFyqtrwPDLOis6ctR4p#scrollTo=1EE8CriiaCXj)
To contribute simple choose one of many ideas from the document above and implement it.
+7
View File
@@ -0,0 +1,7 @@
# Notebooks
This is a folders with some useful notebooks, all the notebooks have a markdown file with the same name explaining what they do.
## Contributing
Contributing to both notebooks and making new notebooks is very welcome. If you do so, make sure to make a markdown (.md) file to go with your notebook, makes it easier for people to know what your notebook is about.
@@ -0,0 +1,160 @@
{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"provenance": []
},
"kernelspec": {
"name": "python3",
"display_name": "Python 3"
},
"language_info": {
"name": "python"
}
},
"cells": [
{
"cell_type": "code",
"source": [
"!pip install transformers"
],
"metadata": {
"id": "8zsmJ96eaL2w"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "markdown",
"source": [
"Put your essay here, [source of the essay used ](https://https://www.thewisdompost.com/essay/technology-essay/3387#essay-on-technology-for-college-and-university-students-essay-2-750-words)\n",
"\n",
"Saperate paragraphs with one blank line\n",
"(this step is annoying but important)\n"
],
"metadata": {
"id": "Pt6qbTsjW7Kp"
}
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "d_5_BDFNWneB"
},
"outputs": [],
"source": [
"essay = \"\"\"\n",
"We live in a world driven by technology — hardly anyone would argue with you if you said this. Technology, literally meaning the “science of craft”, refers to the collection of techniques, skills, methods, and processes used to produce goods or services or for accomplishing objectives such as scientific investigation. Technology can be embedded in machines enabling them to be used by people even without a detailed knowledge of their inner workings.\n",
"Technological growth is closely linked to the expansion of scientific research and knowledge. In the last 50 years, thanks to the exponential increases in computing power and microchip design and manufacture, there has been unprecedented innovation and technological growth in nearly every field of human endeavour from health and transport to industrial production and education.\n",
"\n",
"It is automotive technology that drives todays electric and hybrid cars, and which will drive tomorrows driverless cars, hover-taxis and space cabs.\n",
"It is technology that drives the ubiquitous mobile phones that you will now find in the hands of even the poorest of the worlds poor. It is technology that creates hybrid seeds that resist inhospitable climatic conditions and difficult terrain, giving high yields in shorter times.\n",
"It is advancing medical technology that makes remote surgery, minimally invasive surgery and life-saving cures using stem cell transplants. Technology puts spacecrafts on asteroids and distant planets and lets us see new worlds. Technology splits atoms, revealing their secrets, and gives us ways to exploit them to create energy, quantum storage for data, and virtual reality games.\n",
"\n",
"There are people who strongly oppose technology and claim that it spells the death of humanity, and that we are approaching the day when machines will rule everything. They refer to fans of technology as techies or sometimes geeks. On the other hand, proponents of technology call these people Luddites, a derogatory name for someone who is opposed to industrialisation, automation, computerisation and new technologies in general.\n",
"Is this true? Is technology really a curse disguised as a blessing? Many believe that the convergence of biotechnology and AI might be the most consequential development of all.\n",
"\n",
"In the last five decades, two areas in particular have grown faster than the rest, powered by research and advances in computing power. One is artificial intelligence, or AI; the other is biotechnology. Huge benefits have emerged from each of them for human beings in general, such as self-driving cars — which will dramatically reduce the death rate from road accidents — and robotic surgery, which enables precise, highly efficient and targeted surgical interventions.\n",
"Yet, visionaries like Yuval Noah Harari, author of the best-selling Homo sapiens and Deus, are now warning that the convergence of biotechnology and AI will irreversibly and unpredictably change both the quality of human life and its challenges in the next few decades. A good example of this is the facial recognition technology that is now present in all photo management programs. The AI in the software is capable of not only spotting the faces in every photograph but also recognising the person by name.\n",
"This technology has now expanded so that photo apps can recognise cats, dogs, beaches, mountains and cars too. Computers with AI are already correctly identifying human emotions through observing facial expressions and body movements. Some robots are able to mimic human emotions. This is called affective computing, sometimes called artificial emotional intelligence, and refers to the study and development of systems and devices that can recognize, interpret, process, and simulate human affects.\n",
"\n",
"How could this be a negative?\n",
"The ability to read human emotions is just a step away from predicting human emotions. For example, if a computer attached to a video camera could identify which products a consumer is showing greater interest in or which ones he is really keen to buy, various tactics could be used to influence her to buy it.\n",
"Activists worry that computers that can understand and anticipate human wishes and desires by scanning their irises and analysing their micro-expressions could also be programmed to exploit and manipulate them.\n",
"Another very real fear is that humanoid computers with human-like skin, speech, and expressions could jeopardise and dehumanise relationship and create emotional vacuums.\n",
"\n",
"An enduring fear of Luddites has always been that computers will rob humans of their livelihood by taking their jobs and doing them more efficiently at lower cost. However, in reality the exact opposite has happened. As computerised machines began taking over mechanical and repetitive human activities, new jobs for people opened up that needs thinking and analytical skills and judgement, or human interpersonal skills. A good example is the worldwide proliferation of call centres.\n",
"When drones were invented many feared that pilots would soon be redundant. However, few people know that it takes almost 30 people to fly one military drone, and an additional 50 people to analyze and make sense of the data being streamed back by the drone.\n",
"The US army suffers from a serious shortage of trained, high quality drone pilots; anyone who masters this skill will have a job. But a social scientist warns that in 10 years, it is certain that computers will be flying that drone and humans will be redundant. Equally sure is that some brand new skill requirement will have opened up with advancing technology, calling for new talents.\n",
"\n",
"In the 20th century, a young man was supposed to choose a skill, vocation or profession, master it through education and practice, and then earn a living from it till he or she retired. However, the fast-changing nature of technology is making skills obsolete at a higher rate than ever before. To survive, tomorrow young man must keep re-inventing himself and updating his skills continuously. Life could be difficult if every new skill has a shelf life of only a decade or so.\n",
"Or perhaps one could look at it the other way — and say that changing technology will keep human beings on their toes throughout their life.\n",
"\n",
"Technology is the result of human inventiveness. It reflects our evolutionary heritage. We are neither strong like gorillas or tigers, nor fast like cheetahs and hawks, but our brains and thinking powers have given us the greatest edge of any species on the planet. Technology is a result.\n",
"Technology is either inherently good or bad; it is how we use it that makes it so. The splitting of a hydrogen atom is technology at work. As history has shown us, technology can equally be used to make a nuclear bomb that kills millions — or generate electricity that lights up a million homes.\n",
"\"\"\""
]
},
{
"cell_type": "code",
"source": [
"essay_paragraphs = essay.split('\\n\\n')"
],
"metadata": {
"id": "JESY8Y10W6hQ"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [
"model_name = \"snrspeaks/t5-one-line-summary\"\n",
"\n",
"from transformers import AutoModelForSeq2SeqLM, AutoTokenizer\n",
"model = AutoModelForSeq2SeqLM.from_pretrained(model_name)\n",
"tokenizer = AutoTokenizer.from_pretrained(model_name)"
],
"metadata": {
"id": "t1G-ZiHbZZ-Y"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "markdown",
"source": [
"## Results\n",
"Please at least check what is generated here, it's usually good but sometimes it's bs"
],
"metadata": {
"id": "8BARyupEemZ-"
}
},
{
"cell_type": "code",
"source": [
"preds = []\n",
"\n",
"for i in range(0, len(essay_paragraphs)):\n",
" input_ids = tokenizer.encode(essay_paragraphs[i], return_tensors=\"pt\", add_special_tokens=True)\n",
" generated_ids = model.generate(input_ids=input_ids,num_beams=5,max_length=35,repetition_penalty=4.5,length_penalty=1.5,early_stopping=True,num_return_sequences=1)\n",
" preds.append(tokenizer.decode(generated_ids[0], skip_special_tokens=True, clean_up_tokenization_spaces=True))\n",
"\n",
"print('Write an intro paragraph to an essay called', preds[0].lower())\n",
"\n",
"for i in range(1, len(preds) - 1):\n",
" print('Write a paragraph to an essay about', preds[i].lower())\n",
"\n",
"print('Write a concluding paragraph about', preds[len(preds) - 1].lower())"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "eyR58KFRae7n",
"outputId": "b8e4bc29-be89-43c3-d1bc-7e90525c0e09"
},
"execution_count": null,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"Write an intro paragraph to an essay called the rise and fall of technology\n",
"Write a paragraph to an essay about technology that drives modern autonomy, hybrid cars, hover-taxis and space cabs\n",
"Write a paragraph to an essay about luddites: why technology is a blessing?\n",
"Write a paragraph to an essay about artificial emotional intelligence\n",
"Write a paragraph to an essay about how could that be a negative?\n",
"Write a paragraph to an essay about detecting and manipulating human emotions\n",
"Write a paragraph to an essay about the rise and fall of human-client skills\n",
"Write a paragraph to an essay about changing technology will keep human beings on their toes throughout their life\n",
"Write a concluding paragraph about human inventiveness and technology\n"
]
}
]
}
]
}
@@ -0,0 +1,10 @@
# Essay Instructions
Essay Instructions is a notebook that takes an essay as an input and genrates instructions on how to generate
that essay. This will be very useful for data collecting for the model
## Contributing
Feel free to contribute to this notebook, it's nowhere near perfect but it's a good start.
If you want to contribute fidning a new model that better suits this task would be great.
Hugginface has a lot of models that could help.
File diff suppressed because one or more lines are too long
@@ -0,0 +1,8 @@
# Essay Revision
Essay Revision is a notebook that generates data for improving essays. It does that by taking a "good" essay, making it worse step by step
and the fidning instructions for making it better. This will be useful for generating data for the model.
## Contributing
Feel free to contribute to this notebook. It's not perfect but it is quite good. Finding a better way to make gramatical errors may be a good place to start.