forked from ibm-developer-skills-network/TransactBot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
model.py
22 lines (18 loc) · 1.01 KB
/
model.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
from ibm_watson_machine_learning.foundation_models import Model
from ibm_watson_machine_learning.foundation_models.extensions.langchain import WatsonxLLM
from ibm_watson_machine_learning.metanames import GenTextParamsMetaNames as GenParams
my_credentials = {
"url" : "https://us-south.ml.cloud.ibm.com",
"token" : "skills-network" # <--- NOTE: specify "skills-network" as your token (NOT as your apikey)
}
params = {
GenParams.MAX_NEW_TOKENS: 256, # The maximum number of tokens that the model can generate in a single run.
GenParams.TEMPERATURE: 0.1, # A parameter that controls the randomness of the token generation. A lower value makes the generation more deterministic, while a higher value introduces more randomness.
}
LLAMA2_model = Model(
model_id= 'meta-llama/llama-2-70b-chat',
credentials=my_credentials,
params=params,
project_id="skills-network", # <--- NOTE: specify "skills-network" as your project_id
)
llm = WatsonxLLM(LLAMA2_model)