BookmarkSubscribeRSS Feed
alisio_meneses
Quartz | Level 8

Hello there,

I'm attempting to utilize BERT and DLPy for sentiment analysis based on the tutorial outlined in the paper titled "SAS4429-2020 NLP with BERT: Sentiment Analysis Using SAS® Deep Learning and DLPy". I'm currently facing a challenge at step 4 (ATTACH MODEL PARAMETERS), which involves linking the trained model parameters from the HDF5 file to the BERT model. The Deep Learning actions must have access to the HDF5 file. However, since the client computer is typically separate from the server, the following Python code snippet establishes a "server_dir" to which the generated parameters must be copied for accessibility by the Viya server:

 

import os
from shutil import copyfile

server_dir = 'path/to/your/server-directory'

copyfile(os.path.join(cache_dir, 'bert-base-uncased.kerasmodel.h5'),
         os.path.join(server_dir, 'bert-base-uncased.kerasmodel.h5'))
.......

 

 

However, there's a catch: I’m using a SAS Viya 3.5 environment with a distributed server architecture, and the Python runtime lacks a direct connection to the file server, so the ‘copyfile’ function is a no go .

 

While I can manually copy the file from the client to the server and load it from there, it raises the question o of "where to place the HDF5 file within the distributed server architecture (cas controller, cas workers, SPRE)?".

 

thank you!

 

For more details, you can refer to the paper "SAS4429-2020 NLP with BERT: Sentiment Analysis Using SAS® Deep Learning and DLP" here.

Thank you.

2 REPLIES 2
sbxkoenk
SAS Super FREQ

Have moved this to "Data Science" - board.

sbxkoenk
SAS Super FREQ

Hello,

 

To import the model weights table, use Deep Learning Action Set and  dlImportModelWeights Action.

  • dlImportModelWeights() imports the model weights information (that are initially specified as CAS table object) from external sources.
  • The currently supported format is HDF5.

See :

BR, Koen

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
How to choose a machine learning algorithm

Use this tutorial as a handy guide to weigh the pros and cons of these commonly used machine learning algorithms.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 660 views
  • 0 likes
  • 2 in conversation