Skip to content

Commit e0c1187

Browse files
committed
Merge branch 'master' into v2
2 parents 3d2dabf + 327ee6c commit e0c1187

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

argostranslate/settings.py

+9
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
"""
99
Argos Translate can be configured using either environment variables or json file
1010
11+
Configurations from environment variables supersede configurations from the JSON file.
12+
1113
### Environment variables
1214
```
1315
export ARGOS_DEBUG="0"
@@ -138,6 +140,13 @@ def set_setting(key: str, value):
138140
inter_threads = int(get_setting("ARGOS_INTER_THREADS", "1"))
139141
intra_threads = int(get_setting("ARGOS_INTRA_THREADS", "0"))
140142

143+
# Supported values: "cpu" and "cuda"
144+
device = get_setting("ARGOS_DEVICE_TYPE", "cpu")
145+
146+
# https://opennmt.net/CTranslate2/python/ctranslate2.Translator.html
147+
inter_threads = int(get_setting("ARGOS_INTER_THREADS", "1"))
148+
intra_threads = int(get_setting("ARGOS_INTRA_THREADS", "0"))
149+
141150

142151
class ModelProvider(Enum):
143152
OPENNMT = 0

argostranslate/tags.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ def is_same_structure(tag1: ITag | str, tag2: ITag | str) -> bool:
114114
ARGOS_OPEN_TAG = "<argos-tag>"
115115
ARGOS_CLOSE_TAG = "</argos-tag>"
116116

117-
GOLDEN_RATIO = (1 + 5**0.5) / 2
117+
GOLDEN_RATIO = (1 + 5 ** 0.5) / 2
118118

119119

120120
def flatten_tag(tag: ITag) -> str:

0 commit comments

Comments
 (0)