Skip to content

Commit

Permalink
try fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
shifucun committed May 25, 2024
1 parent 97dea5d commit e40be21
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 3 additions & 2 deletions nl_server/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ def create_app():
if sys.version_info >= (3, 8) and sys.platform == "darwin":
torch.set_num_threads(1)

app = Flask(__name__)
app.register_blueprint(routes.bp)

# Build the registry before creating the Flask app to make sure all resources
# are loaded.
try:
Expand All @@ -68,8 +71,6 @@ def create_app():
print('\033[91m{}\033[0m'.format(msg))
raise e

app = Flask(__name__)
app.register_blueprint(routes.bp)
app.config[registry.REGISTRY_KEY] = r
logging.info('NL Server Flask app initialized')
return app
2 changes: 0 additions & 2 deletions nl_server/model/sentence_transformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@ def __init__(self, model_info: LocalModelConfig):
super().__init__(model_info.score_threshold, returns_tensor=True)

# Download model from gcs if there is a gcs folder specified
logging.info(f'Downloading tuned model from: {model_info.gcs_folder}')
model_path = gcs.maybe_download(model_info.gcs_folder)
logging.info(f'Loading tuned model from: {model_path}')
self.model = SentenceTransformer(model_path)

def encode(self, queries: List[str], show_progress_bar=False) -> torch.Tensor:
Expand Down

0 comments on commit e40be21

Please sign in to comment.