-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from LyaaaaaGames/Develop
Release 1.2.0
- Loading branch information
Showing
10 changed files
with
242 additions
and
121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -127,3 +127,7 @@ dmypy.json | |
|
||
# Pyre type checker | ||
.pyre/ | ||
/server/miniconda/* | ||
/tokenizers/* | ||
/models/* | ||
server_logs.text |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,4 @@ pytorch==1.10.1 | |
torchvision==0.11.2 | ||
cudatoolkit==11.3.1 | ||
websockets==10.0 | ||
transformers==4.10.2 | ||
transformers==4.16 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#------------------------------------------------------------------------------ | ||
#-- Copyright (c) 2021-2022 LyaaaaaGames | ||
#-- Copyright (c) 2022 AIdventure_Server contributors | ||
#-- | ||
#-- Author : Lyaaaaaaaaaaaaaaa | ||
#-- | ||
#-- Implementation Notes: | ||
#-- - The class handling the text generation. | ||
#-- | ||
#-- Anticipated changes: | ||
#-- - | ||
#-- | ||
#-- Changelog: | ||
#-- - 18/02/2022 Lyaaaaa | ||
#-- - Created the file. | ||
#-- | ||
#-- - 22/05/2022 Lyaaaaa | ||
#-- - Updated generate_text to support the gpu once again. Simplified the | ||
#-- script by merging all the models input into a single dict "model_input". | ||
#------------------------------------------------------------------------------ | ||
|
||
from model import Model | ||
|
||
class Generator(Model): | ||
|
||
#------------------------------------------------------------------------------ | ||
#-- generate_text | ||
#------------------------------------------------------------------------------ | ||
def generate_text(self, | ||
p_prompt = None, | ||
p_context = None, | ||
p_memory = None, | ||
p_parameters = None): | ||
|
||
model_input = p_memory + p_context + p_prompt | ||
model_input = self._Tokenizer(model_input, return_tensors = "pt") | ||
|
||
if self.is_gpu_enabled: | ||
model_input.to("cuda") | ||
|
||
p_parameters["max_length"] += len(model_input[0]) | ||
|
||
model_output = self._Model.generate(**model_input, | ||
**p_parameters) | ||
generated_text = self._Tokenizer.decode(model_output[0], skip_special_tokens=True) | ||
|
||
return generated_text |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#------------------------------------------------------------------------------ | ||
#-- Copyright (c) 2021-2022 LyaaaaaGames | ||
#-- Copyright (c) 2022 AIdventure_Server contributors | ||
#-- | ||
#-- Author : Lyaaaaaaaaaaaaaaa | ||
#-- | ||
#-- Implementation Notes: | ||
#-- - | ||
#-- Anticipated changes: | ||
#-- - | ||
#-- Changelog: | ||
#-- - 18/02/2022 Lyaaaaa | ||
#-- - Created the file | ||
#------------------------------------------------------------------------------ | ||
|
||
from enum import Enum | ||
|
||
class Model_Type(Enum): | ||
GENERATION = 0 | ||
TRANSLATION = 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.