Skip to content
This repository was archived by the owner on Aug 4, 2026. It is now read-only.
This repository was archived by the owner on Aug 4, 2026. It is now read-only.

About evaluate and activate_subnet #21

Description

@shijian971

When I use the following code.

trainer.compression_ctrl.multi_elasticity_handler.activate_subnet_for_config(config)
validate_model_fn(trainer.model, eval_loader)

The results are the same during the evaluation regardless of different config.
QQ_1733730610687

The same issue will also occur when using the following code for evaluation.

def evaluate_sst2(model, valid_loader):

  model.eval()
  correct = 0
  total = 0
  with torch.no_grad():
      for batch in valid_loader:
          input_ids_sentence = batch['input_ids_sentence'].to(model.device)
          attention_mask_sentence = batch['attention_mask_sentence'].to(model.device)
          labels = batch['label'].to(model.device)

          outputs = model(
              input_ids_sentence,
              attention_mask=attention_mask_sentence
          )
          _, predicted= torch.max(outputs.logits, 1)

          correct += (predicted == labels).sum().item()
          total += labels.size(0)

  acc = correct / total
  return acc
evaluate_sst(trainer.model, valid_loader)

How to solve the issue? or How to check if the activation of the subnet has been completed?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions