Orchestrate

Set up for Unit 3: neural network tools and an SAP BTP trial

Add PyTorch (CPU build) and Sentence Transformers to your course folder, create an SAP BTP trial account, tour the cockpit, and prove it all works.

Updated Sep 30, 2026Foundational 6 minDeep 40 min
Foundational layer · 6 min read

The 60-second version

Unit 3 moves from classic machine learning to neural networks and embeddings. A neural network is a model built from many small, adjustable pieces. An embedding is a list of numbers that captures what a piece of text means, so a computer can tell that "order on credit hold" and "sales order blocked for credit" are about the same thing.

Learners need two new free Python libraries for this. PyTorch builds and trains neural networks. Sentence Transformers turns text into embeddings with a small ready-made model.

Learners also create a free SAP BTP trial account. SAP Business Technology Platform (BTP) is where SAP customers build and run their own extensions and AI services. The last topic of Unit 3 explains how it is organized, and later units build on it. As of September 2026 the trial is free for up to 90 days, and anyone can sign up with an email address. Your company may still have its own rules about that.

Setup takes 45 to 60 minutes, mostly downloads and waiting for the trial to be created.

Why it matters to the business

Embeddings are behind most enterprise AI that "understands" text: searching product master data by meaning, finding similar past tickets, and giving a chatbot the right documents. Unit 3 builds a small semantic search over SAP-style master data. Later units grow that into grounded assistants.

The BTP trial matters for a different reason. Almost every SAP AI service a team will buy or build on sits in a BTP account. People who have clicked through a BTP account understand quotes, architecture diagrams and project plans faster. Terms such as global account, subaccount and entitlement stop being abstract.

Two points for a leader:

  • The trial is for learning only. SAP's documentation says a trial account must not be used for production or team development. It is deleted after 90 days, with everything in it.
  • Company data stays out. Everything in Unit 3 uses made-up data. Nothing from your SAP systems should go into a personal trial.

How SAP does it

The open tools in this unit are the same kind SAP's own data scientists use. SAP BTP offers two ways to try the platform, and they are often confused:

  • Trial account: free, time-limited, for individuals exploring the platform. As of September 2026 it lasts up to 90 days. Anyone can sign up at sap.com.
  • Free tier: free service plans inside a paid BTP contract (Pay-As-You-Go or an enterprise agreement, CPEA). It has no time limit and projects can move to production.

This course uses the trial, because it needs no contract. Later units check, at the time they are written, which AI services each option includes.

What this unit adds

Item What it is Cost Used in
PyTorch (CPU build) Library for building and training neural networks Free Neural networks from scratch, and Unit 4
Sentence Transformers Library and small models that turn text into embeddings Free Embeddings and semantic similarity, semantic search over SAP master data
An embedding model (all-MiniLM-L6-v2) A small ready-made model downloaded once from Hugging Face Free, no account Same as above
SAP BTP trial account Your own time-limited BTP global account and subaccount Free for 90 days SAP BTP foundations for AI builders, and later units

Time and money

  • Time: 45 to 60 minutes. PyTorch is a large download. The trial account takes a few minutes to be created.
  • Money: nothing. No credit card is part of the trial steps SAP describes.
  • Disk space: plan for a few gigabytes free. On Linux, installing PyTorch the default way pulls a much larger GPU build; the deep layer shows the smaller CPU command.
  • The trial clock: 90 days from sign-up. If a learner doesn't sign in for 30 days, the account is suspended. A learner who pauses the course for months can simply create a new trial later.

Questions to ask IT

  • Can learners download from pypi.org, download.pytorch.org and huggingface.co, or is there an internal mirror?
  • May learners sign up for an SAP BTP trial, and with a personal or a work email address?
  • Does the company network allow the SAP BTP trial sites (*.hanatrial.ondemand.com)?
  • Do learner laptops have a few gigabytes of free disk space?
  • If the company already has a BTP contract, is there a free-tier or sandbox subaccount learners could use later instead of a trial?

Common misconceptions

  • "Neural networks need a GPU." Not for this course. Unit 3's networks and the small embedding model run on any recent laptop. Unit 4's setup explains when a GPU helps.
  • "The BTP trial is the same as the free tier." No. The trial is time-limited and for individuals. The free tier sits inside a paid contract and can go to production.
  • "We can pilot on the trial." SAP's documentation rules out production use and team development. Use it to learn, then pilot in a proper account.
  • "The embedding model sends our text to a cloud service." Not here. The model is downloaded once and runs on the laptop.

