Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use SSHTunnel for slurm-based start_server requests #146

Open
Kipok opened this issue Oct 3, 2024 · 0 comments
Open

Use SSHTunnel for slurm-based start_server requests #146

Kipok opened this issue Oct 3, 2024 · 0 comments

Comments

@Kipok
Copy link
Collaborator

Kipok commented Oct 3, 2024

Currently to run requests to a model hosted on slurm, we need to do something like this

from nemo_skills.inference.server.code_execution_model import get_code_execution_model
from nemo_skills.code_execution.sandbox import get_sandbox
from nemo_skills.prompt.utils import Prompt, get_prompt
import os

os.environ['NEMO_SKILLS_SSH_KEY_PATH'] = '<path to key>'
os.environ['NEMO_SKILLS_SSH_SERVER'] = '<cluster hostname>'

sandbox = get_sandbox(
    sandbox_type="local",
    host='<cluster host>',
)

llm = get_code_execution_model(
    server_type='trtllm',
    host='<cluster host>',
    sandbox=sandbox,
)

prompt = get_prompt('generic/default', 'llama3-instruct')
prompt.config.system = "Environment: ipython\n\nUse Python to solve user's request."

prompts = [prompt.fill({
    'question': "Calculate how many 'r' are in strawberry.",
})]

extra_generate_params = {
    "code_begin": prompt.config.template.code_begin,
    "code_end": prompt.config.template.code_end,
    "code_output_begin": prompt.config.template.code_output_begin,
    "code_output_end": prompt.config.template.code_output_end,
}

print(prompts[0])
outputs = llm.generate(
    prompts=prompts,
    stop_phrases=prompt.stop_phrases,
    tokens_to_generate=128,
    temperature=0.0,
    random_seed=0,
    **extra_generate_params,
)
print(outputs[0]["generation"])

We should add some function that will set up that SSH connection through the nemo-run tunnel. Ideally also avoid using sshtunnel_requests since vllm server doesn't support that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant