Code Monkey home page Code Monkey logo

catgpt-fork's Introduction

CatGPT

CatGPT Logo

Table of Contents / Taula de Continguts

  1. Project Objective / Objectius del Projecte
  2. Model Structure / Estructura del Model
  3. Training Datasets / Datasets d'Entrenament
  4. Tokenizer
  5. Document Structure / Estructura dels Documents
  6. How to Use the Model / Com Utilitzar el Model
  7. App Structure / Estructura de l'App
  8. Installation / Instal·lació
  9. Contributing / Contribucions
  10. License / Llicència
  11. Contact Information / Informació de Contacte

Project Objective / Objectius del Projecte

English:
CatGPT is a Catalan natural language model created with the goal of providing a lightweight yet effective model that can continue sentences in Catalan. This project is designed to facilitate the generation of coherent and relevant text in Catalan. The model is primarily intended for educational purposes, offering a simple yet functional tool for exploring natural language processing in Catalan. Given its small size, the model does not aim for high performance but rather serves as an accessible resource for learning and experimentation.

Català:
CatGPT és un model de llenguatge natural en català, creat amb l'objectiu de proporcionar un model lleuger però efectiu que pugui continuar oracions en català. Aquest projecte està dissenyat per facilitar la generació de text coherent i rellevant en català. El model està pensat principalment per a usos educatius, oferint una eina senzilla però funcional per explorar el processament del llenguatge natural en català. Atès que la mida del model és reduïda, no té com a objectiu assolir un alt rendiment, sinó servir com a recurs accessible per a l'aprenentatge i l'experimentació.

Model Structure / Estructura del Model

English:
CatGPT is modeled after a structure similar to GPT-2 and features the following key specifications:

  • Parameters: ~111 million
  • Vocabulary Size: 32,768 unique tokens (Catalan-specific)
  • Number of Layers: 12
  • Attention Heads: 8
  • Embedding Size: 768
  • Block Size: 1024 tokens

The model’s parameter count is primarily influenced by its specialized Catalan vocabulary. Despite being relatively compact, these design choices ensure efficient training and inference, providing satisfactory text generation quality within the Catalan language context.

Català:
CatGPT segueix una estructura similar a GPT-2 i presenta les següents especificacions clau:

  • Paràmetres: ~111 milions
  • Mida del Vocabulari: 32.768 tokens únics (adaptat al català)
  • Nombre de Capes: 12
  • Capçals d'Atenció: 8
  • Mida dels Embeddings: 768
  • Mida del Bloc: 1024 tokens

El nombre de paràmetres està principalment influenciat pel vocabulari especialitzat en català. Tot i ser relativament compacte, aquestes decisions de disseny asseguren un entrenament i una inferència eficients, oferint una qualitat de generació de text satisfactòria dins del context de la llengua catalana.

Training Datasets / Datasets d'Entrenament

English:
The model has been trained using various datasets, including:

  • Oscar: A massive multilingual corpus with only Catalan text, which includes:

    • Catalan General Crawling: Obtained from scraping the 500 most popular .cat and .ad domains.
    • Catalan Government Crawling: Data collected from .gencat domains and subdomains of the Catalan government.
    • Existing public corpora: Including DOGC, CaWac, Open Subtitles, the Catalan Wikipedia, among others.
    • Catalan News Agency: News from the Catalan News Agency collected from March 2015 to October 2020.
  • Catalan_Textual Dataset: A specifically created dataset to cover a wide range of Catalan texts.

Additionally, the model was trained with a total of approximately 3000 million unique tokens and over 6500 million tokens (considering different epochs of training with the Oscar dataset).

Català:
El model ha estat entrenat utilitzant diversos datasets, incloent:

  • Oscar: Un corpus multilingüe massiu amb només text en català, que inclou:

    • Catalan General Crawling: Obtingut a partir de l'scraping dels 500 dominis .cat i .ad més populars.
    • Catalan Government Crawling: Dades recopilades dels dominis .gencat i subdominis del govern català.
    • Corpus públics existents: Incloent DOGC, CaWac, Open Subtitles, la Viquipèdia catalana, entre altres.
    • Catalan News Agency: Notícies de l'Agència Catalana de Notícies recopilades des de març de 2015 fins a octubre de 2020.
  • Catalan_Textual Dataset: Un conjunt de dades específicament creat per cobrir una àmplia gamma de textos en català.

