luca-medeiros/lang-segment-anything

run in colab then url can't open

Closed this issue · 2 comments

When I run: !lightning run app /content/lang-segment-anything/app.py

Your Lightning App is starting. This won't take long.
INFO: Your app has started. View it in your browser: http://127.0.0.1:7501/view
/usr/bin/xdg-open: 869: www-browser: not found
/usr/bin/xdg-open: 869: links2: not found
/usr/bin/xdg-open: 869: elinks: not found
/usr/bin/xdg-open: 869: links: not found
/usr/bin/xdg-open: 869: lynx: not found
/usr/bin/xdg-open: 869: w3m: not found
xdg-open: no method available for opening 'http://127.0.0.1:7501/view'
Downloading (…)ingDINO_SwinB.cfg.py: 100% 1.01k/1.01k [00:00<00:00, 1.03MB/s]
final text_encoder_type: bert-base-uncased
Downloading (…)okenizer_config.json: 100% 28.0/28.0 [00:00<00:00, 18.1kB/s]
Downloading (…)lve/main/config.json: 100% 570/570 [00:00<00:00, 383kB/s]
Downloading (…)solve/main/vocab.txt: 100% 232k/232k [00:00<00:00, 3.86MB/s]
Downloading (…)/main/tokenizer.json: 100% 466k/466k [00:00<00:00, 5.82MB/s]
Downloading model.safetensors: 100% 440M/440M [00:03<00:00, 132MB/s]
Some weights of the model checkpoint at bert-base-uncased were not used when initializing BertModel: ['cls.seq_relationship.bias', 'cls.predictions.transform.LayerNorm.weight', 'cls.predictions.bias', 'cls.seq_relationship.weight', 'cls.predictions.transform.dense.weight', 'cls.predictions.transform.dense.bias', 'cls.predictions.transform.LayerNorm.bias']

  • This IS expected if you are initializing BertModel from the checkpoint of a model trained on another task or with another architecture (e.g. initializing a BertForSequenceClassification model from a BertForPreTraining model).
  • This IS NOT expected if you are initializing BertModel from the checkpoint of a model that you expect to be exactly identical (initializing a BertForSequenceClassification model from a BertForSequenceClassification model).
    Downloading (…)no_swinb_cogcoor.pth: 100% 938M/938M [00:29<00:00, 31.4MB/s]
    Model loaded from /root/.cache/huggingface/hub/models--ShilongLiu--GroundingDINO/snapshots/a94c9b567a2a374598f05c584e96798a170c56fb/groundingdino_swinb_cogcoor.pth
    => _IncompatibleKeys(missing_keys=[], unexpected_keys=['label_enc.weight'])
    Downloading: "https://dl.fbaipublicfiles.com/segment_anything/sam_vit_h_4b8939.pth" to /root/.cache/torch/hub/checkpoints/sam_vit_h_4b8939.pth
    100% 2.39G/2.39G [00:17<00:00, 149MB/s]
    Running on local URL: http://127.0.0.1:38649/

To create a public link, set share=True in launch().

But the url is invalid.
Please help to check, you could try it in your colab.

When you run a local server, it's typically accessible on your machine only, not over the Internet. '127.0.0.1' is the IP address for 'localhost', which means 'this machine'. The number after the colon is the port number. Therefore, you can only access this URL on the machine where you're running the server, not on other machines.

That's why the URL appears to be "invalid" if you try to access it on another machine. However, if you are running this on a remote machine such as Google Colab or a remote server, you will not be able to access this URL directly since 'localhost' or '127.0.0.1' refers to your local machine, not the machine where the server is running.

If you're running this on Google Colab or a similar service, you may need to use a service like ngrok or localtunnel to expose your local server to the internet. These tools create a public URL for your local server, allowing you to access it from anywhere.

Also, there seems to be an issue with xdg-open command which is not finding any text-based browser to open the URL. If you are running this on a system with a GUI, you may want to set your default browser with xdg-settings command.

However, please note that opening a web browser on a server or a cloud environment like Google Colab is not possible as these environments are headless and don't have a GUI.

Again, if you're working in a local environment, you should be able to simply copy and paste the URL into your web browser. If you're on a remote machine, you'll need to use a service like ngrok or localtunnel as mentioned above.

One more thing to note: sometimes you may face the issue that the port is being used by another process. In such cases, you might need to either stop the process that's currently using the port or run your server on a different port.

Somehow related #25