Key terms

  • Neural network: a model made of layers of simple units whose weights are adjusted during training.
  • Embedding: a list of numbers that represents the meaning of a text, so similar meanings get similar numbers.
  • SAP BTP: SAP Business Technology Platform, where SAP customers build and run extensions and AI services.
  • Global account: your contract with SAP in BTP. In a trial, SAP creates one for you.
  • Subaccount: a space inside the global account, in one region, where services actually run.
  • Entitlement: the right to use a service in a subaccount; the basis of billing in a paid account.

Check yourself

Pick one answer for each question. The explanation appears after you choose.
  1. 1What does Unit 3's setup add, and what does it cost?

    Answer: B. Learners add PyTorch and Sentence Transformers, download one small embedding model, and create an SAP BTP trial. All of it is free; the trial lasts up to 90 days.
  2. 2What is an embedding, in business terms?

    Answer: C. An embedding turns text into numbers so that texts with similar meaning get similar numbers. That is what lets search find "order on credit hold" when someone types "sales order blocked for credit".
  3. 3A partner suggests running your pilot in an SAP BTP trial account. What is the problem?

    Answer: D. SAP's documentation says a trial must not be used for production or team development, and the account is deleted after 90 days with everything in it. Pilots belong in a proper account, such as a free-tier or sandbox subaccount under a contract.
  4. 4How does the BTP free tier differ from the trial?

    Answer: A. The free tier is a set of free service plans inside a Pay-As-You-Go or enterprise (CPEA) contract. It has no time limit and projects can move to production. The trial needs no contract but is time-limited and for learning only.
  5. 5Why does the course use made-up data in Unit 3?

    Answer: B. The trial is a personal learning account and the scripts run on a laptop. Keeping company data out avoids a data-protection problem, and the made-up data is shaped like SAP data so the lessons still carry over.
  6. 6What should you ask IT before learners start Unit 3?

    Answer: C. The setup downloads from PyPI, the PyTorch site and Hugging Face, and the trial runs on SAP's trial sites. IT should confirm access, the email address rule for sign-up, disk space, and whether a company sandbox exists as an alternative.
  7. 7Why is a hands-on BTP trial useful for a non-developer?

    Answer: D. Most SAP AI services sit in a BTP account. Having clicked through one, people read quotes, architecture diagrams and plans faster, because the account model is no longer abstract.
Deep layer · 40 min read

Mental model: two new libraries on your laptop, one new account in the cloud

Your course folder stays the same: one .venv, one requirements.txt, one Git repository. This unit adds two libraries to that folder and one thing outside it: an SAP BTP trial account that lives in SAP's cloud and that you reach through a web page called the cockpit.

