Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg

# PyInstaller
*.manifest
*.spec

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# IDEs
.vscode/
.idea/
*.swp
*.swo
*~

# OS files
.DS_Store
Thumbs.db
5 changes: 5 additions & 0 deletions ruaccent/accent_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ def put_accent(self, word):
lower_word = word.lower()
inputs = self.tokenizer(lower_word, return_tensors="np")
inputs = {k: v.astype(np.int64) for k, v in inputs.items()}

# Add token_type_ids if missing (zeros with same shape as input_ids)
if 'token_type_ids' not in inputs:
inputs['token_type_ids'] = np.zeros_like(inputs['input_ids'])

outputs = self.session.run(None, inputs)
output_names = {output_key.name: idx for idx, output_key in enumerate(self.session.get_outputs())}
logits = outputs[output_names["logits"]]
Expand Down
Loading