Skip to content
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

Merged
merged 53 commits into from Jan 16, 2024
Merged

Feat/emotions multimodal (video) #564

merged 53 commits into from Jan 16, 2024

Conversation

moon-strider
Copy link
Contributor

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

yarl==1.8.2
zipp==3.15.0
flask==2.2.2
blinker==1.5.0
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

omg

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@anna-a-m эти зависимости все нужны?)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Не уверена, что нужны

Copy link
Contributor Author

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
Copy link
Collaborator

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

Copy link
Contributor Author

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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

version?

Copy link
Contributor Author

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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

version?

Copy link
Contributor Author

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
Copy link
Collaborator

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

Copy link
Contributor Author

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
Copy link
Collaborator

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

emotion-detection:
volumes:
- "./annotators/emotion_detection:/src/drm"
- "/home/dikanskiy/emotion_test:/src/datafiles"
Copy link
Collaborator

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

Copy link
Contributor Author

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)

Copy link
Collaborator

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)?

Copy link
Contributor Author

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

# 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")
Copy link
Collaborator

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?

Copy link
Contributor Author

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"]
Copy link
Collaborator

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.

Copy link
Contributor Author

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

@dilyararimovna
Copy link
Collaborator

@moon-strider you did not push actually.

@@ -144,4 +144,9 @@ services:
- "./annotators/personality_detection:/src"
ports:
- 8026:8026
emotion-detection:
volumes:
- "./annotators/emotion_detection:/src/drm"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

почему есть подпапка с названием drm? зачем она вообще

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

в dockerfile такой вообще папки не создается

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Удалил

protocol: http
timeout: 15.0
url: http://emotion-detection:8045/model
dialog_formatter: state_formatters.dp_formatters:last_human_bot_annotated_utterance
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

это другой форматтер.

Copy link
Contributor Author

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:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

а зачем, если есть полноценная функция jsonify, которую надо использовать

Copy link
Contributor Author

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"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

мне кажется, было бы круто названия используемых моделей вынести в build args

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

и параметры, типа длин и пр тоже в build args

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Сделано

annotators/emotion_detection/server.py Show resolved Hide resolved
assistant_dists/dream_ocean/dev.yml Show resolved Hide resolved
try:
text = msg_text[prefix_len:]
logger.info(f"Emotion Detection: {text}")
emotion = predict_emotion(text, "/src/datafiles/vid.mp4")
Copy link
Collaborator

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@dilyararimovna dilyararimovna changed the title Feat/emotions [WIP] Feat/emotions multimodal (video) Nov 14, 2023
@@ -0,0 +1,3 @@
SERVICE_PORT: 8045
SERVICE_NAME: emotion_detection
CUDA_VISIBLE_DEVICES: 0
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

список аргументов не полный. См билд арги в соседнем файле

Copy link
Contributor

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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

зачем файл сервер добавляется в dream_embodied дистрибутив? елси в нем не используется он

Copy link
Contributor

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"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

тут должно быть через тире название (см по аналогии с другими компонентами). Папку также надо переназвать

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

В personality_detection тоже?

return [
{
"personality": [
dialog["human_utterances"][-1]["annotations"].get(
"spelling_preprocessing", dialog["human_utterances"][-1]["text"]
dialog["human_utterances"][-1]["text"]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

не верно написано, вы из аннотации делаете get по ключу =реплика пользователя

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Полностью переделано
done

{
"personality": [
dialog["human_utterances"][-1]["annotations"].get(
dialog["human_utterances"][-1]["text"]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

тоже самое

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Полностью переделано
done

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'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

почему вы не хотите положить это в files.deeppavlov, как я предлагала?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Тут после Нового Года откроем новый пр и будут другие модели

annotators/personality_detection/Dockerfile Show resolved Hide resolved
@@ -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}")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

удалите отладочный лог, пожалуйста)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@dilyararimovna dilyararimovna changed the title [WIP] Feat/emotions multimodal (video) Feat/emotions multimodal (video) Jan 15, 2024
@dilyararimovna dilyararimovna merged commit bc61e2e into dev Jan 16, 2024
2 checks passed
@oserikov
Copy link
Contributor

oserikov commented Feb 6, 2024

@dilyararimovna @rock-n-shrimproll why does emotional distribution not have files service in any of the docker-compose files? It simply won't work without it, am I wrong?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants