Spaces:
Sleeping
Sleeping
Tuchuanhuhuhu commited on
Commit ·
666f878
1
Parent(s): 7d0d9da
MOSS模型可以用了
Browse files- modules/models/MOSS.py +2 -1
- modules/models/models.py +3 -0
- requirements_advanced.txt +4 -0
modules/models/MOSS.py
CHANGED
|
@@ -90,7 +90,8 @@ class MOSS_Client(BaseLLMModel):
|
|
| 90 |
eos_token_id=106068,
|
| 91 |
pad_token_id=MOSS_TOKENIZER.pad_token_id)
|
| 92 |
response = MOSS_TOKENIZER.decode(outputs[0][inputs.input_ids.shape[1]:], skip_special_tokens=True)
|
| 93 |
-
|
|
|
|
| 94 |
|
| 95 |
|
| 96 |
if __name__ == "__main__":
|
|
|
|
| 90 |
eos_token_id=106068,
|
| 91 |
pad_token_id=MOSS_TOKENIZER.pad_token_id)
|
| 92 |
response = MOSS_TOKENIZER.decode(outputs[0][inputs.input_ids.shape[1]:], skip_special_tokens=True)
|
| 93 |
+
response = response.lstrip("<|MOSS|>: ")
|
| 94 |
+
return response, len(response)
|
| 95 |
|
| 96 |
|
| 97 |
if __name__ == "__main__":
|
modules/models/models.py
CHANGED
|
@@ -580,6 +580,9 @@ def get_model(
|
|
| 580 |
elif model_type == ModelType.StableLM:
|
| 581 |
from .StableLM import StableLM_Client
|
| 582 |
model = StableLM_Client(model_name)
|
|
|
|
|
|
|
|
|
|
| 583 |
elif model_type == ModelType.Unknown:
|
| 584 |
raise ValueError(f"未知模型: {model_name}")
|
| 585 |
logging.info(msg)
|
|
|
|
| 580 |
elif model_type == ModelType.StableLM:
|
| 581 |
from .StableLM import StableLM_Client
|
| 582 |
model = StableLM_Client(model_name)
|
| 583 |
+
elif model_type == ModelType.MOSS:
|
| 584 |
+
from .MOSS import MOSS_Client
|
| 585 |
+
model = MOSS_Client(model_name)
|
| 586 |
elif model_type == ModelType.Unknown:
|
| 587 |
raise ValueError(f"未知模型: {model_name}")
|
| 588 |
logging.info(msg)
|
requirements_advanced.txt
CHANGED
|
@@ -1,7 +1,11 @@
|
|
| 1 |
transformers
|
|
|
|
| 2 |
torch
|
| 3 |
icetk
|
| 4 |
protobuf==3.19.0
|
| 5 |
git+https://github.com/OptimalScale/LMFlow.git
|
| 6 |
cpm-kernels
|
| 7 |
sentence_transformers
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
transformers
|
| 2 |
+
huggingface_hub
|
| 3 |
torch
|
| 4 |
icetk
|
| 5 |
protobuf==3.19.0
|
| 6 |
git+https://github.com/OptimalScale/LMFlow.git
|
| 7 |
cpm-kernels
|
| 8 |
sentence_transformers
|
| 9 |
+
accelerate
|
| 10 |
+
sentencepiece
|
| 11 |
+
datasets
|