Spaces:
Build error
Build error
mghareeb32 commited on
Commit ·
be3589f
1
Parent(s): 5f2345e
Basic Allam call.
Browse files- allam.py +25 -0
- requirements.txt +20 -3
allam.py
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
from ibm_watsonx_ai import Credentials
|
| 3 |
+
from ibm_watsonx_ai.metanames import EmbedTextParamsMetaNames
|
| 4 |
+
from ibm_watsonx_ai.foundation_models import ModelInference
|
| 5 |
+
|
| 6 |
+
def model():
|
| 7 |
+
embed_params = {
|
| 8 |
+
EmbedTextParamsMetaNames.TRUNCATE_INPUT_TOKENS: 3,
|
| 9 |
+
EmbedTextParamsMetaNames.RETURN_OPTIONS: {"input_text": True},
|
| 10 |
+
}
|
| 11 |
+
|
| 12 |
+
return ModelInference(
|
| 13 |
+
model_id="sdaia/allam-1-13b-instruct",
|
| 14 |
+
credentials=Credentials(
|
| 15 |
+
api_key = 'iYwxSbn8Kxe3UjV2OMS9tSe1dxPlgndTamTwET6-_GLX',
|
| 16 |
+
url="https://eu-de.ml.cloud.ibm.com",
|
| 17 |
+
),
|
| 18 |
+
project_id="89e6b2dd-fcc5-4ee2-af0b-8e6d735493ed",
|
| 19 |
+
params=embed_params,
|
| 20 |
+
)
|
| 21 |
+
|
| 22 |
+
if __name__ == "__main__":
|
| 23 |
+
resp = model().generate("ما اسمك؟")
|
| 24 |
+
for r in resp['results']:
|
| 25 |
+
print(r['generated_text'])
|
requirements.txt
CHANGED
|
@@ -1,24 +1,37 @@
|
|
| 1 |
altair==5.4.1
|
|
|
|
| 2 |
attrs==24.2.0
|
| 3 |
blinker==1.8.2
|
| 4 |
cachetools==5.5.0
|
| 5 |
certifi==2024.8.30
|
| 6 |
charset-normalizer==3.4.0
|
| 7 |
click==8.1.7
|
|
|
|
|
|
|
| 8 |
gitdb==4.0.11
|
| 9 |
GitPython==3.1.43
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
idna==3.10
|
|
|
|
| 11 |
Jinja2==3.1.4
|
|
|
|
| 12 |
jsonschema==4.23.0
|
| 13 |
jsonschema-specifications==2024.10.1
|
| 14 |
Levenshtein==0.26.1
|
|
|
|
| 15 |
markdown-it-py==3.0.0
|
| 16 |
MarkupSafe==3.0.2
|
| 17 |
mdurl==0.1.2
|
| 18 |
narwhals==1.12.1
|
| 19 |
-
numpy==
|
| 20 |
packaging==24.1
|
| 21 |
-
pandas==2.
|
| 22 |
pillow==10.4.0
|
| 23 |
protobuf==5.28.3
|
| 24 |
pyarrow==18.0.0
|
|
@@ -28,15 +41,19 @@ python-dateutil==2.9.0.post0
|
|
| 28 |
pytz==2024.2
|
| 29 |
RapidFuzz==3.10.1
|
| 30 |
referencing==0.35.1
|
| 31 |
-
requests==2.32.
|
| 32 |
rich==13.9.4
|
| 33 |
rpds-py==0.20.1
|
| 34 |
six==1.16.0
|
| 35 |
smmap==5.0.1
|
|
|
|
| 36 |
streamlit==1.39.0
|
|
|
|
| 37 |
tenacity==9.0.0
|
| 38 |
toml==0.10.2
|
| 39 |
tornado==6.4.1
|
| 40 |
typing_extensions==4.12.2
|
| 41 |
tzdata==2024.2
|
| 42 |
urllib3==2.2.3
|
|
|
|
|
|
|
|
|
| 1 |
altair==5.4.1
|
| 2 |
+
anyio==4.6.2.post1
|
| 3 |
attrs==24.2.0
|
| 4 |
blinker==1.8.2
|
| 5 |
cachetools==5.5.0
|
| 6 |
certifi==2024.8.30
|
| 7 |
charset-normalizer==3.4.0
|
| 8 |
click==8.1.7
|
| 9 |
+
colorama==0.4.6
|
| 10 |
+
exceptiongroup==1.2.2
|
| 11 |
gitdb==4.0.11
|
| 12 |
GitPython==3.1.43
|
| 13 |
+
h11==0.14.0
|
| 14 |
+
httpcore==1.0.6
|
| 15 |
+
httpx==0.27.2
|
| 16 |
+
ibm-cos-sdk==2.13.6
|
| 17 |
+
ibm-cos-sdk-core==2.13.6
|
| 18 |
+
ibm-cos-sdk-s3transfer==2.13.6
|
| 19 |
+
ibm_watsonx_ai==1.1.20
|
| 20 |
idna==3.10
|
| 21 |
+
importlib_metadata==8.5.0
|
| 22 |
Jinja2==3.1.4
|
| 23 |
+
jmespath==1.0.1
|
| 24 |
jsonschema==4.23.0
|
| 25 |
jsonschema-specifications==2024.10.1
|
| 26 |
Levenshtein==0.26.1
|
| 27 |
+
lomond==0.3.3
|
| 28 |
markdown-it-py==3.0.0
|
| 29 |
MarkupSafe==3.0.2
|
| 30 |
mdurl==0.1.2
|
| 31 |
narwhals==1.12.1
|
| 32 |
+
numpy==1.26.4
|
| 33 |
packaging==24.1
|
| 34 |
+
pandas==2.1.4
|
| 35 |
pillow==10.4.0
|
| 36 |
protobuf==5.28.3
|
| 37 |
pyarrow==18.0.0
|
|
|
|
| 41 |
pytz==2024.2
|
| 42 |
RapidFuzz==3.10.1
|
| 43 |
referencing==0.35.1
|
| 44 |
+
requests==2.32.2
|
| 45 |
rich==13.9.4
|
| 46 |
rpds-py==0.20.1
|
| 47 |
six==1.16.0
|
| 48 |
smmap==5.0.1
|
| 49 |
+
sniffio==1.3.1
|
| 50 |
streamlit==1.39.0
|
| 51 |
+
tabulate==0.9.0
|
| 52 |
tenacity==9.0.0
|
| 53 |
toml==0.10.2
|
| 54 |
tornado==6.4.1
|
| 55 |
typing_extensions==4.12.2
|
| 56 |
tzdata==2024.2
|
| 57 |
urllib3==2.2.3
|
| 58 |
+
watchdog==5.0.3
|
| 59 |
+
zipp==3.20.2
|