huggingface / autotrain-advanced

🤗 AutoTrain Advanced
https://huggingface.co/autotrain
Apache License 2.0
3.63k stars 441 forks source link

[BUG] KeyError: 'chat_template' #682

Closed yitzshapiro closed 3 weeks ago

yitzshapiro commented 3 weeks ago

Prerequisites

Backend

Colab

Interface Used

UI

CLI Command

No response

UI Screenshots & Parameters

image

{ "block_size": 1024, "model_max_length": 2048, "padding": "right", "use_flash_attention_2": false, "disable_gradient_checkpointing": false, "logging_steps": -1, "evaluation_strategy": "epoch", "save_total_limit": 1, "auto_find_batch_size": false, "mixed_precision": "fp16", "lr": 3e-05, "epochs": 3, "batch_size": 2, "warmup_ratio": 0.1, "gradient_accumulation": 4, "optimizer": "adamw_torch", "scheduler": "linear", "weight_decay": 0.0, "max_grad_norm": 1.0, "seed": 42, "chat_template": "none", "quantization": "int4", "target_modules": "all-linear", "merge_adapter": false, "peft": true, "lora_r": 16, "lora_alpha": 32, "lora_dropout": 0.05, "unsloth": false, "push_to_hub": true }

Error Logs

INFO | 2024-06-13 20:31:54 | autotrain.cli.autotrain:main:56 - Using AutoTrain configuration: config.yml INFO | 2024-06-13 20:31:54 | autotrain.parser:post_init__:124 - Running task: lm_training INFO | 2024-06-13 20:31:54 | autotrain.parser:post_init:125 - Using backend: local Traceback (most recent call last): File "/usr/local/bin/autotrain", line 8, in sys.exit(main()) File "/usr/local/lib/python3.10/dist-packages/autotrain/cli/autotrain.py", line 57, in main cp = AutoTrainConfigParser(args.config) File "", line 4, in init File "/usr/local/lib/python3.10/dist-packages/autotrain/parser.py", line 127, in post_init__ self.parsed_config = self._parse_config() File "/usr/local/lib/python3.10/dist-packages/autotrain/parser.py", line 142, in _parse_config params["chat_template"] = self.config["data"]["chat_template"] KeyError: 'chat_template' An error occurred while starting training! Error: Training failed with exit code: 1

Additional Information

Tried using all the different chat_templates, and still am getting the same error above

abhishekkrthakur commented 3 weeks ago

you should have a config.yml generated, could you share it please?

yitzshapiro commented 3 weeks ago

This is what's generated:

backend: local
base_model: microsoft/Phi-3-mini-128k-instruct
data:
  column_mapping:
    text: text
  path: data/formatted_train.csv
  train_split: train
  valid_split: null
hub:
  push_to_hub: true
  token: ${{HF_TOKEN}}
  username: ${{HF_USERNAME}}
log: tensorboard
params:
  batch_size: 2
  block_size: 1024
  chat_template: none
  epochs: 3
  gradient_accumulation: 4
  lr: 3.0e-05
  mixed_precision: fp16
  model_max_length: 2048
  optimizer: adamw_torch
  peft: true
  scheduler: linear
  target_modules: all-linear
  unsloth: false
project_name: Slottify-Phi-3-mini-128k-instruct
task: llm
arthurgcarvalho commented 3 weeks ago

Same here

backend: local base_model: openai-community/gpt2 data: column_mapping: text: text path: data/train.csv train_split: train.csv valid_split: null hub: push_to_hub: true token: ${{HF_TOKEN}} username: ${{HF_USERNAME}} log: tensorboard params: batch_size: 2 block_size: 1024 chat_template: none epochs: 3 gradient_accumulation: 4 lr: 3.0e-05 mixed_precision: fp16 model_max_length: 2048 optimizer: adamw_torch peft: true scheduler: linear target_modules: all-linear unsloth: false project_name: autotrain-f954p-3o4yn task: llm

And these are the first two observations in train.csv

