Views
No views yet
facebook/w2v-bert-2.0 (semantic) and iic/emotion2vec_base (acoustic via FunASR)google/gemma-3-270mfusion_head.pt — PyTorch state_dict of the fusion/regression headeaa_config.json — minimal config (IDs, dims, hyperparams)modeling_eaa.py — the fusion architecture (Dual X-Attn + pooling + [REG] head)1import torch, json
2from huggingface_hub import hf_hub_download
3from modeling_eaa import EAAEmotionRegressor
4
5# Download artifacts
6cfg_path = hf_hub_download(repo_id="marccgrau/eaa-gemma3-270m-w2vbert-emotion2vec", filename="eaa_config.json")
7with open(cfg_path) as f:
8 cfg = json.load(f)
9
10# Recreate Gemma + load LoRA adapter
11from transformers import AutoModelForCausalLM, AutoTokenizer
12from peft import PeftModel
13tok = AutoTokenizer.from_pretrained(cfg["gemma_id"], trust_remote_code=True)
14llm_base = AutoModelForCausalLM.from_pretrained(cfg["gemma_id"], trust_remote_code=True, torch_dtype=torch.float16).cuda()
15llm = PeftModel.from_pretrained(llm_base, cfg["adapter_repo"]).eval()
16
17# Build fusion head and load weights
18head = EAAEmotionRegressor(
19 d_sem=cfg["d_sem"], d_ac=cfg["d_ac"], llm_hidden=cfg["llm_hidden"],
20 fusion_dim=cfg["fusion_dim"], num_audio_tokens=cfg["num_audio_tokens"]
21).cuda().eval()
22sd_path = hf_hub_download(repo_id="marccgrau/eaa-gemma3-270m-w2vbert-emotion2vec", filename="fusion_head.pt")
23head.load_state_dict(torch.load(sd_path, map_location="cpu"))
24
25# Now pass (sem_feats, ac_feats) and (input_ids) to head.forward(..., llm=llm)