Skip to content

Commit

Permalink
Merge branch 'master' into v2
Browse files Browse the repository at this point in the history
  • Loading branch information
PJ-Finlay committed Aug 18, 2024
2 parents 3d2dabf + 327ee6c commit e0c1187
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 9 additions & 0 deletions argostranslate/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
"""
Argos Translate can be configured using either environment variables or json file
Configurations from environment variables supersede configurations from the JSON file.
### Environment variables
```
export ARGOS_DEBUG="0"
Expand Down Expand Up @@ -138,6 +140,13 @@ def set_setting(key: str, value):
inter_threads = int(get_setting("ARGOS_INTER_THREADS", "1"))
intra_threads = int(get_setting("ARGOS_INTRA_THREADS", "0"))

# Supported values: "cpu" and "cuda"
device = get_setting("ARGOS_DEVICE_TYPE", "cpu")

# https://opennmt.net/CTranslate2/python/ctranslate2.Translator.html
inter_threads = int(get_setting("ARGOS_INTER_THREADS", "1"))
intra_threads = int(get_setting("ARGOS_INTRA_THREADS", "0"))


class ModelProvider(Enum):
OPENNMT = 0
Expand Down
2 changes: 1 addition & 1 deletion argostranslate/tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def is_same_structure(tag1: ITag | str, tag2: ITag | str) -> bool:
ARGOS_OPEN_TAG = "<argos-tag>"
ARGOS_CLOSE_TAG = "</argos-tag>"

GOLDEN_RATIO = (1 + 5**0.5) / 2
GOLDEN_RATIO = (1 + 5 ** 0.5) / 2


def flatten_tag(tag: ITag) -> str:
Expand Down

0 comments on commit e0c1187

Please sign in to comment.