santerr80/Software-Engineering-URFU-2.7-Group

Project on the discipline of Software engineering group 27

Python

0

70 commits

updated Jan 8, 2024

See the code

README

Software-Engineering-URFU-2.7-Group

Project on the discipline of Software engineering group 27

Практическое задание 1

Молохов Д.А.

Модель: TAPEX: Table Pre-training via Learning a Neural SQL Executor. Может быть использована для ответов на относительно простые вопросы по таблицам.

Был создан скрипт, принимающий на вход 2 аргумента: путь к csv-файлу и вопрос.

Примеры использования:

Top 50 Spotify Songs - 2019

Unnamed: 0Track.NameArtist.NameGenreBeats.Per.MinuteEnergyDanceabilityLoudness..dB..LivenessValence.Length.Acousticness..Speechiness.Popularity
0SeñoritaShawn Mendescanadian pop1175576-68751914379
1ChinaAnuel AAreggaeton flow1058179-48613028992
2boyfriend (with Social House)Ariana Grandedance pop1908040-41670186124685
3Beautiful People (feat. Khalid)Ed Sheeranpop936564-8855198121986
4Goodbyes (Feat. Young Thug)Post Malonedfw rap1506558-4111817545794
5I Don't Care (with Justin Bieber)Ed Sheeranpop1026880-59842209484
6RansomLil Teccatrap music1806475-672313122992
7How Do You Sleep?Sam Smithpop1116848-583520215990
8Old Town Road - RemixLil Nas Xcountry rap1366288-6116415751087
9bad guyBillie Eilishelectropop1354370-111056194333895
10CallaitaBad Bunnyreggaeton1766261-52424251603193
11Loco Contigo (feat. J. Balvin & Tyga)DJ Snakedance pop967182-4153818528786
12Someone You LovedLewis Capaldipop1104150-6114518275388
13Otro Trago - RemixSechpanamanian pop1767973-267628872087
14Money In The Grave (Drake ft. Rick Ross)Drakecanadian hip hop1015083-4121020510592
15No Guidance (feat. Drake)Chris Browndance pop934570-71614261121582
16LA CANCIÓNJ Balvinlatin1766575-61143243153290
17Sunflower - Spider-Man: Into the Spider-VersePost Malonedfw rap904876-679115856591
18LalalaY2Kcanadian hip hop1303984-8145016118888
19Truth HurtsLizzoescape room1586272-31241173111191
python table.py spotify_top_50.csv "How many dance pop songs are there?"
# [' 3.0']

python table.py spotify_top_50.csv 'Who is the artist of a song named "Someone you loved"?'
# [' lewis capaldi']

Titanic Dataset