A més, el model s'ha entrenat amb un total d'uns 3000 milions de tokens únics i amb més de 5460 milions de tokens (comptant diferents epochs d'entrenament amb el dataset Oscar).

Tokenizer

English:
For this project, a specific tokenizer with 32,768 different tokens has been created using the byte pair encoding (BPE) algorithm. This tokenizer was generated using a 50 MB subset of the training data, ensuring adequate coverage of the Catalan vocabulary.

Català:
Per a aquest projecte, s'ha creat un tokenizer específic amb 32,768 tokens diferents utilitzant l'algoritme byte pair encoding (BPE). Aquest tokenizer ha estat generat utilitzant un subset de 50 MB de les dades d'entrenament, assegurant una cobertura adequada del vocabulari català.

Document Structure / Estructura dels Documents

English:
The following is the structure of the code repository:

├── assets
│   ├── CatGPT_app.py
│   ├── CatGPT_dataset.ipynb
│   ├── CatGPT_model.py
│   ├── CatGPT_run.py
│   ├── CatGPT_train.ipynb
│   └── __pycache__
├── data
│   ├── CatGPT_dataset.txt
│   └── small_catalan_oscar.txt
├── images
│   ├── future_AI_example.png
│   └── house_example.png
├── logo
│   ├── CatGPT.jpg
│   └── CatGPT_round.png
├── models
│   ├── CatGPT.pth
│   ├── loss.ipynb
│   └── output.txt
├── requirements.txt
└── tokenizer
    ├── CatGPT_tokenizer.ipynb
    ├── merges.txt
    └── vocab.json

Description of Key Files / Descripció dels Fitxers Principals

  1. CatGPT_tokenizer.ipynb:

    • English: Contains the code to create and train the tokenizer for the CatGPT model.
    • Català: Conté el codi per crear i entrenar el tokenizer per al model CatGPT.
  2. CatGPT_dataset.ipynb:

    • English: Describes the steps to prepare the dataset used to train the model.
    • Català: Descriu els passos per preparar el dataset utilitzat per entrenar el model.
  3. CatGPT_train.ipynb:

    • English: Script to train the CatGPT model, including model configuration and hyperparameters.
    • Català: Script per entrenar el model CatGPT, incloent configuració del model i hiperparàmetres.
  4. CatGPT_app.py:

    • English: Script for the Streamlit app, which provides an interactive interface to generate text using the CatGPT model.
    • Català: Script per a l'aplicació Streamlit, que proporciona una interfície interactiva per generar text utilitzant el model CatGPT.
  5. CatGPT_run.py:

    • English: Main script to launch the CatGPT app. This script handles the setup and execution of the Streamlit app.
    • Català: Script principal per llançar l'aplicació CatGPT. Aquest script gestiona la configuració i execució de l'aplicació Streamlit.

How to Use the Model / Com Utilitzar el Model

English:
To use CatGPT, you simply need to clone the repository, install the required libraries, and run the CatGPT_run.py script. This script will launch the Streamlit app, where you can interact with the model through an easy-to-use interface.

Català:
Per utilitzar CatGPT, només cal clonar el repositori, instal·lar les biblioteques necessàries i executar el script CatGPT_run.py. Aquest script llançarà l'aplicació Streamlit, on podràs interactuar amb el model a través d'una interfície fàcil d'usar.

App Structure / Estructura de l'App

English:
The visual app provides an intuitive interface to interact with the CatGPT model. Users can input text prompts in Catalan and receive generated text based on the model's predictions. This section covers the app's structure, its parameters, and provides visual examples.

Català:
L'aplicació visual ofereix una interfície intuïtiva per interactuar amb el model CatGPT. Els usuaris poden introduir textos en català i rebre textos generats basats en les prediccions del model. Aquesta secció cobreix l'estructura de l'aplicació, els seus paràmetres i proporciona exemples visuals.

Overview of Parameters / Visió general dels Paràmetres

English:
In the app, several parameters can be adjusted to fine-tune the model's output:

  • Max Length (tokens): Defines the maximum number of tokens the model can generate in a single output.
  • Temperature: Controls the randomness of predictions. Lower values make the model more deterministic.
  • Top-K: Limits the sampling pool to the top K tokens, focusing on more probable tokens.
  • Repetition Penalty: Applies a penalty to repeated words or phrases, reducing the likelihood of redundant text in the output.

Català:
A l'aplicació, es poden ajustar diversos paràmetres per afinar la sortida del model:

  • Màxima Longitud (tokens): Defineix el nombre màxim de tokens que el model pot generar en una única sortida.
  • Temperatura: Controla l'aleatorietat de les prediccions. Valors més baixos fan que el model sigui més determinista.
  • Top-K: Limita el conjunt de mostreig als K tokens més probables.
  • Penalització per Repetició: Aplica una penalització a paraules o frases repetides, reduint la probabilitat de text redundant en la sortida.

Example Screenshots / Captures de Pantalla d'Exemple

English:
Below are some example screenshots showing the app in action, demonstrating different text prompts and the corresponding generated outputs. The screenshots showcase how the CatGPT model can generate coherent and contextually appropriate text in Catalan. The first example explores a futuristic scenario related to artificial intelligence, while the second example describes a cozy home environment.

Català:
A continuació es mostren algunes captures de pantalla que mostren l'aplicació en acció, demostrant diferents frases d'entrada i les corresponents sortides generades. Les captures de pantalla mostren com el model CatGPT pot generar text coherent i adequat al context en català. El primer exemple explora un escenari futurista relacionat amb la intel·ligència artificial, mentre que el segon exemple descriu un entorn de llar acollidor.

AI Example

English:
In this screenshot, the model generates a text continuation related to the future capabilities of artificial intelligence. The output highlights how AI can enhance professional work environments and contribute to a more sustainable and human-centered society.

Català:
En aquesta captura de pantalla, el model genera una continuació del text relacionada amb les capacitats futures de la intel·ligència artificial. La sortida ressalta com la IA pot millorar els entorns de treball professionals i contribuir a una societat més sostenible i centrada en les persones.

House Example

English:
In this screenshot, the model generates a detailed description of a cozy home. The output provides a vivid depiction of the house’s features, including its layout, amenities, and overall atmosphere, demonstrating the model's ability to handle descriptive text generation.

Català:
En aquesta captura de pantalla, el model genera una descripció detallada d'una casa acollidora. La sortida proporciona una descripció vívida de les característiques de la casa, incloent-hi la seva distribució, comoditats i l'ambient general, demostrant la capacitat del model per manejar la generació de textos descriptius.

Installation / Instal·lació

English:

  1. If you don't have Git LFS installed, you need to install it first to download the model file correctly:

    git lfs install
  2. Clone this repository to your local machine:

    git clone https://github.com/yourusername/CatGPT.git
    cd CatGPT
  3. Install the required libraries:

    pip install -r requirements.txt
  4. Run the app:

    python assets/CatGPT_run.py

Català:

  1. Si no tens Git LFS instal·lat, cal que l'instal·lis primer per descarregar correctament l'arxiu del model:

    git lfs install
  2. Clona aquest repositori a la teva màquina local:

    git clone https://github.com/yourusername/CatGPT.git
    cd CatGPT
  3. Instal·la les biblioteques necessàries:

    pip install -r requirements.txt
  4. Executa l'aplicació:

    python assets/CatGPT_run.py

Contributing / Contribucions

English:
We welcome contributions to improve CatGPT. Please submit pull requests or report issues on the GitHub repository.

Català:
Ens agradaria molt comptar amb les vostres contribucions per millorar CatGPT. Envieu sol·licituds d'extracció o informeu de problemes al repositori de GitHub.

License / Llicència

English:
This project is licensed under the MIT License.

Català:
Aquest projecte està llicenciat sota la Llicència MIT.

Contact Information / Informació de Contacte

English:
For any inquiries or support, please contact [[email protected]].

Català:
Per a qualsevol consulta o suport, contacteu amb [[email protected]].

catgpt-fork's People

Contributors

rogerbaiges avatar pauhidalgoo avatar

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.