Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the server for AIdventure 2.0.0 #29

Merged
merged 4 commits into from
Feb 9, 2024
Merged

Conversation

Lyaaaaaaaaaaaaaaa
Copy link
Member

No description provided.

config.py:
- Removed TOKENIZERS_PATH.

model.py:
- __init__ now expect a fourth parameter, model_path.
- _model_path is now set to p_model_path.
- Removed _tokenizers_path. A model's files are now all in the same
folder.
- Extracted _load_translator to the Translator class to use
polymorphism.
- Updated _load to always call _load_translator no matter the type of
the model. The specific behavior is implemented in children if needed
(See Translator.py)
- _load_tokens and _save_tokens now use _model_path.

server.py:
- Updated handle_request to receive the models path in p_data and to use
it in the model constructor.

translator.py:
- Added _load_model method (extracted from model.py. Old name
"_load_translator")
- Fixed an error in create_offload_folder:
- It was the value of config.OFFLOAD_FOLDER to the temporary directory
object while it should be a string. So, when creating a new AI (e.g
loading another generator) it was leading to a type error. Moreover,
Consistency of this 'temp' folder isn't needed (at least for now).
- Deleted model_type (useless, thanks to polymorphism)

model.py:
- The class now uses polymorphism.
- Removed model_type and all the check related to the type of object.
- Extracted all the code related to the Generator to the Generator
class.
- Extracted all the code related to the Translator to the Translator
class.
- _set_model_parameters renamed _set_parameters.
- Updated __init__
- Removed the p_model_type parameter
- p_model_path is now the second parameter of __init__. p_parameters the
third.
- Added a log message to display the model's name and its path.
- Added a log message to display if cuda is supported.

generator.py:
- The class now uses polymorphism.
- Added torch_dtype and more transformers imports.
- Added _set_parameters and _download_model methods inherited from
Model.

translator.py:
- Added Logger and transformers imports.
- Now uses polymorphism
- Added _set_parameters and _download_model methods inherited from
Model.

server.py:
- Removed model_type import and all its use in the code.
- Simplified handle_request by removing code repetition and extracting
part of code to specific functions.
- Added load_translator and load_generator functions.

request.py:
- LOAD_MODEL becomes LOAD_GENERATOR.
- Added LOAD_TRANSLATOR (value 8)
…meters

- generate_text now longer receives memory and context as parameters.
They are embedded in the prompt parameter by the client.
@Lyaaaaaaaaaaaaaaa Lyaaaaaaaaaaaaaaa merged commit 92e52a9 into Develop Feb 9, 2024
1 check failed
@Lyaaaaaaaaaaaaaaa Lyaaaaaaaaaaaaaaa deleted the AIdventure2.0 branch February 9, 2024 09:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant