Skip to content

Commit

Permalink
[update] add_new_modules instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
Immortalise authored Dec 28, 2023
1 parent 53130af commit e901665
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions examples/add_new_modules.md
Original file line number Diff line number Diff line change
@@ -10,18 +10,18 @@ Adding new datasets involves two steps:

## Add new models
Similar to adding new datasets, the addition of new models also consists of two steps.
- Implementing a New Model Class: Models should be implemented in `dataload/model.py`, inheriting from the `LLMModel` class. In your customized model, you should implement `self.tokenizer` and `self.model`. You may also customize your own `predict` function for inference. If the `predict` function is not customized, the default `predict` function inherited from `LLMModel` will be used.
- Adding an Interface: After customizing the model class, register it in the `_create_model` function within the `class LLMModel` in `__init__.py`.
- Implementing a New Model Class: Models should be implemented in `models/model.py`, inheriting from the `LLMModel` class. In your customized model, you should implement `self.tokenizer` and `self.model`. You may also customize your own `predict` function for inference. If the `predict` function is not customized, the default `predict` function inherited from `LLMModel` will be used.
- Adding an Interface: After customizing the model class, register it in the `_create_model` function within the `class LLMModel` and `MODEL_LIST` dictionary in `__init__.py`.



## Add new prompt engineering methods
Adding new methods in prompt engineering is similar to steps of C.1 and C.2.
Adding new methods in prompt engineering is similar to steps of adding new datasets and models.

- Implementing a New Methods Class: Methods should be implemented in \\ `prompt\_engineering` Module. Firstly, create a new `.py` file for your methods.
Then implement two functions: `\_\_init\_\_` and `query`. For unified management, two points need be noticed: 1. all methods should inherits from `Base` class that has common code for prompt engineering methods. 2. prompts used in methods should be stored in `prompts/method\_oriented.py`.
- Adding an Interface: After implementing a new methods, register it in the `METHOD\_MAP` that is used to map method names to their corresponding class.


## Add new metrics and input/output process functions
New evaluation metrics should be implemented as static functions in `class Eval` within the `metrics` module. Similarly, new input/output process functions should be implemented as static functions in `class InputProcess` and `class OutputProcess` in the `utils` module.
New evaluation metrics should be implemented as static functions in `class Eval` within the `metrics` module. Similarly, new input/output process functions should be implemented as static functions in `class InputProcess` and `class OutputProcess` in the `utils` module.

0 comments on commit e901665

Please sign in to comment.