Dedicated Endpoints

Run this model inference on single tenant GPU with unmatched speed and reliability at scale.

Learn more
Container

Run this model inference with full control and performance in your environment.

Learn more

Get help setting up a custom Dedicated Endpoints.

Talk with our engineer to get a quote for reserved GPU instances with discounts.

README

License: mit

Model Description

QLoRA adapter (LoRA fine-tune on 4-bit quantized base model) for multi-label intent classification of Russian therapist messages.

  • Base model: Qwen/Qwen3-8B
  • Adapter type: LoRA (via PEFT)
  • Quantization: 4-bit NF4 (QLoRA) with double quantization, compute dtype bfloat16
  • Task: Multi-label sequence classification
  • Language: Russian
  • Number of labels: 7

Usage

python

import torch
from transformers import AutoTokenizer, AutoModelForSequenceClassification, BitsAndBytesConfig
from peft import PeftModel, PeftConfig
path = 'AIPsy/qwen3-8b-therapist-intent-classification-ru-9'
config = PeftConfig.from_pretrained(path)
# tokenizer
tokenizer = AutoTokenizer.from_pretrained(config.base_model_name_or_path)
tokenizer.pad_token = tokenizer.eos_token
# qunatization config
quantization_config = BitsAndBytesConfig(
load_in_4bit = True,
bnb_4bit_quant_type = 'nf4',
bnb_4bit_use_double_quant = True,
bnb_4bit_compute_dtype = torch.bfloat16
)
model_therapist = AutoModelForSequenceClassification.from_pretrained(config.base_model_name_or_path,
device_map="cuda:0",
quantization_config=quantization_config,
num_labels=9,
use_cache = True,
)
model_therapist = PeftModel.from_pretrained(model_therapist, path)
model_therapist.config.pad_token_id = tokenizer.pad_token_id
text = '''Клиент: Я считаю, что эта обида переросла в ненависть. Знаешь, такую прям вот, как раньше, кровная какая-то ненависть. То есть у меня к человеку настолько сильная неприязнь, что я вообще не хочу ничего не знать о нём, не слышать. У меня прям даже уже не боль, а как бы презрение.Я уже ненавижу его. Вот такое осталось состояние.
Терапевт: Хорошо, я тебя поняла. Вот так, давай сначала, знаешь как, определимся, вот у нас с тобой есть почти час, да, вот чего бы ты хотела от сегодняшней встречи? Какой бы вот итог, результат тебя бы удовлетворил? Скажи, пожалуйста.
Клиент: По факту мне хочется завершиться с этим ощущением ненависти, потому что никакого, никакой пользы я этого не вижу для себя, да, никаких у нас с ним не может быть. Я всё хочу оставить и этот вопрос закрыть, потому что, как показывает жизненный опыт на сегодняшний день, все эти эмоции ещё негативно отражаются в настоящих моих отношениях.
'''
inputs = tokenizer(str(text), padding=True, truncation=True, return_tensors="pt")
with torch.no_grad():
outputs = model_therapist(**inputs.to(model_therapist.device))
binary_tensor = (outputs.logits > 0).int()
print(binary_tensor)
#[1, 1, 1, 0, 0, 0, 1, 0, 0]
list_categories = [
cat
for label, cat in zip(binary_tensor.squeeze(), therapist_categories_list)
if label.item()
]
print(list_categories)
#['Информирование', 'Запрос информации', 'Общая эмоциональная поддержка', 'Запрос на простраивание связей']

Dataset

The source material was the recordings of psychotherapeutic sessions posted on YouTube in the public domain. After conducting speaker diarization and transcription of the recordings 2,391 therapist utterances were annotated by six experts working in two teams of three. Annotation was performed using detailed guidelines comprising the intention taxonomy, definitions of each category, and illustrative examples.

Training Details

  • Quantization: QLoRA (NF4, double quant, bfloat16)
  • Framework: PEFT + BitsAndBytes + Transformers

Metrics

F1 score metrics for test sample across categories

IntentionsPrecisionRecallF1-score
1. Providing Information0.830.920.88
2. Request for Information0.930.880.90
3. General Emotional Support0.680.810.74
4. Maintaining Positive Dynamics0.900.650.76
5. Negative Evaluation0.860.800.83
6. Self-Disclosure0.770.740.76
7. Request for Making Connections0.770.720.75
8. Interpretation0.800.740.77
9. Guidance0.820.710.76
weighted average0.830.790.80
F1-Macro0.79
F1-Micro0.8

Model provider

AIPsy

AIPsy

Model tree

Base

Qwen/Qwen3-8B

Adapter

this model

Modalities

Input

Text

Output

Text

Pricing

Dedicated Endpoints

View details

Supported Functionality

Model APIs

Dedicated Endpoints

Container

More information

Explore FriendliAI today