0

For context, I'm helping peers attribute stock tickers to a number of text sample. I'm currently opening a connection to gemma3.1:1b and asking the LLM to attribute a ticker or None per text sample. I've designed some primitive functionality with processes to start, stop, etc. I'm confident that we can assume that functionality is error free.

# Start the Ollama service
ollama_process, base_url = start_ollama_serve()

# Stop the Ollama service
stop_ollama_service()

# Check if the service is running
check_ollama_serve()

With this in mind, we use a prompt, given some sample text as such...

def attribute_ticker_ollama(post: str) -> str:
    """
    Extracts the ticker symbol from the submission text.
    """
    response = ollama.chat(
        model='llama3.2:3b',  
        messages=[{
            'role': 'user', 
            'content': f'what is the stock ticker for this text "{post}" you have to answer in one word with no period. If you cant determine it just ourput None. Also if there is no text provided output None.'
        }]
    )
    if len(response['message']['content']) > 5:
        response['message']['content'] = 'None'
    return response['message']['content']

Finally, I use the previous code, attempting to create a new pandas dataframe column with the provided ticker text.

# Start the Ollama server
ollama_process, base_url = start_ollama_serve()

# Apply the function to the entire collection
merged_collection['ticker'] = merged_collection.apply(lambda x: attribute_ticker_ollama(f'{x['title']} {x['selftext']}'), axis=1)

# Stop the Ollama server
stop_ollama_service()

# Check if the server is running
check_ollama_serve()

Unfortunately, this process (from the third code block) has been running for almost 20 hours. My question is about linux, python, and the general environment. Is it possibly to view any complex details about this process, while this is still running? I know there are a number of tools on Linux, which I am not well versed in. I'd love to find some metric about the progress of this as well, but this may be a more complex or nuanced question than I realize. How might I approach/rephrase this question, if I am not understanding this as well as I can?

Details...

  • OS: Windows 11 -> WSL2 Ubuntu Distribution.
  • Python: 3.12.3 (Virtual Env.)
  • GPU: RTX 3060 (Laptop)
  • IPYNB: Using the VSCode extention for notebook Kernals.
3
  • I think VSCode will allow you to attach a debug session to a process by id. Commented May 2 at 18:55
  • 1
    @JonSG ahhhhh that makes sense. Commented May 2 at 18:57
  • 2
    @JonSG although, I'm not sure a python debugger will help much, since I believe .appy is done in Cython Commented May 2 at 18:59

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.