Coder Social home page Coder Social logo

[QUESTION] Train my own Metric: about comet HOT 4 CLOSED

sdlmw avatar sdlmw commented on June 23, 2024
[QUESTION] Train my own Metric:

from comet.

Comments (4)

ricardorei avatar ricardorei commented on June 23, 2024

There is a mismatch between unbabel-comet==1.1.3 and the current master branch.

If you are using version 1.1.3 you can't pass a list of training files.. the config is just:

ranking_metric:
  class_path: comet.models.RankingMetric
  init_args:
    nr_frozen_epochs: 0.3
    keep_embeddings_frozen: True
    optimizer: AdamW
    encoder_learning_rate: 5.0e-06
    learning_rate: 1.5e-05
    layerwise_decay: 0.95
    encoder_model: XLM-RoBERTa
    pretrained_model: xlm-roberta-base
    pool: avg
    layer: mix
    dropout: 0.1
    batch_size: 4
    train_data: /MT-work/COMET/data/apequest/train.csv
    validation_data:
      - /MT-work/COMET/data/apequest/test.csv      
trainer: /MT-work/COMET/configs/trainer.yaml
early_stopping: /MT-work/COMET/configs/early_stopping.yaml
model_checkpoint: /MT-work/COMET/configs/model_checkpoint.yaml

from comet.

sdlmw avatar sdlmw commented on June 23, 2024

Hi @ricardorei

Thanks for the explanation.

I just pulled the latest version.

git clone https://github.com/Unbabel/COMET

The error has not changed

from comet.

ricardorei avatar ricardorei commented on June 23, 2024

Hi @sdlmw I just tested the code on master and everything is working fine.

Here is my configs:

ranking_metric:
  class_path: comet.models.RankingMetric
  init_args:
    nr_frozen_epochs: 0.3
    keep_embeddings_frozen: True
    optimizer: AdamW
    encoder_learning_rate: 1.0e-06
    learning_rate: 1.5e-05
    layerwise_decay: 0.95
    encoder_model: XLM-RoBERTa
    pretrained_model: xlm-roberta-base
    pool: avg
    layer: mix
    layer_transformation: sparsemax
    layer_norm: False
    dropout: 0.1
    batch_size: 4
    train_data: 
      - tests/data/ranking_data.csv
    validation_data:
      - tests/data/ranking_data.csv
      
trainer: ../trainer.yaml
early_stopping: ../early_stopping.yaml
model_checkpoint: ../model_checkpoint.yaml

and for the trainer.yaml:

class_path: pytorch_lightning.trainer.trainer.Trainer
init_args:
  accelerator: gpu
  devices: 1
  accumulate_grad_batches: 4
  amp_backend: native
  amp_level: null
  auto_lr_find: False
  auto_scale_batch_size: False
  auto_select_gpus: False
  benchmark: null
  check_val_every_n_epoch: 1
  default_root_dir: null
  deterministic: False
  fast_dev_run: False
  gradient_clip_val: 1.0
  gradient_clip_algorithm: norm
  limit_train_batches: 1.0
  limit_val_batches: 1.0
  limit_test_batches: 1.0
  limit_predict_batches: 1.0
  log_every_n_steps: 50
  profiler: null
  overfit_batches: 0
  plugins: null
  precision: 16
  max_epochs: 4
  min_epochs: 1
  max_steps: -1
  min_steps: null
  max_time: null
  num_nodes: 1
  num_sanity_val_steps: 10
  reload_dataloaders_every_n_epochs: 0
  replace_sampler_ddp: True
  sync_batchnorm: False
  detect_anomaly: False
  tpu_cores: null
  track_grad_norm: -1
  val_check_interval: 1.0
  enable_model_summary: True
  move_metrics_to_cpu: True
  multiple_trainloader_mode: max_size_cycle

from comet.

ricardorei avatar ricardorei commented on June 23, 2024

note that the data I am using is in the tests folder. Make sure that the data you are using for the ranking model is in the same shape

from comet.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.