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 client 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-client-intent-classification-ru-7'
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_client = AutoModelForSequenceClassification.from_pretrained(config.base_model_name_or_path,
device_map="cuda:0",
quantization_config=quantization_config,
num_labels=7,
use_cache = True,
)
model_client = PeftModel.from_pretrained(model_client, path)
model_client.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_client(**inputs.to(model_client.device))
binary_tensor = (outputs.logits > 0).int()
print(binary_tensor)
client_categories_list = ['Информирование', 'Запрос информации','Ведение диалога',
'Одобрение', 'Неодобрение', 'Рефлексия','Решение проблемы']
list_categories = []
for label,category in zip(binary_tensor, client_categories_list):
if label:
list_categories.append(category)
print(list_categories)
#[1, 1, 0, 0, 1, 1, 0]
list_categories = [
cat
for label, cat in zip(binary_tensor.squeeze(), client_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 1,934 client 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.930.980.95
2. Request for Information0.800.640.71
3. Maintaining Dialogue0.750.840.79
4. Approval0.760.750.75
5. Disapproval0.810.630.71
6. Reflection0.860.810.83
7. Problem-Solving0.870.760.81
F1-weighted0.870.840.85
F1-Macro0.8
F1-Micro0.86

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