-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat/emotions multimodal (video) #564
Conversation
yarl==1.8.2 | ||
zipp==3.15.0 | ||
flask==2.2.2 | ||
blinker==1.5.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
omg
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@anna-a-m эти зависимости все нужны?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Не уверена, что нужны
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
redundant requirements removed
|
||
RUN pip install gdown | ||
|
||
RUN git clone https://github.com/anna-a-m/MultimodalERC repo |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pls pick up some particular commit because now it is not fixed at all
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
particular commit picked
|
||
RUN apt install -y ffmpeg libsm6 libxext6 | ||
|
||
RUN pip install gdown |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
version?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
versions added
COPY . /src | ||
RUN pip install -r requirements.txt | ||
|
||
RUN apt install -y ffmpeg libsm6 libxext6 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
version?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
versions added
args: | ||
SERVICE_PORT: 8025 | ||
SERVICE_NAME: emotion_detection | ||
CUDA_VISIBLE_DEVICES: 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if the model needs GPU, then CUDA_VISIBLE_DEVICES: 0 should be given to the environment not to build args
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed from args
volumes: | ||
- ./annotators/emotion_detection:/src/drm | ||
ports: | ||
- 8025:8025 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
occupied port. select another one
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
assistant_dists/dream_ocean/dev.yml
Outdated
emotion-detection: | ||
volumes: | ||
- "./annotators/emotion_detection:/src/drm" | ||
- "/home/dikanskiy/emotion_test:/src/datafiles" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nope this is illegal. Remove this line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed (but one would still need to add some mapping to /src/datafiles or have a videofile in this directory inside the container in order for the annotator to work)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why can't you get a file as images (path from attirbutes of the current utterance and the file itself from FILES container)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the input to this service is a video + text so I used a test mounted folder as we discussed with @oserikov
annotators/emotion_detection/test.py
Outdated
# response = requests.post("http://0.0.0.0:8026/model", json={"personality": ["Hello world"]}) | ||
# assert response.status_code == 200 | ||
# assert response.json() == [{"EXT": 0, "NEU": 1, "AGR": 1, "CON": 0, "OPN": 1}] | ||
# print("SUCCESS") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why tests are not added?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are copied from personality_detection
. Removed
|
||
@app.route("/model", methods=["POST"]) | ||
def infer(): | ||
msg_text = request.json["last_human_utterances"][-1]["text"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nope. You are getting a BATCH of samples. SO, you have to process them as a batch. And return a batch of responses.
Sometimes it would accept a batch of several elements (depends on agent). So, pls fix it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
redone like the personality_detection
@moon-strider you did not push actually. |
annotators/emotion_detection/service_configs/emotion_detection/service.yml
Outdated
Show resolved
Hide resolved
assistant_dists/dream_ocean/dev.yml
Outdated
@@ -144,4 +144,9 @@ services: | |||
- "./annotators/personality_detection:/src" | |||
ports: | |||
- 8026:8026 | |||
emotion-detection: | |||
volumes: | |||
- "./annotators/emotion_detection:/src/drm" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
почему есть подпапка с названием drm? зачем она вообще
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
в dockerfile такой вообще папки не создается
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Удалил
components/OQWoiqfnqwfnoqwib.yml
Outdated
protocol: http | ||
timeout: 15.0 | ||
url: http://emotion-detection:8045/model | ||
dialog_formatter: state_formatters.dp_formatters:last_human_bot_annotated_utterance |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
это другой форматтер.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Исправил
prefix_len = len(prefix) | ||
|
||
|
||
def jsonify_data(data: Any) -> Any: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
а зачем, если есть полноценная функция jsonify, которую надо использовать
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Делал как в personality_detection
. Убрал эту функцию, нашёл аналог jsonify из fastapi
def process_video(video_path: str): | ||
video_frames = get_frames(video_path) | ||
|
||
video_model_name = "microsoft/xclip-base-patch32" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
мне кажется, было бы круто названия используемых моделей вынести в build args
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
и параметры, типа длин и пр тоже в build args
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Сделано
try: | ||
text = msg_text[prefix_len:] | ||
logger.info(f"Emotion Detection: {text}") | ||
emotion = predict_emotion(text, "/src/datafiles/vid.mp4") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
!!!!!!!!!!!! What is it?? what is the file?
If you are going to detect emotions using the corresponding file with voice, you are supposed to use FILES 3000 server (see multimodal dist), put the voice file to server, pass the fname or link to the file in human utterance attributes for every utterance
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -0,0 +1,3 @@ | |||
SERVICE_PORT: 8045 | |||
SERVICE_NAME: emotion_detection | |||
CUDA_VISIBLE_DEVICES: 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
список аргументов не полный. См билд арги в соседнем файле
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -10,6 +10,9 @@ services: | |||
ALWAYS_TURN_ON_ALL_SKILLS: 0 | |||
LANGUAGE: EN | |||
|
|||
files: | |||
image: julienmeerschart/simple-file-upload-download-server |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
зачем файл сервер добавляется в dream_embodied дистрибутив? елси в нем не используется он
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Убрала
done
"is_enabled": true, | ||
"source": { | ||
"component": "components/OQWoiqfnqwfnoqwib.yml", | ||
"service": "annotators/emotion_detection/service_configs/emotion_detection" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
тут должно быть через тире название (см по аналогии с другими компонентами). Папку также надо переназвать
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
В personality_detection тоже?
state_formatters/dp_formatters.py
Outdated
return [ | ||
{ | ||
"personality": [ | ||
dialog["human_utterances"][-1]["annotations"].get( | ||
"spelling_preprocessing", dialog["human_utterances"][-1]["text"] | ||
dialog["human_utterances"][-1]["text"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
не верно написано, вы из аннотации делаете get по ключу =реплика пользователя
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Полностью переделано
done
state_formatters/dp_formatters.py
Outdated
{ | ||
"personality": [ | ||
dialog["human_utterances"][-1]["annotations"].get( | ||
dialog["human_utterances"][-1]["text"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
тоже самое
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Полностью переделано
done
…nto feat/emotions
RUN gdown 'https://drive.google.com/uc?id=1ZHw2MEbjLwU5A7EaNysgVHZlaWq4FJZG' -O '/data/bert-large-uncased_none_seed-42.pt' | ||
RUN gdown 'https://drive.google.com/uc?id=1XZVPI2ZvE0PbvhFMinsAp2z9SPPEsSjn' -O '/data/final_model.pt' | ||
RUN gdown 'https://drive.google.com/uc?id=1DMUHqbwqn-j9XIhoqnfSwqyqrlPMkVJe' -O '/data/XCLIP_Augmented.pt' | ||
RUN gdown 'https://drive.google.com/uc?id=1VxEQcso_Bsrzix1TykriJ2BLfUm9Gtx5' -O '/data/redundant_features.txt' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
почему вы не хотите положить это в files.deeppavlov, как я предлагала?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Тут после Нового Года откроем новый пр и будут другие модели
state_formatters/dp_formatters.py
Outdated
@@ -509,6 +511,7 @@ def simple_formatter_service(payload: List): | |||
sent_rewrite_formatter, sent_segm_formatter, base_skill_selector_formatter | |||
""" | |||
logging.info(f"answer {payload}") | |||
logging.warning(f"answer {payload}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
удалите отладочный лог, пожалуйста)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@dilyararimovna @rock-n-shrimproll why does emotional distribution not have |
* emotion_detection initial commit * many small fixes * gdown fix * major update to configs, small change in data receiving * small typo fixed, logging added * everything prepared for a pr * conflict resolved, port for emotion_detection changed, codestyle fixed * codestyle fixed again * yet another style fix * go agane * major changes for pr * flask -> fastapi, batch fix * codestyle fixed * redundant requirements removed * another pr fix * added files:3000 to dream_ocean, emotion_detection external video support added * fixed emotion_detection annotator * emotion detection videofile support added * minor refactoring * style fix * more pr fixes, more style fixed * even more pr fixes * argument dockerfile fixes * Dockerfile fix * updating dp-agent commit * adding file server to dream_ocean dist * more pr fixes * fixed a critical typo in dockerfile * ignoring E402 for some lines of code * attempting to fix E402 * another attempt at fixing E402 * another one * new models added * minor changes * formatters slightly changed * dp_formatter for emotion-detection and personality-detection + reviewed erroes fixed * nano error fixed * port changed, redundant features file added to docker * port fixed(2) * port fixed(3) * codestyle fixed * codestyle fixed 2 * personality-detection models added * minor changes * personality detection models added to files.deeppavlov * gdown -> wget from files * emotion detection files fixed * fix: tests * lost file added * feat: use dream persona in dream ocean --------- Co-authored-by: Илья Наос <[email protected]> Co-authored-by: Alexandra Dolidze <[email protected]> Co-authored-by: Alexandra Dolidze <[email protected]> Co-authored-by: rock-n-shrimproll <[email protected]> Co-authored-by: dilyararimovna <[email protected]>
Bringing emotion detection annotator to dream.
WARNING: DO NOT DELETE BRANCH AFTER MERGING, THE LINKS TO
feat/emotions
FILES ARE IN SOME REPORT PAPERS AS OF 30.08.2023