mirror of
https://github.com/langchain-ai/langchain.git
synced 2026-10-10 03:45:17 +03:00
4.1 KiB
4.1 KiB
In [ ]:
!curl https://raw.githubusercontent.com/slai-labs/get-beam/main/get-beam.sh -sSfL | shIn [ ]:
import os
import subprocess
beam_client_id = "<Your beam client id>"
beam_client_secret = "<Your beam client secret>"
# Set the environment variables
os.environ["BEAM_CLIENT_ID"] = beam_client_id
os.environ["BEAM_CLIENT_SECRET"] = beam_client_secret
# Run the beam configure command
!beam configure --clientId={beam_client_id} --clientSecret={beam_client_secret}In [ ]:
!pip install beam-sdkIn [ ]:
from langchain.llms.beam import Beam
llm = Beam(
model_name="gpt2",
name="langchain-gpt2-test",
cpu=8,
memory="32Gi",
gpu="A10G",
python_version="python3.8",
python_packages=[
"diffusers[torch]>=0.10",
"transformers",
"torch",
"pillow",
"accelerate",
"safetensors",
"xformers",
],
max_length="50",
verbose=False,
)
llm._deploy()
response = llm._call("Running machine learning on a remote GPU")
print(response)