flowchart LR
  T[PyTorch CPU build] --> V[.venv<br/>course Python]
  S[sentence-transformers] --> V
  V --> H[hello_torch.py]
  M[Embedding model<br/>downloaded once] --> H
  B[SAP BTP trial<br/>in SAP's cloud] --> N[btp_trial_notes.md]
  H --> C[check_unit03.py]
  N --> C

Nothing on your laptop talks to the BTP trial in this unit. You explore the trial in the browser and write down what you find. The Unit 3 topic on BTP foundations uses those notes.

How it works

PyTorch and the CPU build

PyTorch comes in two kinds of builds. A GPU build (also called a CUDA build) can use an NVIDIA graphics card to train faster. A CPU build uses only the normal processor. The CPU build is much smaller, and it is all this course needs until Unit 4.

Which build you get depends on your system and where pip downloads from:

Your system Plain pip install torch gives you What to run in this course
Windows The CPU build pip install torch
macOS (Apple silicon) The CPU build pip install torch
Linux The large GPU build pip install torch --index-url https://download.pytorch.org/whl/cpu

As of September 2026 the latest PyTorch release is 2.14.0 and needs Python 3.10 or newer. Your course Python from Unit 2 (3.11 or newer) meets that. PyPI lists macOS wheels only for Apple silicon Macs on macOS 14 or newer.

The --index-url option tells pip to download from PyTorch's own server instead of PyPI. That server has a separate copy of each release built for CPU only.

Sentence Transformers and the model download

Sentence Transformers is a library that loads a ready-made embedding model and turns texts into vectors with one call: model.encode(texts). It depends on PyTorch and on Hugging Face's transformers library, and pip installs those for you.

The library itself contains no model. The first time you ask for one, it downloads it from Hugging Face, a public site that hosts open models. This course uses all-MiniLM-L6-v2, the model in the library's own quick-start example. It turns each text into 384 numbers. After the first download, the copy on your computer is used, so it also works offline.

The SAP BTP trial account model

A paid SAP BTP account and a trial account use the same structure. SAP Learning describes it like this:

  • A global account represents your contract with SAP. In the trial, SAP creates one for you.
  • Directories (optional) group subaccounts, for example by department or region.
  • A subaccount runs in exactly one region (a data center location). Services and apps live here. Your trial gets one subaccount, named trial.
  • Entitlements say which services, and how much of each, a subaccount may use.

Inside the trial subaccount, SAP also sets up the Cloud Foundry environment, a runtime for apps. It has one org, linked one-to-one to the subaccount, and one space named dev where apps are deployed.

You find services in the Service Marketplace. Creating one gives you either a service instance (used by an app you deploy) or a subscription (a ready-made application that runs on its own). Both then appear under Instances and Subscriptions.

As of September 2026, SAP's documentation sets these trial rules:

Rule What it means for you
Free for up to 90 days Then the trial account is deleted automatically, with everything in it
Suspended after 30 days without sign-in Sign in regularly; each sign-in extends the current interval by up to 30 days, within the 90 days
Apps stop automatically every day Around midnight in your region; restart them when you need them
4 GB memory for apps, 8 GB instance memory, 10 routes, 40 services Plenty for the course
Not for production or team development Learning only; keep company data out

Build it yourself: add the Unit 3 tools and open your BTP trial

You will install PyTorch and Sentence Transformers, run a short script that trains one "neuron" and compares SAP-style texts by meaning, then create your SAP BTP trial and tour its cockpit. A check script confirms everything at the end.

Before you start: complete Set up your computer for this course and Set up for Unit 2. They install Python, VS Code and Git, create your orchestrate-course folder with its .venv, and add the data libraries. This walkthrough doesn't repeat those steps.

What you need

  • Your course folder from Units 1 and 2.
  • About 45 to 60 minutes and an internet connection.
  • A few gigabytes of free disk space.
  • An email address for the SAP account. The trial is free; no payment details are part of SAP's trial steps.

Step 1: Open your course folder and turn on the virtual environment

  1. Open VS Code, choose File > Open Folder, and open orchestrate-course.

  2. Open a terminal: Terminal > New Terminal.

  3. If the prompt doesn't start with (.venv), turn it on:

    • Windows (PowerShell):

      .venv\Scripts\Activate.ps1
    • macOS / Linux:

      source .venv/bin/activate

Step 2: Install PyTorch (CPU build)

Run the one command for your system, with (.venv) showing:

  • Windows (PowerShell):

    pip install torch
  • macOS:

    pip install torch
  • Linux:

    pip install torch --index-url https://download.pytorch.org/whl/cpu

Wait for a line starting Successfully installed. This is a large download and can take several minutes.

Step 3: Add Sentence Transformers and update requirements.txt

  1. In VS Code, open requirements.txt and add these two lines below the existing ones:

    torch
    sentence-transformers
  2. Save the file (Ctrl+S, or Cmd+S on Mac).

  3. Run:

    pip install -r requirements.txt
  4. Wait for Successfully installed. Lines saying Requirement already satisfied for torch and the Unit 2 libraries are expected: the CPU build from Step 2 is kept.

Step 4: Make the Unit 3 folder

From your course folder:

  • Windows (PowerShell):

    New-Item -ItemType Directory -Force unit03
    cd unit03
  • macOS / Linux:

    mkdir -p unit03
    cd unit03

Step 5: Run the PyTorch smoke test

The script trains the smallest possible neural network, one neuron, to learn the rule y = 2x + 1 from 20 noisy made-up points. It is the gradient descent you did by hand in Unit 2, but PyTorch works out the gradients for you. With --embed, it also compares SAP-style texts by meaning.

  1. In VS Code's file list, right-click unit03, choose New File and name it hello_torch.py.

  2. Paste the code below and save.

  3. In the terminal, inside unit03, run:

    python hello_torch.py
"""Unit 3 smoke test: train a one-neuron network with PyTorch, then (optionally) compare
SAP-style texts with an embedding model.

How to run (from the unit03 folder, with the course .venv turned on):
    python hello_torch.py            # PyTorch only, no download, no account
    python hello_torch.py --embed    # also download a small embedding model (one time) and compare texts

All data is made up.
"""
import argparse

import torch

QUERY = "Sales order blocked: customer over credit limit"
CANDIDATES = [  # made-up texts, shaped like notes on SAP documents
    "Order on credit hold until finance releases it",
    "Purchase order price differs from the invoice",
    "Planned order is late because a component is missing",
    "Pallet of M8 screws, zinc plated",
]


def train_one_neuron(steps: int = 500) -> None:
    """Learn y = 2x + 1 from 20 noisy points with gradient descent, the PyTorch way."""
    torch.manual_seed(0)                          # same "random" numbers every run
    x = torch.linspace(0, 1, 20).unsqueeze(1)     # 20 inputs, shape (20, 1)
    y = 2 * x + 1 + 0.05 * torch.randn(x.shape)   # true rule plus a little noise

    model = torch.nn.Linear(1, 1)                 # one neuron: y = w*x + b
    optimizer = torch.optim.SGD(model.parameters(), lr=0.5)
    loss_fn = torch.nn.MSELoss()

    for step in range(steps + 1):
        optimizer.zero_grad()                     # forget last step's gradients
        loss = loss_fn(model(x), y)               # how wrong are we?
        loss.backward()                           # PyTorch works out the gradients
        optimizer.step()                          # nudge w and b downhill
        if step % 100 == 0:
            print(f"  step {step:3d}  loss {loss.item():.4f}")

    w, b = model.weight.item(), model.bias.item()
    print(f"Learned w = {w:.2f}, b = {b:.2f}  (the true rule was w = 2, b = 1)")


def compare_texts(model_name: str) -> None:
    """Turn texts into embeddings (lists of numbers) and rank them by similarity to QUERY."""
    from sentence_transformers import SentenceTransformer  # imported here so the default run skips it

    print(f"\nLoading embedding model {model_name} (downloads once, then uses the copy on disk)...")
    model = SentenceTransformer(model_name)
    vectors = model.encode([QUERY] + CANDIDATES)
    print(f"Each text became {vectors.shape[1]} numbers.")
    scores = model.similarity(vectors[:1], vectors[1:])[0]  # QUERY against each candidate
    print(f"\nMost similar to: '{QUERY}'")
    for score, text in sorted(zip(scores.tolist(), CANDIDATES), reverse=True):
        print(f"  {score:5.2f}  {text}")


def main() -> None:
    parser = argparse.ArgumentParser(description="Unit 3 smoke test: PyTorch and embeddings.")
    parser.add_argument("--embed", action="store_true", help="also run the embedding comparison")
    parser.add_argument("--model", default="sentence-transformers/all-MiniLM-L6-v2",
                        help="embedding model to use with --embed")
    args = parser.parse_args()

    print(f"PyTorch {torch.__version__}, running on: CPU")
    print("Training one neuron on made-up points:")
    train_one_neuron()
    if args.embed:
        compare_texts(args.model)
    else:
        print("\nSkipped the embedding test. Run with --embed to try it.")


if __name__ == "__main__":
    main()

What success looks like:

PyTorch 2.14.0+cpu, running on: CPU
Training one neuron on made-up points:
  step   0  loss 2.7650
  step 100  loss 0.0019
  step 200  loss 0.0019
  step 300  loss 0.0019
  step 400  loss 0.0019
  step 500  loss 0.0019
Learned w = 2.10, b = 0.97  (the true rule was w = 2, b = 1)

Skipped the embedding test. Run with --embed to try it.

The loss drops quickly and then stays flat: the neuron has learned as much as the noisy points allow. That is why w is 2.10, not exactly 2. The version text after PyTorch differs by system, for example 2.14.0 on Windows and macOS or 2.14.0+cpu on Linux. The loss numbers may differ slightly between versions and systems; what matters is that the loss falls and w and b end near 2 and 1.

Step 6: Run the embedding test

  1. Still inside unit03, run:

    python hello_torch.py --embed
  2. The first run downloads the model from Hugging Face. You may see progress bars. No account or key is needed.

What success looks like (after the PyTorch lines):

Loading embedding model sentence-transformers/all-MiniLM-L6-v2 (downloads once, then uses the copy on disk)...
Each text became 384 numbers.

Most similar to: 'Sales order blocked: customer over credit limit'
  0.xx  Order on credit hold until finance releases it
  0.xx  ...
  0.xx  ...
  0.xx  Pallet of M8 screws, zinc plated

Your scores are real numbers in place of 0.xx, sorted from most to least similar. Expect the credit-hold text at or near the top and the screws at the bottom: the first is about the same business problem, the last is product master data. Run it a second time; it starts faster because the model is already on disk.

If the download fails (for example, a company network blocks Hugging Face), Step 5 still proves PyTorch works. Try Step 6 again on another network. The Unit 3 embeddings topic needs it.

What each part of the script does:

Part What it does
torch.manual_seed(0) Fixes PyTorch's random numbers, so every run makes the same noisy points
torch.linspace, torch.randn Build 20 inputs and the matching noisy outputs as tensors
torch.nn.Linear(1, 1) One neuron with one weight w and one bias b
MSELoss, SGD The error measure (mean squared error) and the gradient descent optimizer
zero_grad, backward, step The training loop: clear old gradients, compute new ones automatically, move the weights
SentenceTransformer(model_name) Loads the embedding model, downloading it the first time
model.encode(...) Turns each text into a vector of 384 numbers
model.similarity(...) Scores how alike the query vector is to each candidate vector
--embed, --model Optional: run the embedding test, and choose another model

Step 7: Create your SAP BTP trial account

  1. If you don't have an SAP account yet: open https://www.sap.com, click Log On in the upper-right corner, then Register. Fill in the required fields and click Submit.
  2. Open your email and click the activation link SAP sent you.
  3. Open the trial page: https://www.sap.com/products/technology-platform/trial.html. Click Try Now and follow the instructions on screen.
  4. When sign-up is complete, open the trial cockpit: https://cockpit.hanatrial.ondemand.com/trial/. Bookmark it; this is how you get back.
  5. The cockpit asks you to choose a region. Pick one near you from the list it shows.
  6. Click Create Account. A dialog shows progress while SAP sets up your trial. This can take a few minutes.
  7. When it finishes, click Continue.
  8. You now see your trial global account. Click the tile named trial to open your subaccount.

Step 8: Tour the cockpit and write your notes

You will look around your trial and write down what you find in a notes file. None of this is secret, but it is personal to your account, so keep it in your course folder.

  1. In VS Code, create btp_trial_notes.md inside unit03 and paste this template:

    # My SAP BTP trial
    
    - Created on:
    - Region:
    - Global account name:
    - Subaccount name: trial
    - Cloud Foundry API endpoint:
    - Cloud Foundry org name:
    - Space(s):
    - Three services in the Service Marketplace that mention AI or machine learning:
    - Anything in Instances and Subscriptions already:
  2. In the cockpit, on the subaccount page (Overview), find the Cloud Foundry section. Copy the API endpoint and the org name into your notes.

  3. Find the Spaces section. You should see one space named dev. Write it down.

  4. Note the region shown for the subaccount.

  5. In the left menu, open Services > Service Marketplace. Type AI in the search box. Write down up to three service names you see. If none appear, write "none found"; that is a valid result too.

  6. Open Services > Instances and Subscriptions. In a new trial it may be empty; write "empty" if so.

  7. Look at the breadcrumbs at the top of the page. Click Trial Home or the global account name to go up a level, then open the trial tile again. This is how you move between the global account and the subaccount.

  8. Don't click Enable Kyma, Delete Trial or anything that creates services yet. Later units tell you when to.

  9. Save the notes file.

Step 9: Run the Unit 3 check

  1. Go back to your course folder in the terminal:

    cd ..
  2. In VS Code, create a new file in the course folder (not in unit03), paste the script below and save it as check_unit03.py.

  3. Run it:

    python check_unit03.py
"""Check that your computer is ready for Unit 3 (neural networks and embeddings).

Run it from your course folder:  python check_unit03.py
It only reads your setup and opens two web pages to test your network.
It installs nothing and sends none of your files or keys anywhere.
"""
import importlib.metadata
import importlib.util
import os
import subprocess
import sys
import urllib.error
import urllib.request

problems = 0


def report(ok: bool, label: str, fix: str = "", optional: bool = False) -> None:
    """Print one line: OK, MISSING (must fix) or LATER (optional for now)."""
    global problems
    if ok:
        print(f"  OK       {label}")
    elif optional:
        print(f"  LATER    {label}  ->  {fix}")
    else:
        problems += 1
        print(f"  MISSING  {label}  ->  {fix}")


def version_of(package: str) -> str:
    try:
        return importlib.metadata.version(package)
    except importlib.metadata.PackageNotFoundError:
        return ""


def reachable(url: str) -> bool:
    """True if the site answers at all (any HTTP status counts; we only test the network)."""
    try:
        urllib.request.urlopen(urllib.request.Request(url, method="HEAD"), timeout=15)
        return True
    except urllib.error.HTTPError:
        return True   # the site answered, even if with an error page
    except Exception:
        return False


print("\n1. Python")
v = sys.version_info
report(v >= (3, 11), f"Python {v.major}.{v.minor}.{v.micro}",
       "the course needs Python 3.11 or newer (see Set up for Unit 2, Step 1)")
report(sys.prefix != sys.base_prefix, "virtual environment is active", "activate .venv (Step 1)")

print("\n2. Libraries")
for module, package in [("torch", "torch"), ("sentence_transformers", "sentence-transformers")]:
    found = importlib.util.find_spec(module) is not None
    label = f"{package} {version_of(package)}".strip()
    report(found, label, "install it (Steps 2 and 3)")

print("\n3. PyTorch works")
# Run a tiny calculation with gradients in a fresh Python. This catches broken installs.
test = (
    "import torch;"
    "w = torch.tensor(3.0, requires_grad=True);"
    "(w * w).backward();"
    "assert abs(w.grad.item() - 6.0) < 1e-6;"
    "print(torch.version.cuda or '')"
)
try:
    result = subprocess.run([sys.executable, "-c", test], capture_output=True, text=True, timeout=180)
    ok = result.returncode == 0
    detail = (result.stderr.strip().splitlines() or ["unknown error"])[-1] if not ok else ""
    gpu_build = ok and bool(result.stdout.strip())
except subprocess.TimeoutExpired:
    ok, detail, gpu_build = False, "timed out", False
report(ok, "tensor maths and gradients", f"{detail}; reinstall PyTorch (Step 2)")
if ok:
    report(not gpu_build, "CPU build of PyTorch",
           "you have the larger GPU (CUDA) build; it works, but the CPU build saves gigabytes (Step 2)",
           optional=True)

print("\n4. Network")
report(reachable("https://huggingface.co"), "can reach huggingface.co (embedding model download)",
       "ask IT to allow huggingface.co, or use another network", optional=True)
report(reachable("https://cockpit.hanatrial.ondemand.com"), "can reach the SAP BTP trial site",
       "ask IT to allow *.hanatrial.ondemand.com, or use another network", optional=True)

print("\n5. Course folder")
report(os.path.isdir("unit03"), "unit03 folder", "create it (Step 4)", optional=True)
report(os.path.exists(os.path.join("unit03", "hello_torch.py")), "unit03/hello_torch.py",
       "create it (Step 5)", optional=True)
report(os.path.exists(os.path.join("unit03", "btp_trial_notes.md")), "unit03/btp_trial_notes.md",
       "write it during the cockpit tour (Step 8)", optional=True)

print()
if problems:
    print(f"{problems} item(s) to fix. Fix them in order, then run this again.")
    sys.exit(1)
print("All set. Your computer is ready for Unit 3.")

What success looks like:

1. Python
  OK       Python 3.11.15
  OK       virtual environment is active

2. Libraries
  OK       torch 2.14.0
  OK       sentence-transformers 6.1.0

3. PyTorch works
  OK       tensor maths and gradients
  OK       CPU build of PyTorch

4. Network
  OK       can reach huggingface.co (embedding model download)
  OK       can reach the SAP BTP trial site

5. Course folder
  OK       unit03 folder
  OK       unit03/hello_torch.py
  OK       unit03/btp_trial_notes.md

All set. Your computer is ready for Unit 3.

Your version numbers may differ; that is fine as long as each line says OK. A LATER line doesn't stop you:

  • LATER CPU build of PyTorch means you have the GPU build. It works; it only uses more disk. To switch on Linux, run pip uninstall torch, then the Step 2 command.
  • LATER can reach ... means your network blocked that site when the check ran. Try another network, or ask IT.

What each part of the check does:

Part What it checks
Python Version 3.11 or newer, and that .venv is active
Libraries That PyTorch and Sentence Transformers can be found, and their versions
PyTorch works Starts a fresh Python, computes a gradient (the slope of w*w at 3 is 6), and asks whether this is a GPU build
Network Whether Hugging Face and the BTP trial cockpit answer. It sends no data, only a request for the page header
Course folder That unit03, the smoke test and your trial notes exist

Like the earlier checks, it uses only Python's built-in modules and changes nothing.

Step 10: Save your work in Git

From the course folder:

git add requirements.txt check_unit03.py unit03/hello_torch.py unit03/btp_trial_notes.md
git commit -m "Set up Unit 3: PyTorch, embeddings, BTP trial"

The downloaded model is not in your course folder, so nothing large goes into Git.

If something goes wrong

What you see What it means What to do
python is not recognized, or command not found Python isn't installed, or the terminal can't find it Windows: repeat Unit 1, Step 1, then open a new terminal. macOS/Linux: use python3 until .venv is active
ModuleNotFoundError: No module named 'torch' (or sentence_transformers) The library isn't installed in the Python you're using Check for (.venv) in the prompt, then repeat Steps 2 and 3
No matching distribution found for torch Your Python or system has no current PyTorch build: Python older than 3.10, a 32-bit Python, or an Intel Mac Run python --version; recreate .venv with a newer 64-bit Python (Unit 2, Step 1). On an Intel Mac, use another computer for Units 3 and 4, or use an online notebook service, which Unit 4's setup plans to cover
Linux: the install downloads several gigabytes, or nvidia packages appear pip is fetching the GPU build Stop with Ctrl+C, run pip uninstall torch, then the Linux command in Step 2
pip shows ProxyError, SSLError or Could not fetch URL Your network or company proxy blocks pypi.org or download.pytorch.org Try a home network, or ask IT for access or the internal package mirror
--embed fails with a connection, proxy or huggingface.co error The model download is blocked Try another network, or ask IT to allow huggingface.co. Step 5 alone still proves PyTorch works
A warning mentions HF_TOKEN or not being logged in to Hugging Face Hugging Face notes you are downloading without an account Ignore it. This model needs no account or key
No space left on device during install The disk is full Free a few gigabytes and run the command again
The trial page asks you to log on again and again Browser cookies are blocked, or you are signed in with another SAP account Try a private browser window, or sign out of other SAP sites first
The cockpit says the account is suspended You didn't sign in for 30 days or more SAP deletes suspended trials. Create a new trial and rebuild it from your notes file
Windows: .venv\Scripts\Activate.ps1 cannot be loaded PowerShell blocks scripts Run Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser, answer Y, and try again

Where this shows up in SAP

The trial account you created has the same shape as a customer's paid BTP account: a global account, subaccounts in regions, entitlements, and services from the marketplace. When a customer's architect says "we'll provision it in the AI subaccount in the EU region", you now know what that means and where it lives in the cockpit.

The difference is the contract. A trial is free, isolated and deleted after 90 days. A customer's account is a contract with SAP, where entitlements drive the bill. SAP also offers a free tier: free service plans inside a Pay-As-You-Go or CPEA contract, with no time limit and a path to production. When a project needs to go past learning, ask whether the customer's account has free-tier plans for the service in question before anyone buys a paid plan.

Embeddings show up in SAP too. Units 5 and 7 look at SAP's own options for embedding models and vector search, and compare them with the open model you downloaded here.

Pitfalls

  • The GPU build by accident. On Linux, a plain pip install torch, or recreating .venv from requirements.txt alone, fetches the large GPU build. Run the CPU command first.
  • Letting the trial lapse. Thirty days without signing in suspends the trial. Sign in now and then, and keep your notes, so a new trial is quick to set up.
  • Treating the trial as a team sandbox. SAP's rules exclude team development and production use. Share what you learn, not the account.
  • Company data in the trial or the model. Everything in Unit 3 is made up. Keep it that way in a personal account.
  • Forgetting the daily stop. Apps in the trial stop around midnight in your region. If something you deployed "disappeared" the next day, restart it.
  • Assuming the embedding model knows SAP terms. It is a general-purpose model. It knows that "credit hold" and "blocked for credit" are close, but not your company's own codes. The embeddings topic tests where it breaks.

Exercise: write your own SAP texts and read your trial

  1. Copy hello_torch.py to my_texts.py in unit03.

  2. Change QUERY to a problem from a process you know, for example a three-way match exception: "Invoice quantity higher than goods receipt".

  3. Replace CANDIDATES with five made-up texts: two that describe the same problem in other words, two about other processes, and one piece of product master data.

  4. Run python my_texts.py --embed. Check that your two rewordings rank highest.

  5. If one of them doesn't, write one sentence in btp_trial_notes.md under a new heading ## Embedding surprises, saying which text ranked where and why you think so.

  6. Complete every line of the notes template from Step 8.

  7. Save your work in Git:

    git add unit03/my_texts.py unit03/btp_trial_notes.md
    git commit -m "Add my own embedding test and BTP trial notes"

Done when: check_unit03.py prints All set, my_texts.py --embed prints your five texts ranked by similarity, btp_trial_notes.md has every line filled in, and git log shows the commit. Keep both files: the embeddings topic reuses your texts, and the SAP BTP foundations topic starts from your trial notes.

Check yourself

Pick one answer for each question. The explanation appears after you choose.
  1. 1You are on Linux. Which command installs the CPU build of PyTorch?

    Answer: B. On Linux, PyPI serves the GPU (CUDA) build. The --index-url option points pip at PyTorch's own server, which has a CPU-only copy of each release. On Windows and macOS, plain pip install torch already gives the CPU build.
  2. 2In hello_torch.py, what does loss.backward() do?

    Answer: C. backward() computes the gradients, the slopes you calculated by hand in Unit 2. optimizer.step() then moves the weights, and zero_grad() clears the old gradients before the next step.
  3. 3Why does the embedding test work offline on the second run?

    Answer: D. The library contains no model. The first call downloads all-MiniLM-L6-v2 from Hugging Face; later runs load the copy on your computer, so they start faster and need no network.
  4. 4What does model.similarity(...) return in the smoke test?

    Answer: A. encode turns each text into a vector of 384 numbers. similarity compares the query's vector with each candidate's and returns a score, where higher means more alike. It compares meaning, not shared words.
  5. 5How is an SAP BTP trial account organized?

    Answer: C. SAP creates a global account for you with one subaccount, trial, in the region you chose. The subaccount has one Cloud Foundry org, linked one-to-one, and one space named dev for deploying apps.
  6. 6What is the difference between a service instance and a subscription in the cockpit?

    Answer: D. Both come from the Service Marketplace and appear under Instances and Subscriptions. A subscription is a standalone application; a service instance needs a runtime and is used by an application you deploy.
  7. 7You haven't signed in to your trial for five weeks, and the cockpit says it is suspended. What happened, and what do you do?

    Answer: A. SAP's documentation suspends trials after 30 days without sign-in, and suspended trials are deleted. Create a new trial; your notes file makes that quick. The daily stop only stops apps; it doesn't suspend the account.
  8. 8A colleague wants to load real customer master data into your trial to test semantic search. What do you say?

    Answer: C. SAP's documentation says a trial must not be used for production or team development, and company data doesn't belong in a personal account. Use made-up data now, and a proper subaccount under a contract for real pilots.

Sources

Sign in to track your progress

We'll email you a one-time sign-in link. No password needed.

or

Tell us a little about you

Optional, every field. It helps us pitch answers to your questions at the right level and decide which topics to write next. It is never shown publicly, and you can change or clear it anytime from the account menu.

SAP areas you work in