PassengerIdSurvivedPclassNameSexAgeSibSpParchTicketFareCabinEmbarked
89203Kelly, Mr. Jamesmale34.5003309117.8292nanQ
89313Wilkes, Mrs. James (Ellen Needs)female47103632727nanS
89402Myles, Mr. Thomas Francismale62002402769.6875nanQ
89503Wirz, Mr. Albertmale27003151548.6625nanS
89613Hirvonen, Mrs. Alexander (Helga E Lindqvist)female2211310129812.2875nanS
89703Svensson, Mr. Johan Cervinmale140075389.225nanS
89813Connolly, Miss. Katefemale30003309727.6292nanQ
89902Caldwell, Mr. Albert Francismale261124873829nanS
90013Abrahim, Mrs. Joseph (Sophie Halaut Easu)female180026577.2292nanC
90103Davies, Mr. John Samuelmale2120A/4 4887124.15nanS
90203Ilieff, Mr. Yliomale0003492207.8958nanS
90301Jones, Mr. Charles Cressonmale460069426nanS
90411Snyder, Mrs. John Pillsbury (Nelle Stevenson)female23102122882.2667B45S
90502Howard, Mr. Benjaminmale63102406526nanS
90611Chaffee, Mrs. Herbert Fuller (Carrie Constance...female4710W.E.P. 573461.175E31S
90712del Carlo, Mrs. Sebastiano (Argenia Genovesi)female2410SC/PARIS 216727.7208nanC
90802Keane, Mr. Danielmale350023373412.35nanQ
90903Assaf, Mr. Geriosmale210026927.225nanC
91013Ilmakangas, Miss. Ida Livijafemale2710STON/O2. 31012707.925nanS
91113Assaf Khalil, Mrs. Mariana (Miriam")"female450026967.225nanC
python table.py titanic.csv "What is the passengerid of Mr. Daniel Keane?"
# [' 908.0']

python table.py titanic.csv "What is the age of a person with the ticket '24065'?"
# [' 63.0']

Горбунов А.В.

GPT-2

Test the whole generation capabilities here: https://transformer.huggingface.co/doc/gpt2-large

Pretrained model on English language using a causal language modeling (CLM) objective. It was introduced in this paper and first released at this page.

Disclaimer: The team releasing GPT-2 also wrote a model card for their model. Content from this model card has been written by the Hugging Face team to complete the information they provided and give specific examples of bias. Model description

GPT-2 is a transformers model pretrained on a very large corpus of English data in a self-supervised fashion. This means it was pretrained on the raw texts only, with no humans labelling them in any way (which is why it can use lots of publicly available data) with an automatic process to generate inputs and labels from those texts. More precisely, it was trained to guess the next word in sentences.

More precisely, inputs are sequences of continuous text of a certain length and the targets are the same sequence, shifted one token (word or piece of word) to the right. The model uses internally a mask-mechanism to make sure the predictions for the token i only uses the inputs from 1 to i but not the future tokens.

This way, the model learns an inner representation of the English language that can then be used to extract features useful for downstream tasks. The model is best at what it was pretrained for however, which is generating texts from a prompt.

This is the smallest version of GPT-2, with 124M parameters.

Антонова А.Г.

Модель seara/rubert-tiny2-cedr-russian-emotion используется для определения эмоций в коротких русских текстах и возвращает результат в формате словаря. Можно применять в различных сценариях, связанных с анализом тональности, эмоциональным анализом текста, мониторингом социальных медиа-публикаций и других задачах, где требуется определение эмоций в тексте на русском языке.

The task is a multi-label classification with the following labels:
0: no_emotion
1: joy
2: sadness
3: surprise
4: fear
5: anger

Label to Russian label:

no_emotion: нет эмоции
joy: радость
sadness: грусть
surprise: удивление
fear: страх
anger: злость

Практическое задание 2

Приложение для суммаризации транскрипции из YouTube видео. Alt text

Запуск приложения:

streamlit run app.py

Молохов Д.А.

Создал интерфейс приложения.

Антонова А.Г.

Внесла изменения в функции: load_summarizer,load_translator.

Практическое задание 3

API версия приложения для суммаризации транскрипции из YouTube видео.

Установка и запуск:

  1. Установить PyTorch или TensorFlow.
  2. Установить requirements.txt и запустить.
pip install -r requirements.txt
uvicorn app_fastapi:app

Молохов Д.А.

Написал метод summarize, использующий модели для перевода и суммаризации.

Антонова А.Г.

В функцию lifespan были добавлены модели:

  • Модель translator для перевода текста.
  • Модель summarized для сжатия текста.

Практическое задание 4

Приложение для суммаризации транскрипции из YouTube видео было развернуты с помощью Streamlit. https://gdde32a9tcbggertdapp6kr.streamlit.app/

Практическое задание 5

Для приложения по ответу на вопросы по таблицам gorbunovav/FastAPI_app были написаны тесты с использованием pytest и GitHub Actions.

Молохов Д.А.

Реализовал автоматическое тестирование с GitHub Actions.

Антонова А.Г.

Разработала тест для проверки загрузки таблицы.

Горбунов А.В.

Разработал тесты для проверки модели и API сервиса.

Итоговый проект

API-приложение для ответов на вопросы по таблице. gorbunovav/FastAPI_app

Для приложения реализованы тесты с помощью GitHub Actions.

Методы

uploadfile

Метод для загрузки таблицы на сервер.

request

Метод для ввода запроса.

tokenize

Метод для вывода ответа.

Установка и запуск

git clone https://github.com/santerr80/Software-Engineering-URFU-2.7-Group
pip install -r requirements.txt
cd gorbunovav/FastAPI_app
uvicorn main:app

santerr80/Software-Engineering-URFU-2.7-Group

Project on the discipline of Software engineering group 27

Python

0

70 commits

updated Jan 8, 2024

See the code

README

Software-Engineering-URFU-2.7-Group

Project on the discipline of Software engineering group 27

Практическое задание 1

Молохов Д.А.

Модель: TAPEX: Table Pre-training via Learning a Neural SQL Executor. Может быть использована для ответов на относительно простые вопросы по таблицам.

Был создан скрипт, принимающий на вход 2 аргумента: путь к csv-файлу и вопрос.

Примеры использования:

Top 50 Spotify Songs - 2019

Unnamed: 0Track.NameArtist.NameGenreBeats.Per.MinuteEnergyDanceabilityLoudness..dB..LivenessValence.Length.Acousticness..Speechiness.Popularity
0SeñoritaShawn Mendescanadian pop1175576-68751914379
1ChinaAnuel AAreggaeton flow1058179-48613028992
2boyfriend (with Social House)Ariana Grandedance pop1908040-41670186124685
3Beautiful People (feat. Khalid)Ed Sheeranpop936564-8855198121986
4Goodbyes (Feat. Young Thug)Post Malonedfw rap1506558-4111817545794
5I Don't Care (with Justin Bieber)Ed Sheeranpop1026880-59842209484
6RansomLil Teccatrap music1806475-672313122992
7How Do You Sleep?Sam Smithpop1116848-583520215990
8Old Town Road - RemixLil Nas Xcountry rap1366288-6116415751087
9bad guyBillie Eilishelectropop1354370-111056194333895
10CallaitaBad Bunnyreggaeton1766261-52424251603193
11Loco Contigo (feat. J. Balvin & Tyga)DJ Snakedance pop967182-4153818528786
12Someone You LovedLewis Capaldipop1104150-6114518275388
13Otro Trago - RemixSechpanamanian pop1767973-267628872087
14Money In The Grave (Drake ft. Rick Ross)Drakecanadian hip hop1015083-4121020510592
15No Guidance (feat. Drake)Chris Browndance pop934570-71614261121582
16LA CANCIÓNJ Balvinlatin1766575-61143243153290
17Sunflower - Spider-Man: Into the Spider-VersePost Malonedfw rap904876-679115856591
18LalalaY2Kcanadian hip hop1303984-8145016118888
19Truth HurtsLizzoescape room1586272-31241173111191
python table.py spotify_top_50.csv "How many dance pop songs are there?"
# [' 3.0']

python table.py spotify_top_50.csv 'Who is the artist of a song named "Someone you loved"?'
# [' lewis capaldi']

Titanic Dataset

PassengerIdSurvivedPclassNameSexAgeSibSpParchTicketFareCabinEmbarked
89203Kelly, Mr. Jamesmale34.5003309117.8292nanQ
89313Wilkes, Mrs. James (Ellen Needs)female47103632727nanS
89402Myles, Mr. Thomas Francismale62002402769.6875nanQ
89503Wirz, Mr. Albertmale27003151548.6625nanS
89613Hirvonen, Mrs. Alexander (Helga E Lindqvist)female2211310129812.2875nanS
89703Svensson, Mr. Johan Cervinmale140075389.225nanS
89813Connolly, Miss. Katefemale30003309727.6292nanQ
89902Caldwell, Mr. Albert Francismale261124873829nanS
90013Abrahim, Mrs. Joseph (Sophie Halaut Easu)female180026577.2292nanC
90103Davies, Mr. John Samuelmale2120A/4 4887124.15nanS
90203Ilieff, Mr. Yliomale0003492207.8958nanS
90301Jones, Mr. Charles Cressonmale460069426nanS
90411Snyder, Mrs. John Pillsbury (Nelle Stevenson)female23102122882.2667B45S
90502Howard, Mr. Benjaminmale63102406526nanS
90611Chaffee, Mrs. Herbert Fuller (Carrie Constance...female4710W.E.P. 573461.175E31S
90712del Carlo, Mrs. Sebastiano (Argenia Genovesi)female2410SC/PARIS 216727.7208nanC
90802Keane, Mr. Danielmale350023373412.35nanQ
90903Assaf, Mr. Geriosmale210026927.225nanC
91013Ilmakangas, Miss. Ida Livijafemale2710STON/O2. 31012707.925nanS
91113Assaf Khalil, Mrs. Mariana (Miriam")"female450026967.225nanC
python table.py titanic.csv "What is the passengerid of Mr. Daniel Keane?"
# [' 908.0']

python table.py titanic.csv "What is the age of a person with the ticket '24065'?"
# [' 63.0']

Горбунов А.В.

GPT-2

Test the whole generation capabilities here: https://transformer.huggingface.co/doc/gpt2-large

Pretrained model on English language using a causal language modeling (CLM) objective. It was introduced in this paper and first released at this page.

Disclaimer: The team releasing GPT-2 also wrote a model card for their model. Content from this model card has been written by the Hugging Face team to complete the information they provided and give specific examples of bias. Model description

GPT-2 is a transformers model pretrained on a very large corpus of English data in a self-supervised fashion. This means it was pretrained on the raw texts only, with no humans labelling them in any way (which is why it can use lots of publicly available data) with an automatic process to generate inputs and labels from those texts. More precisely, it was trained to guess the next word in sentences.

More precisely, inputs are sequences of continuous text of a certain length and the targets are the same sequence, shifted one token (word or piece of word) to the right. The model uses internally a mask-mechanism to make sure the predictions for the token i only uses the inputs from 1 to i but not the future tokens.

This way, the model learns an inner representation of the English language that can then be used to extract features useful for downstream tasks. The model is best at what it was pretrained for however, which is generating texts from a prompt.

This is the smallest version of GPT-2, with 124M parameters.

Антонова А.Г.

Модель seara/rubert-tiny2-cedr-russian-emotion используется для определения эмоций в коротких русских текстах и возвращает результат в формате словаря. Можно применять в различных сценариях, связанных с анализом тональности, эмоциональным анализом текста, мониторингом социальных медиа-публикаций и других задачах, где требуется определение эмоций в тексте на русском языке.

The task is a multi-label classification with the following labels:
0: no_emotion
1: joy
2: sadness
3: surprise
4: fear
5: anger

Label to Russian label:

no_emotion: нет эмоции
joy: радость
sadness: грусть
surprise: удивление
fear: страх
anger: злость

Практическое задание 2

Приложение для суммаризации транскрипции из YouTube видео. Alt text

Запуск приложения:

streamlit run app.py

Молохов Д.А.

Создал интерфейс приложения.

Антонова А.Г.

Внесла изменения в функции: load_summarizer,load_translator.

Практическое задание 3

API версия приложения для суммаризации транскрипции из YouTube видео.

Установка и запуск:

  1. Установить PyTorch или TensorFlow.
  2. Установить requirements.txt и запустить.
pip install -r requirements.txt
uvicorn app_fastapi:app

Молохов Д.А.

Написал метод summarize, использующий модели для перевода и суммаризации.

Антонова А.Г.

В функцию lifespan были добавлены модели:

  • Модель translator для перевода текста.
  • Модель summarized для сжатия текста.

Практическое задание 4

Приложение для суммаризации транскрипции из YouTube видео было развернуты с помощью Streamlit. https://gdde32a9tcbggertdapp6kr.streamlit.app/

Практическое задание 5

Для приложения по ответу на вопросы по таблицам gorbunovav/FastAPI_app были написаны тесты с использованием pytest и GitHub Actions.

Молохов Д.А.

Реализовал автоматическое тестирование с GitHub Actions.

Антонова А.Г.

Разработала тест для проверки загрузки таблицы.

Горбунов А.В.

Разработал тесты для проверки модели и API сервиса.

Итоговый проект

API-приложение для ответов на вопросы по таблице. gorbunovav/FastAPI_app

Для приложения реализованы тесты с помощью GitHub Actions.

Методы

uploadfile

Метод для загрузки таблицы на сервер.

request

Метод для ввода запроса.

tokenize

Метод для вывода ответа.

Установка и запуск

git clone https://github.com/santerr80/Software-Engineering-URFU-2.7-Group
pip install -r requirements.txt
cd gorbunovav/FastAPI_app
uvicorn main:app