### Human: Can you write a short introduction about the relevance of the term "monopsony" in economics? Please use examples related to potential monopsonies in the labour market and cite relevant research.### Assistant: "Monopsony" refers to a market structure where there is only one buyer for a particular good or service. In economics, this term is particularly relevant in the labor market, where a monopsony employer has significant power over the wages and working conditions of their employees. The presence of a monopsony can result in lower wages and reduced employment opportunities for workers, as the employer has little incentive to increase wages or provide better working conditions. Recent research has identified potential monopsonies in industries such as retail and fast food, where a few large companies control a significant portion of the market (Bivens & Mishel, 2013). In these industries, workers often face low wages, limited benefits, and reduced bargaining power, leading to a situation where they are dependent on the employer for their livelihood. This dependence can result in further suppression of wages and a decline in working conditions. Overall, the concept of monopsony is essential to understanding the dynamics of labor markets and the impact of market power on workers. Further research is needed to understand the extent and impact of monopsonies on the economy and to develop policies to address this issue. References: Bivens, J., & Mishel, L. (2013). The Pay of Corporate Executives and Financial Professionals as Evidence of Rents in Top 1 Percent Incomes. Journal of Economic Perspectives, 27(3), 57-78.### Human: Now explain it to a dog ### Human: ¿CUales son las etapas del desarrollo y en qué consisten según Piaget?### Assistant: Jean Piaget fue un psicólogo suizo que propuso una teoría sobre el desarrollo cognitivo humano que consta de cuatro etapas: Etapa sensoriomotora (0-2 años): Durante esta etapa, el niño aprende a través de sus sentidos y movimientos. Descubre que sus acciones pueden tener un impacto en el entorno y comienza a formarse una idea básica de objetividad y continuidad. Etapa preoperatoria (2-7 años): En esta etapa, el niño comienza a desarrollar un pensamiento simbólico y a comprender que las cosas pueden representar a otras cosas. También comienzan a desarrollar un pensamiento lógico y a comprender conceptos como la causa y el efecto. Etapa de operaciones concretas (7-12 años): Durante esta etapa, el niño desarrolla un pensamiento lógico y comprende las relaciones causales. Empiezan a comprender que las cosas pueden tener múltiples perspectivas y que los conceptos pueden ser más complejos de lo que parecen a simple vista. Etapa de operaciones formales (12 años en adelante): En esta etapa, el individuo desarrolla un pensamiento abstracto y puede comprender conceptos complejos y abstractos. Son capaces de razonar hipotéticamente y tienen la capacidad de reflexionar sobre su propio pensamiento. Estas etapas no son lineales y algunos individuos pueden avanzar en una etapa más rápidamente que en otras. La teoría de Piaget sobre el desarrollo cognitivo ha sido ampliamente utilizada y es una base importante para la investigación y el entendimiento del desarrollo humano.### Human: ¿Hay otras teorías sobre las etapas del desarrollo que reafirmen o contradigan a la teoría de Piaget?
abhishekkrthakur commented 3 weeks ago

this issue is now resolved in latest release. please let me know if you are still facing problems. version 0.7.122+

arthurgcarvalho commented 3 weeks ago

Thank you for your help. I am still facing the same problem. Some relevant info:

Results of pip show autotrain-advanced Name: autotrain-advanced Version: 0.7.123 Summary: Home-page: https://github.com/huggingface/autotrain-advanced Author: HuggingFace Inc. Author-email: autotrain@huggingface.co License: Apache 2.0 Location: /usr/local/lib/python3.10/dist-packages Requires: accelerate, albumentations, authlib, bitsandbytes, codecarbon, cryptography, datasets, diffusers, einops, evaluate, fastapi, hf-transfer, httpx, huggingface-hub, invisible-watermark, ipadic, itsdangerous, jiwer, joblib, loguru, nltk, nvitop, optuna, packaging, pandas, peft, Pillow, protobuf, py7zr, pycocotools, pydantic, pyngrok, python-multipart, pyyaml, requests, rouge-score, sacremoses, scikit-learn, sentence-transformers, sentencepiece, seqeval, tensorboard, tiktoken, timm, torchmetrics, tqdm, transformers, trl, uvicorn, werkzeug, xgboost Required-by:

config.yml backend: local base_model: google/gemma-2b data: column_mapping: text: text path: data/train.csv train_split: train valid_split: null hub: push_to_hub: true token: ${{HF_TOKEN}} username: ${{HF_USERNAME}} log: tensorboard params: batch_size: 2 block_size: 1024 epochs: 3 gradient_accumulation: 4 lr: 3.0e-05 mixed_precision: fp16 model_max_length: 2048 optimizer: adamw_torch peft: true scheduler: linear target_modules: all-linear unsloth: false project_name: autotrain-jo5a6-odfwk task: llm

Error Training is starting... Please wait! INFO | 2024-06-17 15:31:06 | autotrain.cli.autotrain:main:58 - Using AutoTrain configuration: config.yml INFO | 2024-06-17 15:31:06 | autotrain.parser:post_init__:133 - Running task: lm_training INFO | 2024-06-17 15:31:06 | autotrain.parser:post_init:134 - Using backend: local Traceback (most recent call last): File "/usr/local/bin/autotrain", line 8, in sys.exit(main()) File "/usr/local/lib/python3.10/dist-packages/autotrain/cli/autotrain.py", line 59, in main cp = AutoTrainConfigParser(args.config) File "", line 4, in init File "/usr/local/lib/python3.10/dist-packages/autotrain/parser.py", line 136, in post_init__ self.parsed_config = self._parse_config() File "/usr/local/lib/python3.10/dist-packages/autotrain/parser.py", line 151, in _parse_config params["chat_template"] = self.config["data"]["chat_template"] KeyError: 'chat_template' An error occurred while starting training! Error: Training failed with exit code: 1

abhishekkrthakur commented 3 weeks ago

@arthurgcarvalho the fix was for colab ui. are you using the colab ui? or launching training using autotrain --config command?

arthurgcarvalho commented 3 weeks ago

Yep, I am using Colab UI by running the following commands (from the template at https://github.com/huggingface/autotrain-advanced?tab=readme-ov-file):

!pip install -U autotrain-advanced > install_logs.txt 2>&1 from IPython.display import display from autotrain.app.colab import colab_app elements = colab_app() display(elements)

arthurgcarvalho commented 3 weeks ago

In case it helps (the install_logs.txt file is attached) install_logs.txt

image

abhishekkrthakur commented 3 weeks ago

apologies. i overlooked. issue is resolved in latest version now.

yitzshapiro commented 3 weeks ago

THANK YOU!